Skip to content

Commit 0f9d3b4

Browse files
authoredFeb 7, 2022
Rollup merge of #93723 - jyn514:rerun-if-changed, r=Mark-Simulacrum
Rerun bootstrap's build script when RUSTC changes Previously, rustbuild would give strange errors if you tried to reuse the same build directory under two names: ``` $ mkdir tmp && cd tmp $ ../x.py check Building rustbuild Finished dev [unoptimized] target(s) in 35.27s Checking stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) ^C $ cd .. $ mv tmp/build build $ ./x.py check Building rustbuild Compiling bootstrap v0.0.0 (/home/jnelson/rust-lang/rust/src/bootstrap) Finished dev [unoptimized] target(s) in 11.18s failed to execute command: "/home/jnelson/rust-lang/rust/tmp/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--target" "x86_64-unknown-linux-gnu" "--print" "target-libdir" error: No such file or directory (os error 2) ``` This fixes the error. Reusing the same build directory is useful if you want to test path-related things in bootstrap itself, without having to recompile it each time. For good measure, this also reruns the build script when PATH changes.
2 parents 82fe6ed + b5b2150 commit 0f9d3b4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎src/bootstrap/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::path::PathBuf;
33

44
fn main() {
55
println!("cargo:rerun-if-changed=build.rs");
6+
println!("cargo:rerun-if-env-changed=RUSTC");
7+
println!("cargo:rerun-if-env-changed=PATH");
68
println!("cargo:rustc-env=BUILD_TRIPLE={}", env::var("HOST").unwrap());
79

810
// This may not be a canonicalized path.

0 commit comments

Comments
 (0)
Please sign in to comment.