Skip to content

Commit

Permalink
Merge pull request #447 from dtolnay/workspacewrapper
Browse files Browse the repository at this point in the history
Apply RUSTC_WORKSPACE_WRAPPER
  • Loading branch information
dtolnay committed Mar 26, 2024
2 parents 48ae580 + 2de85f1 commit 04a432e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions build.rs
Expand Up @@ -36,6 +36,7 @@

use std::env;
use std::ffi::OsString;
use std::iter;
use std::path::Path;
use std::process::{self, Command, Stdio};
use std::str;
Expand Down Expand Up @@ -138,15 +139,15 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
let out_dir = cargo_env_var("OUT_DIR");
let probefile = Path::new("build").join("probe.rs");

// Make sure to pick up Cargo rustc configuration.
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
let mut cmd = Command::new(wrapper);
// The wrapper's first argument is supposed to be the path to rustc.
cmd.arg(rustc);
cmd
} else {
Command::new(rustc)
};
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
let rustc_workspace_wrapper =
env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
let mut rustc = rustc_wrapper
.into_iter()
.chain(rustc_workspace_wrapper)
.chain(iter::once(rustc));
let mut cmd = Command::new(rustc.next().unwrap());
cmd.args(rustc);

if !rustc_bootstrap {
cmd.env_remove("RUSTC_BOOTSTRAP");
Expand Down

0 comments on commit 04a432e

Please sign in to comment.