Skip to content

Commit e9b6331

Browse files
committed
only invalidate if missing
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 24bc034 commit e9b6331

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

src/javascript_sandbox/Justfile

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,34 @@ rmrf := if os() == "windows" { "Remove-Item -Recurse -Force -ErrorAction Silentl
66
# Only clean when rust-cache left stale state (fingerprints exist but runtime binary missing).
77
[unix]
88
_clean-stale:
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
9+
#!/usr/bin/env bash
10+
for profile in debug release; do
11+
if compgen -G "{{repo-root}}/target/$profile/build/hyperlight-js-*" > /dev/null && \
12+
[ ! -f "{{repo-root}}/target/hyperlight-js-runtime/x86_64-hyperlight-none/$profile/hyperlight-js-runtime" ]; then
13+
echo "Cleaning stale hyperlight-js $profile build artifacts..."
14+
rm -rf {{repo-root}}/target/hyperlight-js-runtime {{repo-root}}/target/hls \
15+
{{repo-root}}/target/$profile/build/hyperlight-js-* {{repo-root}}/target/$profile/.fingerprint/hyperlight-js-* \
16+
{{repo-root}}/target/$profile/build/hyperlight-host-* {{repo-root}}/target/$profile/.fingerprint/hyperlight-host-*
17+
fi
18+
done
1619
1720
[windows]
1821
_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; \
22+
foreach ($profile in @('debug', 'release')) { \
23+
$bp = '{{repo-root}}/target/' + $profile + '/build'; \
24+
$rp = '{{repo-root}}/target/hyperlight-js-runtime/x86_64-hyperlight-none/' + $profile + '/hyperlight-js-runtime'; \
25+
if ((Get-ChildItem -Path $bp -Filter 'hyperlight-js-*' -ErrorAction SilentlyContinue) -and \
26+
-not (Test-Path $rp)) { \
27+
Write-Host ('Cleaning stale hyperlight-js ' + $profile + ' build artifacts...'); \
28+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue '{{repo-root}}/target/hyperlight-js-runtime','{{repo-root}}/target/hls'; \
29+
Get-ChildItem -Path $bp -Filter 'hyperlight-js-*' | Remove-Item -Recurse -Force; \
30+
Get-ChildItem -Path $bp -Filter 'hyperlight-host-*' -ErrorAction SilentlyContinue | 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+
Get-ChildItem -Path $fp -Filter 'hyperlight-host-*' -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force; \
35+
} \
36+
} \
2637
}
2738

2839
build target=default-target: _clean-stale

0 commit comments

Comments
 (0)