Skip to content

Commit c8d8951

Browse files
committed
use allowed "if-unchanged" logic for compiler builds
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent edcf945 commit c8d8951

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

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

+52-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,53 @@ use crate::utils::cache::{INTERNER, Interned};
2828
use crate::utils::channel::{self, GitInfo};
2929
use crate::utils::helpers::{self, exe, output, t};
3030

31+
/// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
32+
/// This means they can be modified and changes to these paths should never trigger a compiler build
33+
/// when "if-unchanged" is set.
34+
///
35+
/// NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during
36+
/// the diff check.
37+
///
38+
/// WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build
39+
/// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results.
40+
const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[
41+
":!.clang-format",
42+
":!.editorconfig",
43+
":!.git-blame-ignore-revs",
44+
":!.gitattributes",
45+
":!.gitignore",
46+
":!.gitmodules",
47+
":!.ignore",
48+
":!.mailmap",
49+
":!CODE_OF_CONDUCT.md",
50+
":!CONTRIBUTING.md",
51+
":!COPYRIGHT",
52+
":!INSTALL.md",
53+
":!LICENSE-APACHE",
54+
":!LICENSE-MIT",
55+
":!LICENSES",
56+
":!README.md",
57+
":!RELEASES.md",
58+
":!REUSE.toml",
59+
":!config.example.toml",
60+
":!configure",
61+
":!rust-bors.toml",
62+
":!rustfmt.toml",
63+
":!tests",
64+
":!triagebot.toml",
65+
":!x",
66+
":!x.ps1",
67+
":!x.py",
68+
":!src/ci/cpu-usage-over-time.py",
69+
":!src/ci/publish_toolstate.sh",
70+
":!src/doc",
71+
":!src/etc",
72+
":!src/librustdoc",
73+
":!src/rustdoc-json-types",
74+
":!src/tools",
75+
":!src/README.md",
76+
];
77+
3178
macro_rules! check_ci_llvm {
3279
($name:expr) => {
3380
assert!(
@@ -2760,13 +2807,13 @@ impl Config {
27602807
}
27612808
};
27622809

2763-
let files_to_track =
2764-
&["compiler", "library", "src/version", "src/stage0", "src/ci/channel"];
2765-
27662810
// Look for a version to compare to based on the current commit.
27672811
// Only commits merged by bors will have CI artifacts.
2768-
let commit = match self.last_modified_commit(files_to_track, "download-rustc", if_unchanged)
2769-
{
2812+
let commit = match self.last_modified_commit(
2813+
RUSTC_IF_UNCHANGED_ALLOWED_PATHS,
2814+
"download-rustc",
2815+
if_unchanged,
2816+
) {
27702817
Some(commit) => commit,
27712818
None => {
27722819
if if_unchanged {

0 commit comments

Comments
 (0)