@@ -1791,8 +1791,7 @@ impl Config {
1791
1791
config. llvm_link_shared . set ( Some ( true ) ) ;
1792
1792
}
1793
1793
} else {
1794
- config. llvm_from_ci = config. channel == "dev"
1795
- && crate :: core:: build_steps:: llvm:: is_ci_llvm_available ( & config, false ) ;
1794
+ config. llvm_from_ci = config. parse_download_ci_llvm ( None , false ) ;
1796
1795
}
1797
1796
1798
1797
if let Some ( t) = toml. target {
@@ -2337,29 +2336,30 @@ impl Config {
2337
2336
download_ci_llvm : Option < StringOrBool > ,
2338
2337
asserts : bool ,
2339
2338
) -> bool {
2339
+ let if_unchanged = || {
2340
+ // Git is needed to track modifications here, but tarball source is not available.
2341
+ // If not modified here or built through tarball source, we maintain consistency
2342
+ // with '"if available"'.
2343
+ if !self . rust_info . is_from_tarball ( )
2344
+ && self
2345
+ . last_modified_commit ( & [ "src/llvm-project" ] , "download-ci-llvm" , true )
2346
+ . is_none ( )
2347
+ {
2348
+ // there are some untracked changes in the the given paths.
2349
+ false
2350
+ } else {
2351
+ llvm:: is_ci_llvm_available ( & self , asserts)
2352
+ }
2353
+ } ;
2340
2354
match download_ci_llvm {
2341
- None => self . channel == "dev" && llvm :: is_ci_llvm_available ( & self , asserts ) ,
2355
+ None => self . channel == "dev" && if_unchanged ( ) ,
2342
2356
Some ( StringOrBool :: Bool ( b) ) => b,
2343
2357
// FIXME: "if-available" is deprecated. Remove this block later (around mid 2024)
2344
2358
// to not break builds between the recent-to-old checkouts.
2345
2359
Some ( StringOrBool :: String ( s) ) if s == "if-available" => {
2346
2360
llvm:: is_ci_llvm_available ( & self , asserts)
2347
2361
}
2348
- Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => {
2349
- // Git is needed to track modifications here, but tarball source is not available.
2350
- // If not modified here or built through tarball source, we maintain consistency
2351
- // with '"if available"'.
2352
- if !self . rust_info . is_from_tarball ( )
2353
- && self
2354
- . last_modified_commit ( & [ "src/llvm-project" ] , "download-ci-llvm" , true )
2355
- . is_none ( )
2356
- {
2357
- // there are some untracked changes in the the given paths.
2358
- false
2359
- } else {
2360
- llvm:: is_ci_llvm_available ( & self , asserts)
2361
- }
2362
- }
2362
+ Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => if_unchanged ( ) ,
2363
2363
Some ( StringOrBool :: String ( other) ) => {
2364
2364
panic ! ( "unrecognized option for download-ci-llvm: {:?}" , other)
2365
2365
}
0 commit comments