1+ set windows-shell := [" pwsh" , " -NoLogo" , " -Command" ]
12default-target := " debug"
2- repo-root := replace (invocation_directory (), " \\ " , " /" )
3- wit-world := " WIT_WORLD=" + repo-root + " /src/wasm_sandbox/wit/sandbox-world.wasm"
3+ repo-root := invocation_directory_native ()
44
5- build target = default-target :
5+ # If cargo fingerprints exist but the runtime binary is missing, clean stale state
6+ # to force hyperlight-js's build script to re-run. This can happen when rust-cache
7+ # restores partial artifacts.
8+ [unix ]
9+ _ clean-stale :
610 #!/usr/bin/env bash
7- # If cargo fingerprints exist but the runtime binary is missing, clean stale state
8- # to force hyperlight-js's build script to re-run. This can happen when rust-cache
9- # restores partial artifacts.
1011 for profile in debug release; do
1112 if compgen -G " {{ repo-root}} /target/$profile/build/hyperlight-js-*" > / dev/ null && \
1213 [ ! -f " {{ repo-root}} /target/hyperlight-js-runtime/x86_64-hyperlight-none/$profile/hyperlight-js-runtime" ]; then
@@ -16,19 +17,38 @@ build target=default-target:
1617 {{ repo-root}} / target/ $profile/ .fingerprint/ hyperlight-js-*
1718 fi
1819 done
19- {{ wit-world }} cargo build --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }}
20+
21+ [windows ]
22+ _ clean-stale :
23+ foreach ($profile in @(' debug' , ' release' )) { \
24+ $bp = ' {{ repo-root}} /target/' + $profile + ' /build' ; \
25+ $rp = ' {{ repo-root}} /target/hyperlight-js-runtime/x86_64-hyperlight-none/' + $profile + ' /hyperlight-js-runtime' ; \
26+ if ((Get-ChildItem -Path $bp -Filter ' hyperlight-js-*' -ErrorAction SilentlyContinue) -and \
27+ -not (Test-Path $rp)) { \
28+ Write-Host (' Cleaning stale hyperlight-js ' + $profile + ' build artifacts...' ); \
29+ Remove-Item -Recurse -Force ' {{ repo-root}} /target/hyperlight-js-runtime' -ErrorAction SilentlyContinue; \
30+ Get-ChildItem -Path $bp -Filter ' hyperlight-js-*' | Remove-Item -Recurse -Force; \
31+ $fp = ' {{ repo-root}} /target/' + $profile + ' /.fingerprint' ; \
32+ if (Test-Path $fp) { \
33+ Get-ChildItem -Path $fp -Filter ' hyperlight-js-*' | Remove-Item -Recurse -Force \
34+ } \
35+ } \
36+ }
37+
38+ build target = default-target : _clean-stale
39+ cargo build --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }}
2040
2141#### EXAMPLES ####
2242
2343examples target = default-target :
24- {{ wit-world }} cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example basics
25- {{ wit-world }} cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example network_demo
26- {{ wit-world }} cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example filesystem_demo
44+ cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example basics
45+ cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example network_demo
46+ cargo run --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }} --example filesystem_demo
2747
2848#### TESTS ####
2949
3050lint :
31- {{ wit-world }} cargo clippy -p hyperlight-javascript-sandbox --all-targets -- -D warnings
51+ cargo clippy -p hyperlight-javascript-sandbox --all-targets -- -D warnings
3252
3353test :
34- {{ wit-world }} cargo test -p hyperlight-javascript-sandbox
54+ cargo test -p hyperlight-javascript-sandbox
0 commit comments