Skip to content

Commit 0aeb9c1

Browse files
committed
Auto merge of #40383 - ishitatsuyuki:easy-dist-analysis, r=alexcrichton
rustbuild: Make save-analysis an option This makes save-analysis an option independent from the release channel. The CI build scripts have been modified to enable the flag. *Merge with caution.* I haven't tested this, and this can cause nightly breakage.
2 parents 11a3376 + d4040c3 commit 0aeb9c1

File tree

7 files changed

+19
-10
lines changed

7 files changed

+19
-10
lines changed

configure

+1
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ opt dist-host-only 0 "only install bins for the host architecture"
445445
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
446446
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
447447
opt codegen-tests 1 "run the src/test/codegen tests"
448+
opt save-analysis 0 "save API analysis data"
448449
opt option-checking 1 "complain about unrecognized options in this configure script"
449450
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
450451
opt locked-deps 0 "force Cargo.lock to be up to date"

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct Config {
7474
pub rustc_default_ar: Option<String>,
7575
pub rust_optimize_tests: bool,
7676
pub rust_debuginfo_tests: bool,
77+
pub rust_save_analysis: bool,
7778
pub rust_dist_src: bool,
7879

7980
pub build: String,
@@ -225,6 +226,7 @@ struct Rust {
225226
optimize_tests: Option<bool>,
226227
debuginfo_tests: Option<bool>,
227228
codegen_tests: Option<bool>,
229+
save_analysis: Option<bool>,
228230
}
229231

230232
/// TOML representation of how each build target is configured.
@@ -350,6 +352,7 @@ impl Config {
350352
set(&mut config.rust_optimize_tests, rust.optimize_tests);
351353
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
352354
set(&mut config.codegen_tests, rust.codegen_tests);
355+
set(&mut config.rust_save_analysis, rust.save_analysis);
353356
set(&mut config.rust_rpath, rust.rpath);
354357
set(&mut config.debug_jemalloc, rust.debug_jemalloc);
355358
set(&mut config.use_jemalloc, rust.use_jemalloc);
@@ -457,6 +460,7 @@ impl Config {
457460
("LOCAL_REBUILD", self.local_rebuild),
458461
("NINJA", self.ninja),
459462
("CODEGEN_TESTS", self.codegen_tests),
463+
("SAVE_ANALYSIS", self.rust_save_analysis),
460464
("LOCKED_DEPS", self.locked_deps),
461465
("VENDOR", self.vendor),
462466
("FULL_BOOTSTRAP", self.full_bootstrap),

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@
234234
# saying that the FileCheck executable is missing, you may want to disable this.
235235
#codegen-tests = true
236236

237+
# Flag indicating whether the API analysis data should be saved.
238+
#save-analysis = false
239+
237240
# =============================================================================
238241
# Options for specific targets
239242
#

src/bootstrap/dist.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,14 @@ pub fn rust_src_location(build: &Build) -> PathBuf {
311311

312312
/// Creates a tarball of save-analysis metadata, if available.
313313
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
314+
if !build.config.rust_save_analysis {
315+
return
316+
}
317+
314318
println!("Dist analysis");
315319

316-
if build.config.channel != "nightly" {
317-
println!("\tskipping - not on nightly channel");
318-
return;
319-
}
320320
if compiler.host != build.config.build {
321-
println!("\tskipping - not a build host");
322-
return
323-
}
324-
if compiler.stage != 2 {
325-
println!("\tskipping - not stage2");
321+
println!("\tskipping, not a build host");
326322
return
327323
}
328324

src/bootstrap/install.rs

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub fn install(build: &Build, stage: u32, host: &str) {
4949
install_sh(&build, "docs", "rust-docs", stage, host, &prefix,
5050
&docdir, &libdir, &mandir, &empty_dir);
5151
}
52+
if build.config.rust_save_analysis {
53+
install_sh(&build, "analysis", "rust-analysis", stage, host, &prefix,
54+
&docdir, &libdir, &mandir, &empty_dir);
55+
}
5256
install_sh(&build, "std", "rust-std", stage, host, &prefix,
5357
&docdir, &libdir, &mandir, &empty_dir);
5458
install_sh(&build, "rustc", "rustc", stage, host, &prefix,

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl Build {
524524
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
525525
}
526526

527-
if self.config.channel == "nightly" && compiler.is_final_stage(self) {
527+
if self.config.rust_save_analysis && compiler.is_final_stage(self) {
528528
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
529529
}
530530

src/ci/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fi
4343
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
4444
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=nightly"
4545
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
46+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-save-analysis"
4647

4748
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
4849
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"

0 commit comments

Comments
 (0)