|
1 | 1 | set windows-shell := ["pwsh", "-NoLogo", "-Command"] |
2 | 2 | default-target := "debug" |
3 | 3 | repo-root := invocation_directory_native() |
| 4 | +rmrf := if os() == "windows" { "Remove-Item -Recurse -Force -ErrorAction SilentlyContinue" } else { "rm -rf" } |
4 | 5 |
|
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] |
| 6 | +# Clean stale hyperlight-js build artifacts (e.g. rust-cache restores |
| 7 | +# fingerprints but not the runtime binary). |
9 | 8 | _clean-stale: |
10 | | - #!/usr/bin/env bash |
11 | | - for profile in debug release; do |
12 | | - if compgen -G "{{repo-root}}/target/$profile/build/hyperlight-js-*" > /dev/null && \ |
13 | | - [ ! -f "{{repo-root}}/target/hyperlight-js-runtime/x86_64-hyperlight-none/$profile/hyperlight-js-runtime" ]; then |
14 | | - echo "Cleaning stale hyperlight-js $profile build artifacts..." |
15 | | - rm -rf {{repo-root}}/target/hyperlight-js-runtime \ |
16 | | - {{repo-root}}/target/$profile/build/hyperlight-js-* \ |
17 | | - {{repo-root}}/target/$profile/.fingerprint/hyperlight-js-* |
18 | | - fi |
19 | | - done |
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 | | - } |
| 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-* |
37 | 14 |
|
38 | 15 | build target=default-target: _clean-stale |
39 | 16 | cargo build --manifest-path {{repo-root}}/src/javascript_sandbox/Cargo.toml --profile={{ if target == "debug" {"dev"} else { target } }} |
|
0 commit comments