Skip to content

Commit 8d04495

Browse files
Auto merge of #142963 - Kobzol:try-build-skip, r=<try>
Skip unnecessary components in x64 try builds We unnecessarily rebuild `wasm-component-ld`, `llvm-bitcode-linker` and Cranelift during the intermediate PGO builds several times times, which is unnecessarily and increases the duration of try builds. This PR also disables some unnecessary dist components. r? `@jieyouxu`
2 parents 2801f9a + 8034154 commit 8d04495

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

src/ci/docker/host-x86_64/dist-x86_64-linux/dist.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ python3 ../x.py build --set rust.debug=true opt-dist
1010
build-manifest bootstrap
1111

1212
# Use GCC for building GCC, as it seems to behave badly when built with Clang
13-
CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist gcc
13+
# Only build GCC on full builds, not try builds
14+
if [ "${DIST_TRY_BUILD:-0}" == "0" ]; then
15+
CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist gcc
16+
fi

src/tools/opt-dist/src/exec.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Bootstrap {
113113
"library/std",
114114
])
115115
.env("RUST_BACKTRACE", "full");
116-
let cmd = add_shared_x_flags(env, cmd);
116+
let mut cmd = add_shared_x_flags(env, cmd);
117117

118118
Self { cmd, metrics_path }
119119
}
@@ -122,7 +122,12 @@ impl Bootstrap {
122122
let metrics_path = env.build_root().join("build").join("metrics.json");
123123
let args = dist_args.iter().map(|arg| arg.as_str()).collect::<Vec<_>>();
124124
let cmd = cmd(&args).env("RUST_BACKTRACE", "full");
125-
let cmd = add_shared_x_flags(env, cmd);
125+
let mut cmd = add_shared_x_flags(env, cmd);
126+
if env.is_fast_try_build() {
127+
// We set build.extended=false for fast try builds, but we still need Cargo
128+
cmd = cmd.arg("cargo");
129+
}
130+
126131
Self { cmd, metrics_path }
127132
}
128133

@@ -188,6 +193,19 @@ impl Bootstrap {
188193
}
189194
}
190195

191-
fn add_shared_x_flags(env: &Environment, cmd: CmdBuilder) -> CmdBuilder {
192-
if env.is_fast_try_build() { cmd.arg("--set").arg("rust.deny-warnings=false") } else { cmd }
196+
fn add_shared_x_flags(env: &Environment, mut cmd: CmdBuilder) -> CmdBuilder {
197+
if env.is_fast_try_build() {
198+
// Skip things that cannot be skipped through `x ... --skip`
199+
cmd.arg("--set")
200+
.arg("rust.llvm-bitcode-linker=false")
201+
// Skip wasm-component-ld. This also skips cargo, which we need to re-enable for dist
202+
.arg("--set")
203+
.arg("build.extended=false")
204+
.arg("--set")
205+
.arg("rust.codegen-backends=['llvm']")
206+
.arg("--set")
207+
.arg("rust.deny-warnings=false")
208+
} else {
209+
cmd
210+
}
193211
}

src/tools/opt-dist/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,18 @@ fn main() -> anyhow::Result<()> {
407407
for target in [
408408
"rust-docs",
409409
"rustc-docs",
410+
"rustc-dev",
411+
"rust-dev",
410412
"rust-docs-json",
411413
"rust-analyzer",
412414
"rustc-src",
415+
"extended",
413416
"clippy",
414417
"miri",
415418
"rustfmt",
416419
"gcc",
420+
"generate-copyright",
421+
"bootstrap",
417422
] {
418423
build_args.extend(["--skip".to_string(), target.to_string()]);
419424
}

0 commit comments

Comments
 (0)