@@ -3,10 +3,11 @@ default-tag:= "latest"
33build-wasm-examples-command := if os () == " windows" { " ./src/hyperlight_wasm/scripts/build-wasm-examples.bat" } else { " ./src/hyperlight_wasm/scripts/build-wasm-examples.sh" }
44mkdir-arg := if os () == " windows" { " -Force" } else { " -p" }
55latest-release := if os () == " windows" {" $(git tag -l --sort=v:refname | select -last 2 | select -first 1)" } else {` git tag -l --sort=v:refname | tail -n 2 | head -n 1 ` }
6+ wit-world := if os () == " windows" { " $env:WIT_WORLD=\" " + justfile_directory () + " \\ src\\ wasi_samples\\ wit\\ component-world.wasm" + " \" ;" } else { " WIT_WORLD=" + justfile_directory () + " /src/wasi_samples/wit/component-world.wasm" }
67
78set windows-shell := [" pwsh.exe" , " -NoLogo" , " -Command" ]
89
9- build-all target = default-target : (build target) (build-wasm-examples target) (build-rust-wasm-examples target) (build-wasm-runtime target)
10+ build-all target = default-target : (build target) (build-wasm-examples target) (build-rust-wasm-examples target) (build-wasm-runtime target) ( build-rust-wasi-examples target)
1011
1112build target = default-target features = " ": (build-wasm-runtime target) (fmt-check )
1213 cargo build {{ if features == " " {' ' } else if features== " no-default-features" {" --no-default-features" } else {" --no-default-features -F " + features } }} --verbose --profile={{ if target == " debug" {" dev" } else { target } }}
@@ -31,23 +32,39 @@ build-rust-wasm-examples target=default-target: (mkdir-redist target)
3132 cargo run -p hyperlight-wasm-aot compile ./ src/ rust_wasm_samples/ target/ wasm32 -unknown-unknown/ {{ target }} / rust_wasm_samples.wasm ./ x64 / {{ target }} / rust_wasm_samples.aot
3233 cp ./ x64 / {{ target }} / rust_wasm_samples.aot ./ x64 / {{ target }} / rust_wasm_samples.wasm
3334
35+ build-rust-wasi-examples target = default-target :
36+ cargo install --locked wasm-tools
37+ cargo install cargo-component --locked
38+ wasm-tools component wit ./ src/ wasi_samples/ wit/ example.wit -w -o ./ src/ wasi_samples/ wit/ component-world.wasm
39+ # use cargo component so we don't get all the wasi imports https://github.com/bytecodealliance/cargo-component?tab=readme-ov-file#relationship-with-wasm32-wasip2
40+ # we also explicitly target wasm32-unknown-unknown since cargo component might try to pull in wasi imports https://github.com/bytecodealliance/cargo-component/issues/290
41+ rustup target add wasm32 -unknown-unknown
42+ cd ./ src/ wasi_samples && cargo component build --target wasm32 -unknown-unknown --profile={{ if target == " debug" {" dev" } else { target } }}
43+ cargo run -p hyperlight-wasm-aot compile --component ./ src/ wasi_samples/ target/ wasm32 -unknown-unknown/ {{ target }} / wasi_samples.wasm ./ x64 / {{ target }} / wasi_samples.aot
44+ cp ./ x64 / {{ target }} / wasi_samples.aot ./ x64 / {{ target }} / wasi_samples.wasm
45+
3446check target = default-target :
3547 cargo check --profile={{ if target == " debug" {" dev" } else { target } }}
3648 cd src/ rust_wasm_samples && cargo check --profile={{ if target == " debug" {" dev" } else { target } }}
49+ cd src/ wasi_samples && cargo check --profile={{ if target == " debug" {" dev" } else { target } }}
3750 cd src/ wasm_runtime && cargo check --profile={{ if target == " debug" {" dev" } else { target } }}
3851
3952fmt-check :
4053 rustup toolchain install nightly -c rustfmt && cargo + nightly fmt -v --all -- --check
4154 cd src/ rust_wasm_samples && rustup toolchain install nightly -c rustfmt && cargo + nightly fmt -v --all -- --check
55+ cd src/ wasi_samples && rustup toolchain install nightly -c rustfmt && cargo + nightly fmt -v --all -- --check
4256 cd src/ wasm_runtime && rustup toolchain install nightly -c rustfmt && cargo + nightly fmt -v --all -- --check
43- fmt :
57+ fmt :
58+ rustup toolchain install nightly -c rustfmt
4459 cargo + nightly fmt --all
4560 cd src/ rust_wasm_samples && cargo + nightly fmt
61+ cd src/ wasi_samples && cargo + nightly fmt
4662 cd src/ wasm_runtime && cargo + nightly fmt
4763
4864clippy target = default-target : (check target)
4965 cargo clippy --profile={{ if target == " debug" {" dev" } else { target } }} --all-targets --all-features -- -D warnings
5066 cd src/ rust_wasm_samples && cargo clippy --profile={{ if target == " debug" {" dev" } else { target } }} --all-targets --all-features -- -D warnings
67+ cd src/ wasi_samples && cargo clippy --profile={{ if target == " debug" {" dev" } else { target } }} --all-targets --all-features -- -D warnings
5168 cd src/ wasm_runtime && cargo clippy --profile={{ if target == " debug" {" dev" } else { target } }} --all-targets --all-features -- -D warnings
5269
5370# TESTING
@@ -71,6 +88,9 @@ examples-ci target=default-target features="": (build-rust-wasm-examples target)
7188 cargo run {{ if features == " " {' ' } else {" --no-default-features -F function_call_metrics," + features } }} --profile={{ if target == " debug" {" dev" } else { target } }} --example metrics
7289 cargo run {{ if features == " " {" --no-default-features --features kvm,mshv2" } else {" --no-default-features -F function_call_metrics," + features } }} --profile={{ if target == " debug" {" dev" } else { target } }} --example metrics
7390
91+ examples-wasi target = default-target features = " ": (build-rust-wasi-examples target)
92+ {{ wit-world }} cargo run {{ if features == " " {' ' } else {" --no-default-features -F " + features } }} --profile={{ if target == " debug" {" dev" } else { target } }} --example wasi_examples
93+
7494# warning, compares to and then OVERWRITES the given baseline
7595bench-ci baseline target = default-target features = " ":
7696 cd src/ hyperlight_wasm && cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} -- --verbose --save-baseline {{ baseline}}
0 commit comments