@@ -28,6 +28,53 @@ use crate::utils::cache::{INTERNER, Interned};
28
28
use crate :: utils:: channel:: { self , GitInfo } ;
29
29
use crate :: utils:: helpers:: { self , exe, output, t} ;
30
30
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
+
31
78
macro_rules! check_ci_llvm {
32
79
( $name: expr) => {
33
80
assert!(
@@ -2754,18 +2801,9 @@ impl Config {
2754
2801
}
2755
2802
} ;
2756
2803
2757
- let files_to_track = & [
2758
- self . src . join ( "compiler" ) ,
2759
- self . src . join ( "library" ) ,
2760
- self . src . join ( "src/version" ) ,
2761
- self . src . join ( "src/stage0" ) ,
2762
- self . src . join ( "src/ci/channel" ) ,
2763
- ] ;
2764
-
2765
2804
// Look for a version to compare to based on the current commit.
2766
2805
// Only commits merged by bors will have CI artifacts.
2767
- let commit =
2768
- get_closest_merge_commit ( Some ( & self . src ) , & self . git_config ( ) , files_to_track) . unwrap ( ) ;
2806
+ let commit = get_closest_merge_commit ( Some ( & self . src ) , & self . git_config ( ) , & [ ] ) . unwrap ( ) ;
2769
2807
if commit. is_empty ( ) {
2770
2808
println ! ( "ERROR: could not find commit hash for downloading rustc" ) ;
2771
2809
println ! ( "HELP: maybe your repository history is too shallow?" ) ;
@@ -2787,27 +2825,23 @@ impl Config {
2787
2825
return None ;
2788
2826
}
2789
2827
2790
- // Warn if there were changes to the compiler or standard library since the ancestor commit.
2791
- let has_changes = !t ! ( helpers:: git( Some ( & self . src) )
2828
+ let in_tree_build_required = !t ! ( helpers:: git( Some ( & self . src) )
2792
2829
. args( [ "diff-index" , "--quiet" , & commit] )
2793
2830
. arg( "--" )
2794
- . args( files_to_track )
2831
+ . args( RUSTC_IF_UNCHANGED_ALLOWED_PATHS )
2795
2832
. as_command_mut( )
2796
2833
. status( ) )
2797
2834
. success ( ) ;
2798
- if has_changes {
2835
+
2836
+ if in_tree_build_required {
2799
2837
if if_unchanged {
2800
2838
if self . is_verbose ( ) {
2801
- println ! (
2802
- "WARNING: saw changes to compiler/ or library/ since {commit}; \
2803
- ignoring `download-rustc`"
2804
- ) ;
2839
+ println ! ( "WARNING: changes detected since {commit}; ignoring `download-rustc`" ) ;
2805
2840
}
2806
2841
return None ;
2807
2842
}
2808
2843
println ! (
2809
- "WARNING: `download-rustc` is enabled, but there are changes to \
2810
- compiler/ or library/"
2844
+ "WARNING: `download-rustc` is enabled while there are changes on the paths that can influence the compiler builds."
2811
2845
) ;
2812
2846
}
2813
2847
0 commit comments