Skip to content

Commit

Permalink
Merge pull request #47 from dtolnay/rustcwrapper
Browse files Browse the repository at this point in the history
Apply RUSTC_WRAPPER
  • Loading branch information
dtolnay authored Apr 6, 2024
2 parents df7e51d + 51f46e2 commit 0fa74f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ mod rustc;
use std::env;
use std::ffi::OsString;
use std::fs;
use std::iter;
use std::path::Path;
use std::process::{self, Command};

fn main() {
println!("cargo:rerun-if-changed=build/build.rs");

let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
let wrapped_rustc = rustc_wrapper.iter().chain(iter::once(&rustc));

let mut is_clippy_driver = false;
let version = loop {
let mut command = Command::new(&rustc);
let mut wrapped_rustc = wrapped_rustc.clone();
let mut command = Command::new(wrapped_rustc.next().unwrap());
command.args(wrapped_rustc);
if is_clippy_driver {
command.arg("--rustc");
}
Expand Down

0 comments on commit 0fa74f5

Please sign in to comment.