From e31e264c55be03e7ca9477bfb32ffa03387ac8a2 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Thu, 9 Mar 2017 17:49:37 +0900 Subject: [PATCH 1/3] rustbuild: Make save-analysis an option --- configure | 1 + src/bootstrap/config.rs | 4 ++++ src/bootstrap/config.toml.example | 3 +++ src/bootstrap/dist.rs | 10 +--------- src/bootstrap/lib.rs | 2 +- src/ci/run.sh | 1 + 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/configure b/configure index d8861dacafa..fae457e9c0b 100755 --- a/configure +++ b/configure @@ -645,6 +645,7 @@ opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" opt llvm-version-check 1 "check if the LLVM version is supported, build anyway" opt codegen-tests 1 "run the src/test/codegen tests" +opt save-analysis 0 "save API analysis data" opt option-checking 1 "complain about unrecognized options in this configure script" opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)" opt locked-deps 0 "force Cargo.lock to be up to date" diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 87c35e0502c..b6527703549 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -73,6 +73,7 @@ pub struct Config { pub rustc_default_ar: Option, pub rust_optimize_tests: bool, pub rust_debuginfo_tests: bool, + pub rust_save_analysis: bool, pub rust_dist_src: bool, pub build: String, @@ -223,6 +224,7 @@ struct Rust { optimize_tests: Option, debuginfo_tests: Option, codegen_tests: Option, + save_analysis: Option, } /// TOML representation of how each build target is configured. @@ -347,6 +349,7 @@ impl Config { set(&mut config.rust_optimize_tests, rust.optimize_tests); set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests); set(&mut config.codegen_tests, rust.codegen_tests); + set(&mut config.rust_save_analysis, rust.save_analysis); set(&mut config.rust_rpath, rust.rpath); set(&mut config.debug_jemalloc, rust.debug_jemalloc); set(&mut config.use_jemalloc, rust.use_jemalloc); @@ -453,6 +456,7 @@ impl Config { ("LOCAL_REBUILD", self.local_rebuild), ("NINJA", self.ninja), ("CODEGEN_TESTS", self.codegen_tests), + ("SAVE_ANALYSIS", self.rust_save_analysis), ("LOCKED_DEPS", self.locked_deps), ("VENDOR", self.vendor), ("FULL_BOOTSTRAP", self.full_bootstrap), diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index 776bd729119..42cf3dcabf4 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -229,6 +229,9 @@ # saying that the FileCheck executable is missing, you may want to disable this. #codegen-tests = true +# Flag indicating whether the API analysis data should be saved. +#save-analysis = false + # ============================================================================= # Options for specific targets # diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 5c4b718490c..30f4f6b33df 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -313,16 +313,8 @@ pub fn rust_src_location(build: &Build) -> PathBuf { pub fn analysis(build: &Build, compiler: &Compiler, target: &str) { println!("Dist analysis"); - if build.config.channel != "nightly" { - println!("\tskipping - not on nightly channel"); - return; - } if compiler.host != build.config.build { - println!("\tskipping - not a build host"); - return - } - if compiler.stage != 2 { - println!("\tskipping - not stage2"); + println!("\tskipping, not a build host"); return } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 4831b380837..f234db98bc3 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -524,7 +524,7 @@ impl Build { .env(format!("CFLAGS_{}", target), self.cflags(target).join(" ")); } - if self.config.channel == "nightly" && compiler.is_final_stage(self) { + if self.config.rust_save_analysis && compiler.is_final_stage(self) { cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string()); } diff --git a/src/ci/run.sh b/src/ci/run.sh index 4c4836d7ca2..55c6196b1ae 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -42,6 +42,7 @@ fi if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=nightly" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp" + RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-save-analysis" if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions" From 5a88c7e5a16227bb74d78d36ba4f37ebf5dec8d4 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 10 Mar 2017 09:35:17 +0900 Subject: [PATCH 2/3] rustbuild: Skip saving analysis when disabled --- src/bootstrap/dist.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 30f4f6b33df..b44f0834f30 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -311,6 +311,10 @@ pub fn rust_src_location(build: &Build) -> PathBuf { /// Creates a tarball of save-analysis metadata, if available. pub fn analysis(build: &Build, compiler: &Compiler, target: &str) { + if !build.config.rust_save_analysis { + return + } + println!("Dist analysis"); if compiler.host != build.config.build { From d4040c3a3fa9cc416f2f997b52946d6cd6b17e48 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 11 Mar 2017 20:00:01 +0900 Subject: [PATCH 3/3] rustbuild: Add save-analysis to install --- src/bootstrap/install.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index ba8442ebd8c..249f241a151 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -49,6 +49,10 @@ pub fn install(build: &Build, stage: u32, host: &str) { install_sh(&build, "docs", "rust-docs", stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir); } + if build.config.rust_save_analysis { + install_sh(&build, "analysis", "rust-analysis", stage, host, &prefix, + &docdir, &libdir, &mandir, &empty_dir); + } install_sh(&build, "std", "rust-std", stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir); install_sh(&build, "rustc", "rustc", stage, host, &prefix,