change download-ci-llvm default from "if-unchanged" to true

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-09-19 11:29:37 +03:00
parent 60c3673456
commit 7d579046c8
2 changed files with 6 additions and 7 deletions

View File

@ -2738,6 +2738,8 @@ impl Config {
download_ci_llvm: Option<StringOrBool>, download_ci_llvm: Option<StringOrBool>,
asserts: bool, asserts: bool,
) -> bool { ) -> bool {
let download_ci_llvm = download_ci_llvm.unwrap_or(StringOrBool::Bool(true));
let if_unchanged = || { let if_unchanged = || {
if self.rust_info.is_from_tarball() { if self.rust_info.is_from_tarball() {
// Git is needed for running "if-unchanged" logic. // Git is needed for running "if-unchanged" logic.
@ -2761,10 +2763,7 @@ impl Config {
}; };
match download_ci_llvm { match download_ci_llvm {
None => { StringOrBool::Bool(b) => {
(self.channel == "dev" || self.download_rustc_commit.is_some()) && if_unchanged()
}
Some(StringOrBool::Bool(b)) => {
if !b && self.download_rustc_commit.is_some() { if !b && self.download_rustc_commit.is_some() {
panic!( panic!(
"`llvm.download-ci-llvm` cannot be set to `false` if `rust.download-rustc` is set to `true` or `if-unchanged`." "`llvm.download-ci-llvm` cannot be set to `false` if `rust.download-rustc` is set to `true` or `if-unchanged`."
@ -2774,8 +2773,8 @@ impl Config {
// If download-ci-llvm=true we also want to check that CI llvm is available // If download-ci-llvm=true we also want to check that CI llvm is available
b && llvm::is_ci_llvm_available(self, asserts) b && llvm::is_ci_llvm_available(self, asserts)
} }
Some(StringOrBool::String(s)) if s == "if-unchanged" => if_unchanged(), StringOrBool::String(s) if s == "if-unchanged" => if_unchanged(),
Some(StringOrBool::String(other)) => { StringOrBool::String(other) => {
panic!("unrecognized option for download-ci-llvm: {:?}", other) panic!("unrecognized option for download-ci-llvm: {:?}", other)
} }
} }

View File

@ -32,7 +32,7 @@ fn download_ci_llvm() {
assert!(!parse_llvm("llvm.download-ci-llvm = false")); assert!(!parse_llvm("llvm.download-ci-llvm = false"));
assert_eq!(parse_llvm(""), if_unchanged); assert_eq!(parse_llvm(""), if_unchanged);
assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged); assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged);
assert!(!parse_llvm("rust.channel = \"stable\"")); assert!(parse_llvm("rust.channel = \"stable\""));
assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged); assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged);
assert_eq!( assert_eq!(
parse_llvm( parse_llvm(