Skip to content

Commit 282b1e4

Browse files
dvtkrlbsjyn514
authored andcommitted
Distribute bootstrap in CI artifacts
- Add a new `bootstrap` component Originally, we planned to combine this with the `rust-dev` component. However, I realized that would force LLVM to be redownloaded whenever bootstrap is modified. LLVM is a much larger download, so split this to get better caching. - Build bootstrap for all tier 1 and 2 targets
1 parent 6f0c4a6 commit 282b1e4

File tree

5 files changed

+57
-21
lines changed

5 files changed

+57
-21
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ jobs:
291291
os: ubuntu-20.04-xl
292292
- name: dist-x86_64-apple
293293
env:
294-
SCRIPT: "./x.py dist --host=x86_64-apple-darwin --target=x86_64-apple-darwin"
294+
SCRIPT: "./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin"
295295
RUST_CONFIGURE_ARGS: "--enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
296296
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
297297
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -302,7 +302,7 @@ jobs:
302302
os: macos-latest
303303
- name: dist-apple-various
304304
env:
305-
SCRIPT: "./x.py dist --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim"
305+
SCRIPT: "./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim"
306306
RUST_CONFIGURE_ARGS: "--enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
307307
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
308308
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -312,7 +312,7 @@ jobs:
312312
os: macos-latest
313313
- name: dist-x86_64-apple-alt
314314
env:
315-
SCRIPT: "./x.py dist"
315+
SCRIPT: "./x.py dist bootstrap --include-default-paths"
316316
RUST_CONFIGURE_ARGS: "--enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
317317
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
318318
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -344,7 +344,7 @@ jobs:
344344
os: macos-latest
345345
- name: dist-aarch64-apple
346346
env:
347-
SCRIPT: "./x.py dist --stage 2"
347+
SCRIPT: "./x.py dist bootstrap --include-default-paths --stage 2"
348348
RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin --enable-full-tools --enable-sanitizers --enable-profiler --disable-docs --set rust.jemalloc --set llvm.ninja=false"
349349
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
350350
USE_XCODE_CLANG: 1
@@ -418,33 +418,33 @@ jobs:
418418
- name: dist-x86_64-msvc
419419
env:
420420
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=x86_64-pc-windows-msvc --target=x86_64-pc-windows-msvc --enable-full-tools --enable-profiler"
421-
SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist
421+
SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist bootstrap --include-default-paths
422422
DIST_REQUIRE_ALL_TOOLS: 1
423423
os: windows-latest-xl
424424
- name: dist-i686-msvc
425425
env:
426426
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-msvc --host=i686-pc-windows-msvc --target=i686-pc-windows-msvc,i586-pc-windows-msvc --enable-full-tools --enable-profiler"
427-
SCRIPT: python x.py dist
427+
SCRIPT: python x.py dist bootstrap --include-default-paths
428428
DIST_REQUIRE_ALL_TOOLS: 1
429429
os: windows-latest-xl
430430
- name: dist-aarch64-msvc
431431
env:
432432
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=aarch64-pc-windows-msvc --enable-full-tools --enable-profiler"
433-
SCRIPT: python x.py dist
433+
SCRIPT: python x.py dist bootstrap --include-default-paths
434434
DIST_REQUIRE_ALL_TOOLS: 1
435435
WINDOWS_SDK_20348_HACK: 1
436436
os: windows-latest-xl
437437
- name: dist-i686-mingw
438438
env:
439439
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
440440
NO_DOWNLOAD_CI_LLVM: 1
441-
SCRIPT: python x.py dist
441+
SCRIPT: python x.py dist bootstrap --include-default-paths
442442
CUSTOM_MINGW: 1
443443
DIST_REQUIRE_ALL_TOOLS: 1
444444
os: windows-latest-xl
445445
- name: dist-x86_64-mingw
446446
env:
447-
SCRIPT: python x.py dist
447+
SCRIPT: python x.py dist bootstrap --include-default-paths
448448
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
449449
NO_DOWNLOAD_CI_LLVM: 1
450450
CUSTOM_MINGW: 1
@@ -453,7 +453,7 @@ jobs:
453453
- name: dist-x86_64-msvc-alt
454454
env:
455455
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-extended --enable-profiler"
456-
SCRIPT: python x.py dist
456+
SCRIPT: python x.py dist bootstrap --include-default-paths
457457
os: windows-latest-xl
458458
timeout-minutes: 600
459459
runs-on: "${{ matrix.os }}"

src/bootstrap/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ impl<'a> Builder<'a> {
723723
dist::Miri,
724724
dist::LlvmTools,
725725
dist::RustDev,
726+
dist::Bootstrap,
726727
dist::Extended,
727728
// It seems that PlainSourceTarball somehow changes how some of the tools
728729
// perceive their dependencies (see #93033) which would invalidate fingerprints

src/bootstrap/dist.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,6 +2050,41 @@ impl Step for RustDev {
20502050
}
20512051
}
20522052

2053+
// Tarball intended for internal consumption to ease rustc/std development.
2054+
//
2055+
// Should not be considered stable by end users.
2056+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
2057+
pub struct Bootstrap {
2058+
pub target: TargetSelection,
2059+
}
2060+
2061+
impl Step for Bootstrap {
2062+
type Output = Option<GeneratedTarball>;
2063+
const DEFAULT: bool = false;
2064+
const ONLY_HOSTS: bool = true;
2065+
2066+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2067+
run.alias("bootstrap")
2068+
}
2069+
2070+
fn make_run(run: RunConfig<'_>) {
2071+
run.builder.ensure(Bootstrap { target: run.target });
2072+
}
2073+
2074+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
2075+
let target = self.target;
2076+
2077+
let tarball = Tarball::new(builder, "bootstrap", &target.triple);
2078+
2079+
let bootstrap_outdir = &builder.bootstrap_out;
2080+
for file in &["bootstrap", "llvm-config-wrapper", "rustc", "rustdoc", "sccache-plus-cl"] {
2081+
tarball.add_file(bootstrap_outdir.join(file), "bootstrap/bin", 0o755);
2082+
}
2083+
2084+
Some(tarball.generate())
2085+
}
2086+
}
2087+
20532088
/// Tarball containing a prebuilt version of the build-manifest tool, intended to be used by the
20542089
/// release process to avoid cloning the monorepo and building stuff.
20552090
///

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ENV RUST_CONFIGURE_ARGS \
8282
ENV SCRIPT ../src/ci/pgo.sh python3 ../x.py dist \
8383
--host $HOSTS --target $HOSTS \
8484
--include-default-paths \
85-
build-manifest
85+
build-manifest bootstrap
8686
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
8787

8888
# This is the only builder which will create source tarballs

src/ci/github-actions/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ jobs:
455455

456456
- name: dist-x86_64-apple
457457
env:
458-
SCRIPT: ./x.py dist --host=x86_64-apple-darwin --target=x86_64-apple-darwin
458+
SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
459459
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
460460
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
461461
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -467,7 +467,7 @@ jobs:
467467

468468
- name: dist-apple-various
469469
env:
470-
SCRIPT: ./x.py dist --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
470+
SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
471471
RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
472472
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
473473
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -478,7 +478,7 @@ jobs:
478478

479479
- name: dist-x86_64-apple-alt
480480
env:
481-
SCRIPT: ./x.py dist
481+
SCRIPT: ./x.py dist bootstrap --include-default-paths
482482
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
483483
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
484484
MACOSX_DEPLOYMENT_TARGET: 10.7
@@ -508,7 +508,7 @@ jobs:
508508
# This target only needs to support 11.0 and up as nothing else supports the hardware
509509
- name: dist-aarch64-apple
510510
env:
511-
SCRIPT: ./x.py dist --stage 2
511+
SCRIPT: ./x.py dist bootstrap --include-default-paths --stage 2
512512
RUST_CONFIGURE_ARGS: >-
513513
--build=x86_64-apple-darwin
514514
--host=aarch64-apple-darwin
@@ -652,7 +652,7 @@ jobs:
652652
--target=x86_64-pc-windows-msvc
653653
--enable-full-tools
654654
--enable-profiler
655-
SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist
655+
SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist bootstrap --include-default-paths
656656
DIST_REQUIRE_ALL_TOOLS: 1
657657
<<: *job-windows-xl
658658

@@ -664,7 +664,7 @@ jobs:
664664
--target=i686-pc-windows-msvc,i586-pc-windows-msvc
665665
--enable-full-tools
666666
--enable-profiler
667-
SCRIPT: python x.py dist
667+
SCRIPT: python x.py dist bootstrap --include-default-paths
668668
DIST_REQUIRE_ALL_TOOLS: 1
669669
<<: *job-windows-xl
670670

@@ -675,7 +675,7 @@ jobs:
675675
--host=aarch64-pc-windows-msvc
676676
--enable-full-tools
677677
--enable-profiler
678-
SCRIPT: python x.py dist
678+
SCRIPT: python x.py dist bootstrap --include-default-paths
679679
DIST_REQUIRE_ALL_TOOLS: 1
680680
# Hack around this SDK version, because it doesn't work with clang.
681681
# See https://github.com/rust-lang/rust/issues/88796
@@ -692,14 +692,14 @@ jobs:
692692
# We are intentionally allowing an old toolchain on this builder (and that's
693693
# incompatible with LLVM downloads today).
694694
NO_DOWNLOAD_CI_LLVM: 1
695-
SCRIPT: python x.py dist
695+
SCRIPT: python x.py dist bootstrap --include-default-paths
696696
CUSTOM_MINGW: 1
697697
DIST_REQUIRE_ALL_TOOLS: 1
698698
<<: *job-windows-xl
699699

700700
- name: dist-x86_64-mingw
701701
env:
702-
SCRIPT: python x.py dist
702+
SCRIPT: python x.py dist bootstrap --include-default-paths
703703
RUST_CONFIGURE_ARGS: >-
704704
--build=x86_64-pc-windows-gnu
705705
--enable-full-tools
@@ -715,7 +715,7 @@ jobs:
715715
- name: dist-x86_64-msvc-alt
716716
env:
717717
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
718-
SCRIPT: python x.py dist
718+
SCRIPT: python x.py dist bootstrap --include-default-paths
719719
<<: *job-windows-xl
720720

721721
try:

0 commit comments

Comments
 (0)