| ... | ... | @@ -52,39 +52,26 @@ use crate::utils::execution_context::ExecutionContext; |
| 52 | 52 | use crate::utils::helpers::exe; |
| 53 | 53 | use crate::{GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t}; |
| 54 | 54 | |
| 55 | | /// Each path from this function is considered "allowed" in the `download-rustc="if-unchanged"` logic. |
| 55 | /// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic. |
| 56 | 56 | /// This means they can be modified and changes to these paths should never trigger a compiler build |
| 57 | 57 | /// when "if-unchanged" is set. |
| 58 | | pub fn rustc_if_unchanged_allowed_paths() -> Vec<&'static str> { |
| 59 | | // NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during |
| 60 | | // the diff check. |
| 61 | | // |
| 62 | | // WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build |
| 63 | | // is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results. |
| 64 | | // For example, "src/bootstrap" should never be included in this list as it plays a crucial role in the |
| 65 | | // final output/compiler, which can be significantly affected by changes made to the bootstrap sources. |
| 66 | | let mut paths = vec![ |
| 67 | | ":!library", |
| 68 | | ":!src/tools", |
| 69 | | ":!src/librustdoc", |
| 70 | | ":!src/rustdoc-json-types", |
| 71 | | ":!tests", |
| 72 | | ":!triagebot.toml", |
| 73 | | ]; |
| 74 | | |
| 75 | | if !CiEnv::is_ci() { |
| 76 | | // When a dependency is added/updated/removed in the library tree (or in some tools), |
| 77 | | // `Cargo.lock` will be updated by `cargo`. This update will incorrectly invalidate the |
| 78 | | // `download-rustc=if-unchanged` cache. |
| 79 | | // |
| 80 | | // To prevent this, add `Cargo.lock` to the list of allowed paths when not running on CI. |
| 81 | | // This is generally safe because changes to dependencies typically involve modifying |
| 82 | | // `Cargo.toml`, which would already invalidate the CI-rustc cache on non-allowed paths. |
| 83 | | paths.push(":!Cargo.lock"); |
| 84 | | } |
| 85 | | |
| 86 | | paths |
| 87 | | } |
| 58 | /// |
| 59 | /// NOTE: Paths must have the ":!" prefix to tell git to ignore changes in those paths during |
| 60 | /// the diff check. |
| 61 | /// |
| 62 | /// WARNING: Be cautious when adding paths to this list. If a path that influences the compiler build |
| 63 | /// is added here, it will cause bootstrap to skip necessary rebuilds, which may lead to risky results. |
| 64 | /// For example, "src/bootstrap" should never be included in this list as it plays a crucial role in the |
| 65 | /// final output/compiler, which can be significantly affected by changes made to the bootstrap sources. |
| 66 | #[rustfmt::skip] // We don't want rustfmt to oneline this list |
| 67 | pub const RUSTC_IF_UNCHANGED_ALLOWED_PATHS: &[&str] = &[ |
| 68 | ":!library", |
| 69 | ":!src/tools", |
| 70 | ":!src/librustdoc", |
| 71 | ":!src/rustdoc-json-types", |
| 72 | ":!tests", |
| 73 | ":!triagebot.toml", |
| 74 | ]; |
| 88 | 75 | |
| 89 | 76 | /// Global configuration for the entire build and/or bootstrap. |
| 90 | 77 | /// |
| ... | ... | @@ -1516,7 +1503,7 @@ impl Config { |
| 1516 | 1503 | let commit = if self.rust_info.is_managed_git_subrepository() { |
| 1517 | 1504 | // Look for a version to compare to based on the current commit. |
| 1518 | 1505 | // Only commits merged by bors will have CI artifacts. |
| 1519 | | let freshness = self.check_path_modifications(&rustc_if_unchanged_allowed_paths()); |
| 1506 | let freshness = self.check_path_modifications(RUSTC_IF_UNCHANGED_ALLOWED_PATHS); |
| 1520 | 1507 | self.verbose(|| { |
| 1521 | 1508 | eprintln!("rustc freshness: {freshness:?}"); |
| 1522 | 1509 | }); |