diff --git a/Cargo.lock b/Cargo.lock index d1dad73..7cf3ee4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -833,7 +833,7 @@ checksum = "6c89eaf493b3dfc730cda42a77014aad65e03213992c7afe0dff60a9f7d3dd94" [[package]] name = "rustc_codegen_spirv-types" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5504c4441a84edcc27f4eca61de6fc8cf" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850#3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850" dependencies = [ "rspirv", "serde", @@ -983,10 +983,11 @@ dependencies = [ [[package]] name = "spirv-builder" version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5504c4441a84edcc27f4eca61de6fc8cf" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850#3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850" dependencies = [ "cargo_metadata", "clap", + "log", "memchr", "notify", "raw-string", diff --git a/Cargo.toml b/Cargo.toml index 6ef4f03..02b1ead 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ exclude = [ resolver = "2" [workspace.dependencies] -spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "e6d017d5504c4441a84edcc27f4eca61de6fc8cf", default-features = false } +spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850", default-features = false } anyhow = "1.0.94" clap = { version = "4.5.37", features = ["derive"] } crossterm = "0.28.1" diff --git a/crates/cargo-gpu/src/install.rs b/crates/cargo-gpu/src/install.rs index 48e1ab8..cfbfdfb 100644 --- a/crates/cargo-gpu/src/install.rs +++ b/crates/cargo-gpu/src/install.rs @@ -7,7 +7,6 @@ use crate::target_specs::update_target_specs_files; use crate::{cache_dir, spirv_source::SpirvSource}; use anyhow::Context as _; use spirv_builder::SpirvBuilder; -use std::env; use std::path::{Path, PathBuf}; /// Represents a functional backend installation, whether it was cached or just installed. @@ -279,8 +278,8 @@ package = "rustc_codegen_spirv" .context("remove Cargo.lock")?; } - crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source,); - let mut cargo = std::process::Command::new("cargo"); + crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source); + let mut cargo = spirv_builder::cargo_cmd::CargoCmd::new(); cargo .current_dir(&install_dir) .arg(format!("+{toolchain_channel}")) @@ -289,23 +288,7 @@ package = "rustc_codegen_spirv" cargo.args(["-p", "rustc_codegen_spirv", "--lib"]); } - // Clear Cargo environment variables that we don't want to leak into the - // inner invocation of Cargo and mess with our `rustc_codegen_spirv` build. - for (key, _) in env::vars_os() { - let remove = key.to_str().is_some_and(|st| { - st.starts_with("CARGO_FEATURES_") || st.starts_with("CARGO_CFG_") - }); - if remove { - cargo.env_remove(key); - } - } - cargo - .env_remove("RUSTC") - .env_remove("RUSTFLAGS") - // ignore any externally supplied target dir, we want to build it in our cache dir - .env_remove("CARGO_TARGET_DIR"); - - log::debug!("building artifacts with `{cargo:?}`"); + log::debug!("building artifacts with `{cargo}`"); cargo .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit())