Skip to content

Commit 5cf6b8b

Browse files
committed
force-recompile library changes on download-rustc="if-unchanged"
This makes download-rustc="if-unchanged" more functional and useful for library developers. Signed-off-by: onur-ozkan <[email protected]>
1 parent 5f5c243 commit 5cf6b8b

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

src/bootstrap/src/core/build_steps/compile.rs

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ impl Step for Std {
153153
// NOTE: the beta compiler may generate different artifacts than the downloaded compiler, so
154154
// its artifacts can't be reused.
155155
&& compiler.stage != 0
156-
// This check is specific to testing std itself; see `test::Std` for more details.
157156
&& !self.force_recompile
158157
{
159158
let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false });

src/bootstrap/src/core/config/config.rs

+22-15
Original file line numberDiff line numberDiff line change
@@ -2767,25 +2767,32 @@ impl Config {
27672767
}
27682768
};
27692769

2770-
let files_to_track =
2771-
&["compiler", "library", "src/version", "src/stage0", "src/ci/channel"];
2770+
let mut files_to_track = vec!["compiler", "src/version", "src/stage0", "src/ci/channel"];
2771+
2772+
// In CI, disable ci-rustc if there are changes in the library tree. But for non-CI, ignore
2773+
// these changes to speed up the build process for library developers. This provides consistent
2774+
// functionality for library developers between `download-rustc=true` and `download-rustc="if-unchanged"`
2775+
// options.
2776+
if CiEnv::is_ci() {
2777+
files_to_track.push("library");
2778+
}
27722779

27732780
// Look for a version to compare to based on the current commit.
27742781
// Only commits merged by bors will have CI artifacts.
2775-
let commit = match self.last_modified_commit(files_to_track, "download-rustc", if_unchanged)
2776-
{
2777-
Some(commit) => commit,
2778-
None => {
2779-
if if_unchanged {
2780-
return None;
2782+
let commit =
2783+
match self.last_modified_commit(&files_to_track, "download-rustc", if_unchanged) {
2784+
Some(commit) => commit,
2785+
None => {
2786+
if if_unchanged {
2787+
return None;
2788+
}
2789+
println!("ERROR: could not find commit hash for downloading rustc");
2790+
println!("HELP: maybe your repository history is too shallow?");
2791+
println!("HELP: consider disabling `download-rustc`");
2792+
println!("HELP: or fetch enough history to include one upstream commit");
2793+
crate::exit!(1);
27812794
}
2782-
println!("ERROR: could not find commit hash for downloading rustc");
2783-
println!("HELP: maybe your repository history is too shallow?");
2784-
println!("HELP: consider disabling `download-rustc`");
2785-
println!("HELP: or fetch enough history to include one upstream commit");
2786-
crate::exit!(1);
2787-
}
2788-
};
2795+
};
27892796

27902797
if CiEnv::is_ci() && {
27912798
let head_sha =

0 commit comments

Comments
 (0)