This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +18
-17
lines changed Expand file tree Collapse file tree 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 {
273273 get_closest_merge_commit (
274274 Some ( & config. src ) ,
275275 & 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" ] ,
277277 )
278278 . unwrap ( )
279279 } 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(
174174 LlvmBuildStatus :: ShouldBuild ( Meta { stamp, res, out_dir, root : root. into ( ) } )
175175}
176176
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+
177185/// This retrieves the LLVM sha we *want* to use, according to git history.
178186pub ( crate ) fn detect_llvm_sha ( config : & Config , is_git : bool ) -> String {
179187 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 ( )
191190 } else if let Some ( info) = crate :: utils:: channel:: read_commit_info_file ( & config. src ) {
192191 info. sha . trim ( ) . to_owned ( )
193192 } else {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use tracing::{instrument, span};
2323
2424use crate :: core:: build_steps:: compile:: CODEGEN_BACKEND_PREFIX ;
2525use crate :: core:: build_steps:: llvm;
26+ use crate :: core:: build_steps:: llvm:: LLVM_INVALIDATION_PATHS ;
2627pub use crate :: core:: config:: flags:: Subcommand ;
2728use crate :: core:: config:: flags:: { Color , Flags , Warnings } ;
2829use crate :: core:: download:: is_download_ci_available;
@@ -3109,9 +3110,9 @@ impl Config {
31093110 #[ cfg( not( test) ) ]
31103111 self . update_submodule ( "src/llvm-project" ) ;
31113112
3112- // Check for untracked changes in `src/llvm-project`.
3113+ // Check for untracked changes in `src/llvm-project` and other important places .
31133114 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 )
31153116 . is_none ( ) ;
31163117
31173118 // 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;
1212use super :: { ChangeIdWrapper , Config , RUSTC_IF_UNCHANGED_ALLOWED_PATHS } ;
1313use crate :: core:: build_steps:: clippy:: { LintConfig , get_clippy_rules_in_order} ;
1414use crate :: core:: build_steps:: llvm;
15+ use crate :: core:: build_steps:: llvm:: LLVM_INVALIDATION_PATHS ;
1516use crate :: core:: config:: { LldMode , Target , TargetSelection , TomlConfig } ;
1617
1718pub ( crate ) fn parse ( config : & str ) -> Config {
@@ -41,7 +42,7 @@ fn download_ci_llvm() {
4142 let if_unchanged_config = parse ( "llvm.download-ci-llvm = \" if-unchanged\" " ) ;
4243 if if_unchanged_config. llvm_from_ci {
4344 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 )
4546 . is_none ( ) ;
4647
4748 assert ! (
Original file line number Diff line number Diff line change 1- use std:: path:: { Path , PathBuf } ;
1+ use std:: path:: Path ;
22use std:: process:: { Command , Stdio } ;
33
44use crate :: ci:: CiEnv ;
@@ -121,7 +121,7 @@ fn git_upstream_merge_base(
121121pub fn get_closest_merge_commit (
122122 git_dir : Option < & Path > ,
123123 config : & GitConfig < ' _ > ,
124- target_paths : & [ PathBuf ] ,
124+ target_paths : & [ & str ] ,
125125) -> Result < String , String > {
126126 let mut git = Command :: new ( "git" ) ;
127127
You can’t perform that action at this time.
0 commit comments