Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ab614b0

Browse files
committed
Implement "if-available" option for download-ci-llvm
1 parent d772879 commit ab614b0

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/bootstrap/bootstrap.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ def download_stage0(self):
447447

448448
def downloading_llvm(self):
449449
opt = self.get_toml('download-ci-llvm', 'llvm')
450-
return opt == "true"
450+
return opt == "true" \
451+
or (opt == "if-available" and self.build == "x86_64-unknown-linux-gnu")
451452

452453
def _download_stage0_helper(self, filename, pattern, tarball_suffix, date=None):
453454
if date is None:
@@ -892,7 +893,7 @@ def update_submodules(self):
892893
submodules_names = []
893894
for module in submodules:
894895
if module.endswith("llvm-project"):
895-
if self.get_toml('llvm-config') or self.get_toml('download-ci-llvm') == 'true':
896+
if self.get_toml('llvm-config') or self.downloading_llvm():
896897
if self.get_toml('lld') != 'true':
897898
continue
898899
check = self.check_submodule(module, slow_submodules)

src/bootstrap/config.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ struct Llvm {
391391
use_libcxx: Option<bool>,
392392
use_linker: Option<String>,
393393
allow_old_toolchain: Option<bool>,
394-
download_ci_llvm: Option<bool>,
394+
download_ci_llvm: Option<StringOrBool>,
395395
}
396396

397397
#[derive(Deserialize, Default, Clone, Merge)]
@@ -735,7 +735,14 @@ impl Config {
735735
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
736736
config.llvm_use_linker = llvm.use_linker.clone();
737737
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain;
738-
config.llvm_from_ci = llvm.download_ci_llvm.unwrap_or(false);
738+
config.llvm_from_ci = match llvm.download_ci_llvm {
739+
Some(StringOrBool::String(s)) => {
740+
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
741+
config.build.triple == "x86_64-unknown-linux-gnu"
742+
}
743+
Some(StringOrBool::Bool(b)) => b,
744+
None => false,
745+
};
739746

740747
if config.llvm_from_ci {
741748
// None of the LLVM options, except assertions, are supported

src/bootstrap/defaults/config.compiler.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@
66
debug-logging = true
77
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
88
incremental = true
9+
10+
[llvm]
11+
# Will download LLVM from CI if available on your platform (Linux only for now)
12+
# https://github.com/rust-lang/rust/issues/77084 tracks support for more platforms
13+
download-ci-llvm = "if-available"

src/bootstrap/defaults/config.library.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ bench-stage = 0
88
[rust]
99
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
1010
incremental = true
11+
12+
[llvm]
13+
# Will download LLVM from CI if available on your platform (Linux only for now)
14+
# https://github.com/rust-lang/rust/issues/77084 tracks support for more platforms
15+
download-ci-llvm = "if-available"

0 commit comments

Comments
 (0)