Skip to content

Commit 6c7f301

Browse files
Enable downloading prebuilt LLVM in test builders
See comment added for details on the test builder restriction. This is primarily intended for macOS CI, but is likely to be a slight win on other builders too.
1 parent 8ca14aa commit 6c7f301

File tree

16 files changed

+88
-4
lines changed

16 files changed

+88
-4
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,24 +391,28 @@ jobs:
391391
env:
392392
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
393393
SCRIPT: make ci-mingw-subset-1
394+
NO_DOWNLOAD_CI_LLVM: 1
394395
CUSTOM_MINGW: 1
395396
os: windows-latest-xl
396397
- name: i686-mingw-2
397398
env:
398399
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
399400
SCRIPT: make ci-mingw-subset-2
401+
NO_DOWNLOAD_CI_LLVM: 1
400402
CUSTOM_MINGW: 1
401403
os: windows-latest-xl
402404
- name: x86_64-mingw-1
403405
env:
404406
SCRIPT: make ci-mingw-subset-1
405407
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
408+
NO_DOWNLOAD_CI_LLVM: 1
406409
CUSTOM_MINGW: 1
407410
os: windows-latest-xl
408411
- name: x86_64-mingw-2
409412
env:
410413
SCRIPT: make ci-mingw-subset-2
411414
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
415+
NO_DOWNLOAD_CI_LLVM: 1
412416
CUSTOM_MINGW: 1
413417
os: windows-latest-xl
414418
- name: dist-x86_64-msvc
@@ -433,6 +437,7 @@ jobs:
433437
- name: dist-i686-mingw
434438
env:
435439
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
440+
NO_DOWNLOAD_CI_LLVM: 1
436441
SCRIPT: python x.py dist
437442
CUSTOM_MINGW: 1
438443
DIST_REQUIRE_ALL_TOOLS: 1
@@ -441,6 +446,7 @@ jobs:
441446
env:
442447
SCRIPT: python x.py dist
443448
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
449+
NO_DOWNLOAD_CI_LLVM: 1
444450
CUSTOM_MINGW: 1
445451
DIST_REQUIRE_ALL_TOOLS: 1
446452
os: windows-latest-xl

src/bootstrap/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ impl Config {
990990
config.llvm_from_ci = match llvm.download_ci_llvm {
991991
Some(StringOrBool::String(s)) => {
992992
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
993-
crate::native::is_ci_llvm_available(&config)
993+
crate::native::is_ci_llvm_available(&config, llvm_assertions.unwrap_or(false))
994994
}
995995
Some(StringOrBool::Bool(b)) => b,
996996
None => false,

src/bootstrap/native.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub(crate) fn detect_llvm_sha(config: &crate::config::Config) -> String {
148148
/// This checks both the build triple platform to confirm we're usable at all,
149149
/// and then verifies if the current HEAD matches the detected LLVM SHA head,
150150
/// in which case LLVM is indicated as not available.
151-
pub(crate) fn is_ci_llvm_available(config: &crate::config::Config) -> bool {
151+
pub(crate) fn is_ci_llvm_available(config: &crate::config::Config, asserts: bool) -> bool {
152152
// This is currently all tier 1 targets and tier 2 targets with host tools
153153
// (since others may not have CI artifacts)
154154
// https://doc.rust-lang.org/rustc/platform-support.html#tier-1
@@ -187,6 +187,12 @@ pub(crate) fn is_ci_llvm_available(config: &crate::config::Config) -> bool {
187187
return false;
188188
}
189189

190+
let triple = &*config.build.triple;
191+
if (triple == "aarch64-unknown-linux-gnu" || triple.contains("i686")) && asserts {
192+
// No alt builder for aarch64-unknown-linux-gnu today.
193+
return false;
194+
}
195+
190196
if crate::util::CiEnv::is_ci() {
191197
let llvm_sha = detect_llvm_sha(config);
192198
let head_sha = output(config.git().arg("rev-parse").arg("HEAD"));

src/ci/docker/host-x86_64/arm-android/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ ENV PATH=$PATH:/android/sdk/platform-tools
2929

3030
ENV TARGETS=arm-linux-androideabi
3131

32+
# We are intentionally allowing an old toolchain on this builder (and that's
33+
# incompatible with LLVM downloads today).
34+
ENV NO_DOWNLOAD_CI_LLVM 1
35+
3236
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14 \
3337
--set llvm.allow-old-toolchain
3438

src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ RUN mkdir -p /config
2727
RUN echo "[rust]" > /config/nopt-std-config.toml
2828
RUN echo "optimize = false" >> /config/nopt-std-config.toml
2929

30+
# We are intentionally allowing an old toolchain on this builder (and that's
31+
# incompatible with LLVM downloads today).
32+
ENV NO_DOWNLOAD_CI_LLVM 1
33+
3034
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests \
3135
--set llvm.allow-old-toolchain
3236
ENV SCRIPT python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std \

src/ci/docker/host-x86_64/i686-gnu/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ RUN sh /scripts/sccache.sh
2323
COPY scripts/cmake.sh /scripts/
2424
RUN /scripts/cmake.sh
2525

26+
# We are intentionally allowing an old toolchain on this builder (and that's
27+
# incompatible with LLVM downloads today).
28+
ENV NO_DOWNLOAD_CI_LLVM 1
2629
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu \
2730
--set llvm.allow-old-toolchain
2831
# Exclude some tests that are unlikely to be platform specific, to speed up

src/ci/docker/host-x86_64/test-various/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ WORKDIR /
3030
COPY scripts/sccache.sh /scripts/
3131
RUN sh /scripts/sccache.sh
3232

33+
# We are disabling CI LLVM since this builder needs to build LLD, which is
34+
# currently unsupported when downloading pre-built LLVM.
35+
ENV NO_DOWNLOAD_CI_LLVM 1
36+
3337
ENV RUST_CONFIGURE_ARGS \
3438
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
3539
--set build.nodejs=/node-v15.14.0-linux-x64/bin/node \

src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ RUN sh /scripts/sccache.sh
2626
COPY scripts/cmake.sh /scripts/
2727
RUN /scripts/cmake.sh
2828

29+
# We are intentionally allowing an old toolchain on this builder (and that's
30+
# incompatible with LLVM downloads today).
31+
ENV NO_DOWNLOAD_CI_LLVM 1
32+
2933
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu \
3034
--set llvm.allow-old-toolchain
3135
ENV RUST_CHECK_TARGET check-aux

src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ RUN sh /scripts/sccache.sh
3131
ENV RUSTBUILD_FORCE_CLANG_BASED_TESTS 1
3232
ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
3333

34+
# llvm.use-linker conflicts with downloading CI LLVM
35+
ENV NO_DOWNLOAD_CI_LLVM 1
36+
3437
ENV RUST_CONFIGURE_ARGS \
3538
--build=x86_64-unknown-linux-gnu \
3639
--enable-debug \

src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ RUN sh /scripts/sccache.sh
2222
COPY scripts/cmake.sh /scripts/
2323
RUN /scripts/cmake.sh
2424

25+
# We are intentionally allowing an old toolchain on this builder (and that's
26+
# incompatible with LLVM downloads today).
27+
ENV NO_DOWNLOAD_CI_LLVM 1
28+
2529
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false \
2630
--set llvm.allow-old-toolchain
2731
ENV SCRIPT python3 ../x.py --stage 2 test distcheck

0 commit comments

Comments
 (0)