-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathmfx
More file actions
executable file
·474 lines (442 loc) · 12.2 KB
/
mfx
File metadata and controls
executable file
·474 lines (442 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
usage() {
cat <<'EOF'
Usage:
./mfx <command> [options]
Commands:
run [--minutes N | --seconds N] [--debug] [--open | --no-open]
Build + run macOS core host and print settings URL.
--debug starts the Vite source-mode WebUI after the host is ready.
Default browser behavior: do not open settings automatically.
Default auto stop: 30 minutes (disabled by default in --debug).
run-no-build [--minutes N | --seconds N] [--debug] [--open | --no-open]
Run macOS core host without rebuilding core/WebUI.
--debug starts the Vite source-mode WebUI after the host is ready.
Default browser behavior: do not open settings automatically.
Default auto stop: 30 minutes (disabled by default in --debug).
build [platform options...]
Build native project for current host platform.
macOS: builds `mfx_entry_posix_host` (+ WebUI by default).
Windows: Release|x64 by default (`--no-gpu`, optional `--gpu`).
package [platform options...]
Build native package for current host platform.
macOS: .app + zip + dmg
Windows: installer exe (default `Release|x64`, `--shipping` for Shipping; default `--no-gpu`, optional `--gpu`)
package-no-build [platform options...]
Produce native package for current host platform without rebuilding.
effects [--skip-build] [--strict]
Run macOS effects type parity selfcheck.
--strict: fail if constrained-runtime startup is skipped.
verify-effects [--strict]
Run POSIX effects regression suite (recommended daily gate).
--strict: fail if scaffold/core/manual phases are skipped.
verify-full [--strict]
Run full POSIX regression suite.
--strict: fail if scaffold/core/manual phases are skipped.
Compatibility aliases:
start -> run
fast -> run-no-build (also skips core/WebUI rebuild)
bld -> build
pack -> package
pkg -> package
help
Show this help.
EOF
}
to_positive_int() {
local value="$1"
local label="$2"
if ! [[ "$value" =~ ^[0-9]+$ ]] || [[ "$value" == "0" ]]; then
echo "invalid $label: $value" >&2
exit 2
fi
echo "$value"
}
run_start() {
local skip_build="$1"
local skip_webui_build="$2"
shift
shift
local minutes=30
local seconds=""
local duration_overridden=0
local debug_mode=0
local open_browser=0
while [[ $# -gt 0 ]]; do
case "$1" in
--minutes)
[[ $# -ge 2 ]] || { echo "missing value for --minutes" >&2; exit 2; }
minutes="$2"
duration_overridden=1
shift 2
;;
--seconds)
[[ $# -ge 2 ]] || { echo "missing value for --seconds" >&2; exit 2; }
seconds="$2"
duration_overridden=1
shift 2
;;
--debug)
debug_mode=1
shift
;;
--no-debug)
debug_mode=0
shift
;;
--no-open)
open_browser=0
shift
;;
--open)
open_browser=1
shift
;;
*)
echo "unknown option for run/run-no-build: $1" >&2
exit 2
;;
esac
done
local stop_seconds
if [[ -n "$seconds" && "$minutes" != "30" ]]; then
echo "use either --minutes or --seconds, not both" >&2
exit 2
fi
if [[ -n "$seconds" ]]; then
stop_seconds="$(to_positive_int "$seconds" "seconds")"
else
minutes="$(to_positive_int "$minutes" "minutes")"
stop_seconds="$((minutes * 60))"
fi
if [[ "$debug_mode" == "1" && "$duration_overridden" == "0" ]]; then
stop_seconds=0
fi
local -a args
args=(--auto-stop-seconds "$stop_seconds")
if [[ "$skip_build" == "1" ]]; then
args+=(--skip-build)
fi
if [[ "$skip_webui_build" == "1" ]]; then
args+=(--skip-webui-build)
fi
if [[ "$debug_mode" == "1" ]]; then
args+=(--debug)
fi
if [[ "$debug_mode" == "1" || "$open_browser" == "0" ]]; then
args+=(--no-open)
fi
"$repo_root/tools/platform/manual/run-macos-core-websettings-manual.sh" "${args[@]}"
if [[ "$debug_mode" == "1" ]]; then
local -a web_args=()
if [[ "$open_browser" != "1" ]]; then
web_args+=(--no-open)
fi
"$repo_root/tools/platform/manual/run-webui-dev-manual.sh" "${web_args[@]}"
fi
}
run_package() {
local skip_build="$1"
local skip_webui_build="$2"
shift
shift
local -a args=()
local package_script=""
case "$OSTYPE" in
darwin*)
package_script="$repo_root/tools/platform/package/build-macos-portable.sh"
;;
msys*|cygwin*|win32*)
package_script="$repo_root/tools/platform/package/build-windows-installer.sh"
;;
*)
echo "package is unsupported on this host platform: $OSTYPE" >&2
exit 2
;;
esac
while [[ $# -gt 0 ]]; do
case "$1" in
--build-dir|--output-dir|--package-name)
[[ $# -ge 2 ]] || { echo "missing value for $1" >&2; exit 2; }
args+=("$1" "$2")
shift 2
;;
--gpu|--no-gpu)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
args+=("$1")
else
echo "$1 is only supported on Windows packaging" >&2
exit 2
fi
shift
;;
--shipping|--release|--configuration)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
if [[ "$1" == "--configuration" ]]; then
[[ $# -ge 2 ]] || { echo "missing value for --configuration" >&2; exit 2; }
args+=("$1" "$2")
shift 2
else
args+=("$1")
shift
fi
else
echo "$1 is only supported on Windows packaging" >&2
exit 2
fi
;;
--no-zip|--no-dmg)
if [[ "$OSTYPE" == darwin* ]]; then
args+=("$1")
else
echo "$1 is only supported on macOS packaging" >&2
exit 2
fi
shift
;;
--skip-build)
skip_build=1
shift
;;
--skip-webui-build)
skip_webui_build=1
shift
;;
*)
echo "unknown option for package/package-no-build: $1" >&2
exit 2
;;
esac
done
if [[ "$skip_build" == "1" ]]; then
args+=(--skip-build)
fi
if [[ "$skip_webui_build" == "1" ]]; then
args+=(--skip-webui-build)
fi
exec "$package_script" "${args[@]}"
}
run_build() {
local -a args=()
local build_script=""
case "$OSTYPE" in
darwin*)
build_script="$repo_root/tools/platform/build/build-macos-project.sh"
;;
msys*|cygwin*|win32*)
build_script="$repo_root/tools/platform/build/build-windows-project.sh"
;;
*)
echo "build is unsupported on this host platform: $OSTYPE" >&2
echo "use the platform-specific entrypoint for this host" >&2
exit 2
;;
esac
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
args+=("$1")
shift
;;
--build-dir|--jobs)
if [[ "$OSTYPE" == darwin* ]]; then
[[ $# -ge 2 ]] || { echo "missing value for $1" >&2; exit 2; }
args+=("$1" "$2")
shift 2
else
echo "$1 is only supported on macOS build" >&2
exit 2
fi
;;
--skip-webui-build)
if [[ "$OSTYPE" == darwin* ]]; then
args+=("$1")
shift
else
echo "$1 is only supported on macOS build" >&2
exit 2
fi
;;
--gpu|--no-gpu)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
args+=("$1")
shift
else
echo "$1 is only supported on Windows build" >&2
exit 2
fi
;;
--release)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
args+=(--configuration Release)
shift
else
echo "$1 is only supported on Windows build" >&2
exit 2
fi
;;
--shipping)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
args+=(--configuration Shipping)
shift
else
echo "$1 is only supported on Windows build" >&2
exit 2
fi
;;
--configuration)
if [[ "$OSTYPE" == msys* || "$OSTYPE" == cygwin* || "$OSTYPE" == win32* ]]; then
[[ $# -ge 2 ]] || { echo "missing value for --configuration" >&2; exit 2; }
args+=("$1" "$2")
shift 2
else
echo "$1 is only supported on Windows build" >&2
exit 2
fi
;;
*)
echo "unknown option for build: $1" >&2
exit 2
;;
esac
done
exec "$build_script" "${args[@]}"
}
run_effects() {
shift
local strict=0
local -a args=()
while [[ $# -gt 0 ]]; do
case "$1" in
--strict)
strict=1
shift
;;
*)
args+=("$1")
shift
;;
esac
done
if [[ "$strict" -eq 1 ]]; then
exec env MFX_MANUAL_REQUIRE_EXECUTION=1 \
"$repo_root/tools/platform/manual/run-macos-effects-type-parity-selfcheck.sh" "${args[@]}"
fi
exec "$repo_root/tools/platform/manual/run-macos-effects-type-parity-selfcheck.sh" "${args[@]}"
}
run_verify_effects() {
shift
local strict=0
local -a args=()
while [[ $# -gt 0 ]]; do
case "$1" in
--strict)
strict=1
shift
;;
*)
args+=("$1")
shift
;;
esac
done
if [[ "$strict" -eq 1 ]]; then
exec env \
MFX_HTTP_REQUIRE_EXECUTION=1 \
MFX_CORE_HTTP_REQUIRE_EXECUTION=1 \
MFX_MANUAL_REQUIRE_EXECUTION=1 \
"$repo_root/tools/platform/regression/run-posix-effects-regression-suite.sh" --platform auto "${args[@]}"
fi
exec "$repo_root/tools/platform/regression/run-posix-effects-regression-suite.sh" --platform auto "${args[@]}"
}
run_verify_full() {
shift
local strict=0
local -a args=()
while [[ $# -gt 0 ]]; do
case "$1" in
--strict)
strict=1
shift
;;
*)
args+=("$1")
shift
;;
esac
done
if [[ "$strict" -eq 1 ]]; then
exec env \
MFX_HTTP_REQUIRE_EXECUTION=1 \
MFX_CORE_HTTP_REQUIRE_EXECUTION=1 \
MFX_MANUAL_REQUIRE_EXECUTION=1 \
"$repo_root/tools/platform/regression/run-posix-regression-suite.sh" --platform auto "${args[@]}"
fi
exec "$repo_root/tools/platform/regression/run-posix-regression-suite.sh" --platform auto "${args[@]}"
}
if [[ $# -lt 1 ]]; then
usage
exit 1
fi
command="$1"
case "$command" in
run)
shift
run_start 0 0 "$@"
;;
run-no-build)
shift
run_start 1 1 "$@"
;;
package)
shift
run_package 0 0 "$@"
;;
build)
shift
run_build "$@"
;;
package-no-build)
shift
run_package 1 1 "$@"
;;
start)
shift
run_start 0 0 "$@"
;;
fast)
shift
run_start 1 1 "$@"
;;
bld)
shift
run_build "$@"
;;
pack)
shift
run_package 0 0 "$@"
;;
pkg)
shift
run_package 0 0 "$@"
;;
effects)
run_effects "$@"
;;
verify-effects)
run_verify_effects "$@"
;;
verify-full)
run_verify_full "$@"
;;
help|-h|--help)
usage
;;
*)
echo "unknown command: $command" >&2
usage
exit 2
;;
esac