Skip to content

Commit

Permalink
avoid rebuilding bootstrap when PATH changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 27, 2022
1 parent 10cc7a6 commit 35e3aaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bootstrap/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=RUSTC");
println!("cargo:rerun-if-env-changed=PATH");
println!("cargo:rustc-env=BUILD_TRIPLE={}", env::var("HOST").unwrap());

// This may not be a canonicalized path.
let mut rustc = PathBuf::from(env::var_os("RUSTC").unwrap());

if rustc.is_relative() {
println!("cargo:rerun-if-env-changed=PATH");
for dir in env::split_paths(&env::var_os("PATH").unwrap_or_default()) {
let absolute = dir.join(&rustc);
if absolute.exists() {
Expand Down

0 comments on commit 35e3aaf

Please sign in to comment.