|
| 1 | +TARGET_DIR := justfile_directory() + "/target" |
| 2 | +BIN_DIR := TARGET_DIR + "/bin" |
| 3 | + |
| 4 | +default: run |
1 | 5 |
|
2 | 6 | install-wkg: |
3 | | - #!/bin/bash |
4 | | - set -euox pipefail |
5 | | - if ! [[ -f {{ justfile_directory() }}/target/bin/wkg ]]; then |
6 | | - cargo install wkg \ |
7 | | - --root {{ justfile_directory() }}/target |
8 | | - fi |
| 7 | + ! test -f {{ BIN_DIR }}/wkg || \ |
| 8 | + cargo install wkg \ |
| 9 | + --root {{ TARGET_DIR }} |
9 | 10 |
|
10 | 11 | get-component: install-wkg |
11 | | - #!/bin/bash |
12 | | - set -euox pipefail |
13 | | - if ! [[ -f sample_wasi_http_rust.wasm ]]; then |
14 | | - {{ justfile_directory() }}/target/bin/wkg oci pull \ |
15 | | - ghcr.io/bytecodealliance/sample-wasi-http-rust/sample-wasi-http-rust:latest \ |
16 | | - -o sample_wasi_http_rust.wasm |
17 | | - fi |
| 12 | + ! test -f sample_wasi_http_rust.wasm || \ |
| 13 | + {{ BIN_DIR }}/wkg oci pull \ |
| 14 | + ghcr.io/bytecodealliance/sample-wasi-http-rust/sample-wasi-http-rust:latest \ |
| 15 | + -o sample_wasi_http_rust.wasm |
18 | 16 |
|
19 | 17 | install-hyperlight-wasm-aot: |
20 | | - #!/bin/bash |
21 | | - set -euox pipefail |
22 | | - if ! [[ -f {{ justfile_directory() }}/target/bin/hyperlight-wasm-aot ]]; then |
23 | | - cargo install hyperlight-wasm-aot \ |
24 | | - --git https://github.com/jprendes/hyperlight-wasm.git \ |
25 | | - --rev 134d8fc355ef842ace918777a758349342241c9d \ |
26 | | - --root {{ justfile_directory() }}/target |
27 | | - fi |
| 18 | + ! test -f {{ BIN_DIR }}/hyperlight-wasm-aot || \ |
| 19 | + cargo install hyperlight-wasm-aot \ |
| 20 | + --git https://github.com/jprendes/hyperlight-wasm.git \ |
| 21 | + --rev 134d8fc355ef842ace918777a758349342241c9d \ |
| 22 | + --root {{ TARGET_DIR }} |
28 | 23 |
|
29 | 24 | aot-component: get-component install-hyperlight-wasm-aot |
30 | | - #!/bin/bash |
31 | | - set -euox pipefail |
32 | | - {{ justfile_directory() }}/target/bin/hyperlight-wasm-aot compile --component sample_wasi_http_rust.wasm sample_wasi_http_rust.bin |
| 25 | + {{ BIN_DIR }}/hyperlight-wasm-aot compile --component sample_wasi_http_rust.wasm sample_wasi_http_rust.bin |
33 | 26 |
|
34 | 27 | install-wasm-tools: |
35 | | - #!/bin/bash |
36 | | - set -euox pipefail |
37 | | - if ! [[ -f {{ justfile_directory() }}/target/bin/wasm-tools ]]; then |
38 | | - cargo install wasm-tools \ |
39 | | - --root {{ justfile_directory() }}/target |
40 | | - fi |
| 28 | + ! test -f {{ BIN_DIR }}/wasm-tools || \ |
| 29 | + cargo install wasm-tools \ |
| 30 | + --root {{ TARGET_DIR }} |
41 | 31 |
|
42 | 32 | make-wit-world: install-wasm-tools |
43 | | - #!/bin/bash |
44 | | - set -euox pipefail |
45 | | - if ! [[ -f hyperlight-world.wasm ]]; then |
46 | | - {{ justfile_directory() }}/target/bin/wasm-tools component wit hyperlight.wit -w -o hyperlight-world.wasm |
47 | | - fi |
| 33 | + ! test -f hyperlight-world.wasm || \ |
| 34 | + {{ BIN_DIR }}/wasm-tools component wit hyperlight.wit -w -o hyperlight-world.wasm |
48 | 35 |
|
49 | 36 | build: make-wit-world |
50 | | - #!/bin/bash |
51 | | - set -euox pipefail |
52 | | - export WIT_WORLD={{ justfile_directory() }}/hyperlight-world.wasm |
53 | 37 | cargo build |
54 | 38 |
|
55 | 39 | run: build aot-component |
56 | | - #!/bin/bash |
57 | | - set -euox pipefail |
58 | | - export WIT_WORLD={{ justfile_directory() }}/hyperlight-world.wasm |
59 | 40 | cargo run -- sample_wasi_http_rust.bin |
0 commit comments