diff options
| author | bors <bors@rust-lang.org> | 2016-12-19 20:07:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-19 20:07:49 +0000 |
| commit | 94ae2a2e6791e0c4ab6fba836b2b09a07f2d3c8a (patch) | |
| tree | c4b755d9da0899f8363c8e49d59d7b7755b69a51 /src/bootstrap/lib.rs | |
| parent | 3f9823d5f53230e83b707b4876b5bb271a4c22ef (diff) | |
| parent | 83453bc673ab110a70c214c6c2bce8355ca8cf1a (diff) | |
| download | rust-94ae2a2e6791e0c4ab6fba836b2b09a07f2d3c8a.tar.gz rust-94ae2a2e6791e0c4ab6fba836b2b09a07f2d3c8a.zip | |
Auto merge of #38072 - nikomatsakis:bootstrap-incremental, r=acrichto
add preliminary support for incremental compilation to rustbuild.py This implements the integration described in #37929. It requires the use of a local nightly as your bootstrap compiler. The setup is described in `src/bootstrap/README.md`. This does NOT implement the "copy stage0 libs to stage1" optimization described in #37929, just because that seems orthogonal to me. In local testing, I do not yet see any incremental re-use when building rustc. I'm not sure why that is, more investigation needed. (For these reasons, this is not marked as fixing the relevant issue.) r? @alexcrichton -- I included one random cleanup (`Step::noop()`) that turned out to not be especially relevant. Feel free to tell me you liked it better the old way.
Diffstat (limited to 'src/bootstrap/lib.rs')
| -rw-r--r-- | src/bootstrap/lib.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index cd80c4298dc..f6db6e786db 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -74,6 +74,7 @@ extern crate rustc_serialize; extern crate toml; use std::collections::HashMap; +use std::cmp; use std::env; use std::ffi::OsString; use std::fs::{self, File}; @@ -497,6 +498,17 @@ impl Build { cargo.env("RUSTC_BOOTSTRAP", "1"); self.add_rust_test_threads(&mut cargo); + // Ignore incremental modes except for stage0, since we're + // not guaranteeing correctness acros builds if the compiler + // is changing under your feet.` + if self.flags.incremental && compiler.stage == 0 { + let incr_dir = self.incremental_dir(compiler); + cargo.env("RUSTC_INCREMENTAL", incr_dir); + } + + let verbose = cmp::max(self.config.verbose, self.flags.verbose); + cargo.env("RUSTC_VERBOSE", format!("{}", verbose)); + // Specify some various options for build scripts used throughout // the build. // @@ -516,7 +528,7 @@ impl Build { // FIXME: should update code to not require this env var cargo.env("CFG_COMPILER_HOST_TRIPLE", target); - if self.config.verbose || self.flags.verbose { + if self.config.verbose() || self.flags.verbose() { cargo.arg("-v"); } // FIXME: cargo bench does not accept `--release` @@ -630,6 +642,12 @@ impl Build { } } + /// Get the directory for incremental by-products when using the + /// given compiler. + fn incremental_dir(&self, compiler: &Compiler) -> PathBuf { + self.out.join(compiler.host).join(format!("stage{}-incremental", compiler.stage)) + } + /// Returns the libdir where the standard library and other artifacts are /// found for a compiler's sysroot. fn sysroot_libdir(&self, compiler: &Compiler, target: &str) -> PathBuf { @@ -768,7 +786,7 @@ impl Build { /// Prints a message if this build is configured in verbose mode. fn verbose(&self, msg: &str) { - if self.flags.verbose || self.config.verbose { + if self.flags.verbose() || self.config.verbose() { println!("{}", msg); } } |
