@@ -3,14 +3,27 @@ default-target := "debug"
33repo-root := invocation_directory_native ()
44rmrf := if os () == " windows" { " Remove-Item -Recurse -Force -ErrorAction SilentlyContinue" } else { " rm -rf" }
55
6- # Clean stale hyperlight-js build artifacts (e.g. rust-cache restores
7- # fingerprints but not the runtime binary).
6+ # Only clean when rust-cache left stale state (fingerprints exist but runtime binary missing).
7+ [ unix ]
88_ clean-stale :
9- - {{ rmrf}} {{ repo-root}} / target/ hyperlight-js-runtime
10- - {{ rmrf}} {{ repo-root}} / target/ debug/ build/ hyperlight-js-*
11- - {{ rmrf}} {{ repo-root}} / target/ debug/ .fingerprint/ hyperlight-js-*
12- - {{ rmrf}} {{ repo-root}} / target/ release/ build/ hyperlight-js-*
13- - {{ rmrf}} {{ repo-root}} / target/ release/ .fingerprint/ hyperlight-js-*
9+ @ if compgen -G " {{ repo-root}} /target/*/build/hyperlight-js-*" > / dev/ null 2 >&1 && \
10+ ! ls {{ repo-root}} / target/ hyperlight-js-runtime/ x86 _64 -hyperlight-none/ */ hyperlight-js-runtime > / dev/ null 2 >&1 ; then \
11+ echo " Cleaning stale hyperlight-js build artifacts..." ; \
12+ rm -rf {{ repo-root}} / target/ hyperlight-js-runtime {{ repo-root}} / target/ hls \
13+ {{ repo-root}} / target/ */ build/ hyperlight-js-* {{ repo-root}} / target/ */ .fingerprint/ hyperlight-js-* \
14+ {{ repo-root}} / target/ */ build/ hyperlight-host-* {{ repo-root}} / target/ */ .fingerprint/ hyperlight-host-*; \
15+ fi
16+
17+ [windows ]
18+ _ clean-stale :
19+ $found = (Get-ChildItem -Path ' {{ repo-root}} /target/*/build' -Filter ' hyperlight-js-*' -ErrorAction SilentlyContinue); \
20+ $missing = -not (Get-ChildItem -Path ' {{ repo-root}} /target/hyperlight-js-runtime/x86_64-hyperlight-none/*/hyperlight-js-runtime' -ErrorAction SilentlyContinue); \
21+ if ($found -and $missing) { \
22+ Write-Host ' Cleaning stale hyperlight-js build artifacts...' ; \
23+ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue ' {{ repo-root}} /target/hyperlight-js-runtime' ,' {{ repo-root}} /target/hls' ; \
24+ Get-ChildItem -Path ' {{ repo-root}} /target/*/build' ,' {{ repo-root}} /target/*/.fingerprint' -Filter ' hyperlight-js-*' -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force; \
25+ Get-ChildItem -Path ' {{ repo-root}} /target/*/build' ,' {{ repo-root}} /target/*/.fingerprint' -Filter ' hyperlight-host-*' -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force; \
26+ }
1427
1528build target = default-target : _clean-stale
1629 cargo build --manifest-path {{ repo-root}} / src/ javascript_sandbox/ Cargo.toml --profile={{ if target == " debug" {" dev" } else { target } }}
0 commit comments