File tree 5 files changed +18
-17
lines changed
5 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ fn detect_gcc_sha(config: &crate::Config, is_git: bool) -> String {
273
273
get_closest_merge_commit (
274
274
Some ( & config. src ) ,
275
275
& config. git_config ( ) ,
276
- & [ config . src . join ( "src/gcc" ) , config . src . join ( "src/bootstrap/download-ci-gcc-stamp" ) ] ,
276
+ & [ "src/gcc" , "src/bootstrap/download-ci-gcc-stamp" ] ,
277
277
)
278
278
. unwrap ( )
279
279
} else if let Some ( info) = crate :: utils:: channel:: read_commit_info_file ( & config. src ) {
Original file line number Diff line number Diff line change @@ -174,20 +174,19 @@ pub fn prebuilt_llvm_config(
174
174
LlvmBuildStatus :: ShouldBuild ( Meta { stamp, res, out_dir, root : root. into ( ) } )
175
175
}
176
176
177
+ /// Paths whose changes invalidate LLVM downloads.
178
+ pub const LLVM_INVALIDATION_PATHS : & [ & str ] = & [
179
+ "src/llvm-project" ,
180
+ "src/bootstrap/download-ci-llvm-stamp" ,
181
+ // the LLVM shared object file is named `LLVM-<LLVM-version>-rust-{version}-nightly`
182
+ "src/version" ,
183
+ ] ;
184
+
177
185
/// This retrieves the LLVM sha we *want* to use, according to git history.
178
186
pub ( crate ) fn detect_llvm_sha ( config : & Config , is_git : bool ) -> String {
179
187
let llvm_sha = if is_git {
180
- get_closest_merge_commit (
181
- Some ( & config. src ) ,
182
- & config. git_config ( ) ,
183
- & [
184
- config. src . join ( "src/llvm-project" ) ,
185
- config. src . join ( "src/bootstrap/download-ci-llvm-stamp" ) ,
186
- // the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
187
- config. src . join ( "src/version" ) ,
188
- ] ,
189
- )
190
- . unwrap ( )
188
+ get_closest_merge_commit ( Some ( & config. src ) , & config. git_config ( ) , LLVM_INVALIDATION_PATHS )
189
+ . unwrap ( )
191
190
} else if let Some ( info) = crate :: utils:: channel:: read_commit_info_file ( & config. src ) {
192
191
info. sha . trim ( ) . to_owned ( )
193
192
} else {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use tracing::{instrument, span};
23
23
24
24
use crate :: core:: build_steps:: compile:: CODEGEN_BACKEND_PREFIX ;
25
25
use crate :: core:: build_steps:: llvm;
26
+ use crate :: core:: build_steps:: llvm:: LLVM_INVALIDATION_PATHS ;
26
27
pub use crate :: core:: config:: flags:: Subcommand ;
27
28
use crate :: core:: config:: flags:: { Color , Flags , Warnings } ;
28
29
use crate :: core:: download:: is_download_ci_available;
@@ -3109,9 +3110,9 @@ impl Config {
3109
3110
#[ cfg( not( test) ) ]
3110
3111
self . update_submodule ( "src/llvm-project" ) ;
3111
3112
3112
- // Check for untracked changes in `src/llvm-project`.
3113
+ // Check for untracked changes in `src/llvm-project` and other important places .
3113
3114
let has_changes = self
3114
- . last_modified_commit ( & [ "src/llvm-project" ] , "download-ci-llvm" , true )
3115
+ . last_modified_commit ( LLVM_INVALIDATION_PATHS , "download-ci-llvm" , true )
3115
3116
. is_none ( ) ;
3116
3117
3117
3118
// Return false if there are untracked changes, otherwise check if CI LLVM is available.
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use super::flags::Flags;
12
12
use super :: { ChangeIdWrapper , Config , RUSTC_IF_UNCHANGED_ALLOWED_PATHS } ;
13
13
use crate :: core:: build_steps:: clippy:: { LintConfig , get_clippy_rules_in_order} ;
14
14
use crate :: core:: build_steps:: llvm;
15
+ use crate :: core:: build_steps:: llvm:: LLVM_INVALIDATION_PATHS ;
15
16
use crate :: core:: config:: { LldMode , Target , TargetSelection , TomlConfig } ;
16
17
17
18
pub ( crate ) fn parse ( config : & str ) -> Config {
@@ -41,7 +42,7 @@ fn download_ci_llvm() {
41
42
let if_unchanged_config = parse ( "llvm.download-ci-llvm = \" if-unchanged\" " ) ;
42
43
if if_unchanged_config. llvm_from_ci {
43
44
let has_changes = if_unchanged_config
44
- . last_modified_commit ( & [ "src/llvm-project" ] , "download-ci-llvm" , true )
45
+ . last_modified_commit ( LLVM_INVALIDATION_PATHS , "download-ci-llvm" , true )
45
46
. is_none ( ) ;
46
47
47
48
assert ! (
Original file line number Diff line number Diff line change 1
- use std:: path:: { Path , PathBuf } ;
1
+ use std:: path:: Path ;
2
2
use std:: process:: { Command , Stdio } ;
3
3
4
4
use crate :: ci:: CiEnv ;
@@ -121,7 +121,7 @@ fn git_upstream_merge_base(
121
121
pub fn get_closest_merge_commit (
122
122
git_dir : Option < & Path > ,
123
123
config : & GitConfig < ' _ > ,
124
- target_paths : & [ PathBuf ] ,
124
+ target_paths : & [ & str ] ,
125
125
) -> Result < String , String > {
126
126
let mut git = Command :: new ( "git" ) ;
127
127
You can’t perform that action at this time.
0 commit comments