Skip to content

Commit cf3c408

Browse files
committed
Update to use the new hyperlight cargo lib
Signed-off-by: James Sturtevant <[email protected]>
1 parent a302ea2 commit cf3c408

File tree

6 files changed

+104
-24
lines changed

6 files changed

+104
-24
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ jobs:
3838
with:
3939
rust-toolchain: "1.89"
4040

41-
- name: Build Wasm Runtime Binary
42-
working-directory: ./src/hyperlight_wasm
43-
run: |
44-
just ensure-tools
45-
just build-wasm-runtime ${{ matrix.config }}
46-
4741
- uses: dtolnay/[email protected]
4842
with:
4943
components: clippy, rustfmt

.github/workflows/dep_rust.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ jobs:
6767
if: runner.os == 'Windows'
6868
run: rustup component add --toolchain nightly-x86_64-pc-windows-msvc rustfmt
6969

70-
- name: Build Wasm Runtime Binary
71-
working-directory: ./src/hyperlight_wasm
72-
run: |
73-
just ensure-tools
74-
just build-wasm-runtime ${{ matrix.config }}
75-
7670
- name: Download Wasm Modules
7771
uses: actions/download-artifact@v5
7872
with:
@@ -83,6 +77,7 @@ jobs:
8377
run: |
8478
# this must be build before the formatting and other jobs run
8579
# because the component model example depends on the wasm component built here
80+
just ensure-tools
8681
just compile-wit
8782
just build-rust-component-examples ${{ matrix.config }}
8883

Cargo.lock

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Justfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ensure-tools:
2020
cargo install wit-bindgen-cli --locked --version 0.43.0
2121
cargo install cargo-hyperlight --locked --version 0.1.4
2222

23-
build-all target=default-target features="": (build target features) (build-examples target features) (build-wasm-runtime target features)
23+
build-all target=default-target features="": (build target features) (build-examples target features)
2424

2525
build target=default-target features="": (fmt-check)
2626
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 } }}
@@ -33,9 +33,6 @@ compile-wit:
3333
wasm-tools component wit ./src/wasmsamples/components/runcomponent.wit -w -o ./src/wasmsamples/components/runcomponent-world.wasm
3434
wasm-tools component wit ./src/component_sample/wit/example.wit -w -o ./src/component_sample/wit/component-world.wasm
3535

36-
build-wasm-runtime target=default-target features="":
37-
cd ./src/wasm_runtime && cargo hyperlight build --verbose {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--features " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} && rm -R target
38-
3936
build-examples target=default-target features="": (build-wasm-examples target features) (build-rust-wasm-examples target features) (build-rust-component-examples target features)
4037

4138
build-wasm-examples target=default-target features="": (compile-wit)

src/hyperlight_wasm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ built = { version = "0.8.0", features = ["chrono", "git2"] }
101101
anyhow = { version = "1.0" }
102102
goblin = "0.10.4"
103103
tar = "0.4.44"
104+
cargo-hyperlight = "0.1.4"
104105

105106
[target.'cfg(windows)'.build-dependencies]
106107
junction = "1"

src/hyperlight_wasm/build.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ fn get_wasm_runtime_path() -> PathBuf {
9090
}
9191

9292
fn build_wasm_runtime() -> PathBuf {
93-
let cargo_bin = env::var_os("CARGO").unwrap();
9493
let profile = env::var_os("PROFILE").unwrap();
9594
let out_dir = env::var_os("OUT_DIR").unwrap();
9695

@@ -113,9 +112,8 @@ fn build_wasm_runtime() -> PathBuf {
113112
let mut env_vars = env::vars().collect::<Vec<_>>();
114113
env_vars.retain(|(key, _)| !key.starts_with("CARGO_"));
115114

116-
let mut cargo_cmd = std::process::Command::new(&cargo_bin);
115+
let mut cargo_cmd = cargo_hyperlight::cargo().unwrap();
117116
let mut cmd = cargo_cmd
118-
.arg("hyperlight")
119117
.arg("build")
120118
.arg("--target-dir")
121119
.arg(&target_dir)
@@ -136,12 +134,9 @@ fn build_wasm_runtime() -> PathBuf {
136134
cmd = cmd.arg("--features").arg("trace_guest");
137135
}
138136

139-
let status = cmd
140-
.status()
137+
cmd.status()
141138
.unwrap_or_else(|e| panic!("could not run cargo build wasm_runtime: {}", e));
142-
if !status.success() {
143-
panic!("could not compile wasm_runtime");
144-
}
139+
145140
let resource = target_dir
146141
.join("x86_64-hyperlight-none")
147142
.join(profile)

0 commit comments

Comments
 (0)