From e0f8e865dbf9f1dc9d1d917efc04320e2eb123f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 24 Jun 2025 15:51:08 +0200 Subject: [PATCH 1/4] Skip unnecessary components in x64 try builds --- src/tools/opt-dist/src/exec.rs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/tools/opt-dist/src/exec.rs b/src/tools/opt-dist/src/exec.rs index 64ce5cc377522..75569eacacdea 100644 --- a/src/tools/opt-dist/src/exec.rs +++ b/src/tools/opt-dist/src/exec.rs @@ -113,7 +113,7 @@ impl Bootstrap { "library/std", ]) .env("RUST_BACKTRACE", "full"); - let cmd = add_shared_x_flags(env, cmd); + let mut cmd = add_shared_x_flags(env, cmd); Self { cmd, metrics_path } } @@ -122,7 +122,12 @@ impl Bootstrap { let metrics_path = env.build_root().join("build").join("metrics.json"); let args = dist_args.iter().map(|arg| arg.as_str()).collect::>(); let cmd = cmd(&args).env("RUST_BACKTRACE", "full"); - let cmd = add_shared_x_flags(env, cmd); + let mut cmd = add_shared_x_flags(env, cmd); + if env.is_fast_try_build() { + // We set build.extended=false for fast try builds, but we still need Cargo + cmd = cmd.arg("cargo"); + } + Self { cmd, metrics_path } } @@ -188,6 +193,19 @@ impl Bootstrap { } } -fn add_shared_x_flags(env: &Environment, cmd: CmdBuilder) -> CmdBuilder { - if env.is_fast_try_build() { cmd.arg("--set").arg("rust.deny-warnings=false") } else { cmd } +fn add_shared_x_flags(env: &Environment, mut cmd: CmdBuilder) -> CmdBuilder { + if env.is_fast_try_build() { + // Skip things that cannot be skipped through `x ... --skip` + cmd.arg("--set") + .arg("rust.llvm-bitcode-linker=false") + // Skip wasm-component-ld. This also skips cargo, which we need to re-enable for dist + .arg("--set") + .arg("build.extended=false") + .arg("--set") + .arg("rust.codegen-backends=['llvm']") + .arg("--set") + .arg("rust.deny-warnings=false") + } else { + cmd + } } From 25dee4e56e0ad075044e7e465ae513086c78f45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 24 Jun 2025 15:57:25 +0200 Subject: [PATCH 2/4] Skip more dist components --- src/tools/opt-dist/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/opt-dist/src/main.rs b/src/tools/opt-dist/src/main.rs index d2827ec01ca7d..9c8a6637a3b10 100644 --- a/src/tools/opt-dist/src/main.rs +++ b/src/tools/opt-dist/src/main.rs @@ -407,13 +407,18 @@ fn main() -> anyhow::Result<()> { for target in [ "rust-docs", "rustc-docs", + "rustc-dev", + "rust-dev", "rust-docs-json", "rust-analyzer", "rustc-src", + "extended", "clippy", "miri", "rustfmt", "gcc", + "generate-copyright", + "bootstrap", ] { build_args.extend(["--skip".to_string(), target.to_string()]); } From 803415478cfc69d9e6c02b313560d6a2e433e0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 24 Jun 2025 16:04:56 +0200 Subject: [PATCH 3/4] Do not build GCC in fast try builds --- src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh index 064ac5b0a5e42..924bdbc761505 100755 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh @@ -10,4 +10,7 @@ python3 ../x.py build --set rust.debug=true opt-dist build-manifest bootstrap # Use GCC for building GCC, as it seems to behave badly when built with Clang -CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist gcc +# Only build GCC on full builds, not try builds +if [ "${DIST_TRY_BUILD:-0}" == "0" ]; then + CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist gcc +fi From 58bc1dcb73b75d8fd0117d76e9a9f61ff297cd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 25 Jun 2025 16:24:30 +0200 Subject: [PATCH 4/4] Remove `mut` --- src/tools/opt-dist/src/exec.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/opt-dist/src/exec.rs b/src/tools/opt-dist/src/exec.rs index 75569eacacdea..0dc6e56b9d5f4 100644 --- a/src/tools/opt-dist/src/exec.rs +++ b/src/tools/opt-dist/src/exec.rs @@ -113,7 +113,7 @@ impl Bootstrap { "library/std", ]) .env("RUST_BACKTRACE", "full"); - let mut cmd = add_shared_x_flags(env, cmd); + let cmd = add_shared_x_flags(env, cmd); Self { cmd, metrics_path } } @@ -193,7 +193,7 @@ impl Bootstrap { } } -fn add_shared_x_flags(env: &Environment, mut cmd: CmdBuilder) -> CmdBuilder { +fn add_shared_x_flags(env: &Environment, cmd: CmdBuilder) -> CmdBuilder { if env.is_fast_try_build() { // Skip things that cannot be skipped through `x ... --skip` cmd.arg("--set")