-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathjustfile
More file actions
96 lines (77 loc) · 3 KB
/
justfile
File metadata and controls
96 lines (77 loc) · 3 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
ncpus := num_cpus()
justdir := justfile_directory()
mode := 'debug'
builddir := justdir / 'cmake-build-' + mode
reconfigure := 'false'
alias b := build
alias t := test
alias w := wpt-test
alias c := componentize
alias fmt := format
# List all recipes
default:
@echo 'Default mode {{ mode }}'
@echo 'Default build directory {{ builddir }}'
@just --list
# Build specified target or all otherwise
build target="all" *flags:
#!/usr/bin/env bash
set -euo pipefail
echo 'Setting build directory to {{ builddir }}, build type {{ if mode == "weval" { "Release (weval)" } else { capitalize(mode) } }}'
# Only run configure step if build directory doesn't exist yet
if ! {{ path_exists(builddir) }} || {{ reconfigure }} = 'true'; then
cmake -S . -B {{ builddir }} {{ flags }} \
-DCMAKE_BUILD_TYPE={{ if mode == "weval" { "Release" } else { capitalize(mode) } }} \
{{ if mode == "weval" { "-DUSE_WASM_OPT=OFF -DWEVAL=ON" } else { "" } }}
else
echo 'build directory already exists, skipping cmake configure'
fi
# Build target
cmake --build {{ builddir }} --parallel {{ ncpus }} {{ if target == "" { "" } else { "--target " + target } }}
# Run clean target
clean:
cmake --build {{ builddir }} --target clean
[private]
[confirm('proceed?')]
do_clean:
rm -rf {{ builddir }}
# Remove build directory
clean-all: && do_clean
@echo "This will remove {{builddir}}"
# Run clang-tidy
lint: (build "clang-tidy")
# Run clang-tidy and apply offered fixes
lint-fix: (build "clang-tidy-fix")
# Componentize js script
componentize script="" outfile="starling.wasm": build
{{ builddir }}/componentize.sh {{ script }} -o {{ outfile }}
# Componentize and serve script with wasmtime
serve script: (componentize script)
wasmtime serve -S common starling.wasm
# Format code using clang-format. Use --fix to fix files inplace
format *ARGS:
{{ justdir }}/scripts/clang-format.sh {{ ARGS }}
# Run integration test
test regex="": (build "integration-test-server") (build "wpt-runtime")
ctest --test-dir {{ builddir }} -j {{ ncpus }} --output-on-failure {{ if regex == "" { regex } else { "-R " + regex } }}
# Run web platform test suite
[group('wpt')]
wpt-test filter="": (build "wpt-runtime")
WPT_FILTER={{ filter }} ctest --test-dir {{ builddir }} -R wpt --verbose
# Update web platform test expectations
[group('wpt')]
wpt-update filter="": (build "wpt-runtime")
WPT_FLAGS="--update-expectations" WPT_FILTER={{ filter }} ctest --test-dir {{ builddir }} -R wpt --verbose
# Run wpt server
[group('wpt')]
wpt-server: (build "wpt-runtime")
#!/usr/bin/env bash
set -euo pipefail
cd {{ builddir }}
wpt_root=$(grep '^CPM_PACKAGE_wpt-suite_SOURCE_DIR:INTERNAL=' CMakeCache.txt | cut -d'=' -f2-)
echo "Using wpt-suite at ${wpt_root}"
WASMTIME_BACKTRACE_DETAILS= node {{ justdir }}/tests/wpt-harness/run-wpt.mjs --wpt-root=${wpt_root} -vv --interactive
# Prepare WPT hosts
[group('wpt')]
wpt-setup:
cat deps/wpt-hosts | sudo tee -a /etc/hosts