diff --git a/engine/names/extract/build.rs b/engine/names/extract/build.rs index e9482ce69..00400f27b 100644 --- a/engine/names/extract/build.rs +++ b/engine/names/extract/build.rs @@ -123,7 +123,8 @@ fn target_dir(suffix: &str) -> camino::Utf8PathBuf { } fn get_json() -> String { - let mut cmd = Command::new("cargo-hax"); + let mut cmd = + Command::new(std::env::var("HAX_CARGO_COMMAND_PATH").unwrap_or("cargo-hax".to_string())); cmd.args([ "hax", "-C", diff --git a/test-harness/src/command_hax_ext.rs b/test-harness/src/command_hax_ext.rs index ff404a25f..ff830bc8c 100644 --- a/test-harness/src/command_hax_ext.rs +++ b/test-harness/src/command_hax_ext.rs @@ -33,9 +33,23 @@ impl CommandHaxExt for Command { let root = std::env::current_dir().unwrap(); let root = root.parent().unwrap(); let engine_dir = root.join("engine"); - // Make sure binaries are built + // Make sure binaries are built. Note this doesn't + // include `hax-engine-names-extract`: its build + // script requires the driver and CLI of `hax` to be + // available. assert!(Command::new("cargo") - .args(&["build", "--workspace", "--bins"]) + .args(&["build", "--bins"]) + .status() + .unwrap() + .success()); + let cargo_hax = cargo_bin(CARGO_HAX); + let driver = cargo_bin("driver-hax-frontend-exporter"); + // Now the driver & CLI are installed, call `cargo + // build` injecting their paths + assert!(Command::new("cargo") + .args(&["build", "--workspace", "--bin", "hax-engine-names-extract"]) + .env("HAX_CARGO_COMMAND_PATH", &cargo_hax) + .env("HAX_RUSTC_DRIVER_BINARY", &driver) .status() .unwrap() .success()); @@ -49,8 +63,8 @@ impl CommandHaxExt for Command { .unwrap() .success()); Some(Paths { - driver: cargo_bin("driver-hax-frontend-exporter"), - cargo_hax: cargo_bin(CARGO_HAX), + driver, + cargo_hax, engine: engine_dir.join("_build/install/default/bin/hax-engine"), }) };