@@ -4,6 +4,7 @@ build-wasm-examples-command := if os() == "windows" { "./src/hyperlight_wasm/scr
4
4
mkdir-arg := if os () == " windows" { " -Force" } else { " -p" }
5
5
latest-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
6
wit-world := if os () == " windows" { " $env:WIT_WORLD=\" " + justfile_directory () + " \\ src\\ component_sample\\ wit\\ component-world.wasm" + " \" ;" } else { " WIT_WORLD=" + justfile_directory () + " /src/component_sample/wit/component-world.wasm" }
7
+ wit-world-c := if os () == " windows" { " $env:WIT_WORLD=\" " + justfile_directory () + " \\ src\\ wasmsamples\\ components\\ runcomponent-world.wasm" + " \" ;" } else { " WIT_WORLD=" + justfile_directory () + " /src/wasmsamples/components/runcomponent-world.wasm" }
7
8
8
9
set windows-shell := [" pwsh.exe" , " -NoLogo" , " -Command" ]
9
10
@@ -14,8 +15,9 @@ make-vendor-tar:
14
15
- C ./ src wasm_runtime hyperlight_wasm_macro
15
16
16
17
ensure-tools :
17
- cargo install --locked wasm-tools --version 1.235.0
18
+ cargo install wasm-tools --locked --version 1.235.0
18
19
cargo install cargo-component --locked --version 0.21.1
20
+ cargo install wit-bindgen-cli --locked --version 0.43.0
19
21
20
22
build-all target = default-target : (build target) (build-wasm-examples target) (build-rust-wasm-examples target) (build-wasm-runtime target) (build-rust-component-examples target)
21
23
@@ -26,10 +28,14 @@ mkdir-redist target=default-target:
26
28
mkdir {{ mkdir-arg }} x64
27
29
mkdir {{ mkdir-arg }} x64 / {{ target }}
28
30
31
+ compile-wit :
32
+ wasm-tools component wit ./ src/ wasmsamples/ components/ runcomponent.wit -w -o ./ src/ wasmsamples/ components/ runcomponent-world.wasm
33
+ wasm-tools component wit ./ src/ component_sample/ wit/ example.wit -w -o ./ src/ component_sample/ wit/ component-world.wasm
34
+
29
35
build-wasm-runtime target = default-target :
30
36
cd ./ src/ wasm_runtime && cargo build --verbose --profile={{ if target == " debug" {" dev" } else { target } }} && rm -R target
31
37
32
- build-wasm-examples target = default-target :
38
+ build-wasm-examples target = default-target : ( compile-wit )
33
39
{{ build-wasm-examples-command }} {{ target}}
34
40
35
41
build-rust-wasm-examples target = default-target : (mkdir-redist target)
@@ -38,8 +44,7 @@ build-rust-wasm-examples target=default-target: (mkdir-redist target)
38
44
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
39
45
cp ./ x64 / {{ target }} / rust_wasm_samples.aot ./ x64 / {{ target }} / rust_wasm_samples.wasm
40
46
41
- build-rust-component-examples target = default-target :
42
- wasm-tools component wit ./ src/ component_sample/ wit/ example.wit -w -o ./ src/ component_sample/ wit/ component-world.wasm
47
+ build-rust-component-examples target = default-target : (compile-wit )
43
48
# 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
44
49
# 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
45
50
rustup target add wasm32 -unknown-unknown
@@ -101,10 +106,14 @@ examples-components target=default-target features="": (build-rust-component-exa
101
106
{{ wit-world }} cargo run {{ if features == " " {' ' } else {" --no-default-features -F " + features } }} --profile={{ if target == " debug" {" dev" } else { target } }} --example component_example
102
107
103
108
# warning, compares to and then OVERWRITES the given baseline
104
- bench-ci baseline target = default-target features = " ":
105
- cd src/ hyperlight_wasm && cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} -- --verbose --save-baseline {{ baseline}}
106
- bench target = default-target features = " ":
107
- cd src/ hyperlight_wasm && cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} -- --verbose
109
+ bench-ci baseline target = " release" features = " ":
110
+ cd src/ hyperlight_wasm && cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} --bench benchmarks -- --verbose --save-baseline {{ baseline}}
111
+ cd src/ hyperlight_wasm; {{ wit-world-c}} cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} --bench benchmarks_components -- --verbose --save-baseline {{ baseline}} -components
112
+ bench target = " release" features = " ": (bench-wasm target features) (bench-components target features)
113
+ bench-wasm target = " release" features = " ":
114
+ cd src/ hyperlight_wasm && cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} --bench benchmarks -- --verbose
115
+ bench-components target = " release" features = " ":
116
+ cd src/ hyperlight_wasm; {{ wit-world-c}} cargo bench --profile={{ if target == " debug" {" dev" } else { target } }} {{ if features == " " {' ' } else { " --features " + features } }} --bench benchmarks_components -- --verbose
108
117
bench-download os hypervisor cpu tag = " ":
109
118
gh release download {{ tag }} -D ./ src/ hyperlight_wasm/ target/ -p benchmarks_{{ os }} _{{ hypervisor }} _{{ cpu }} .tar.gz
110
119
mkdir {{ mkdir-arg }} ./ src/ hyperlight_wasm/ target/ criterion
0 commit comments