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/bin | |
| 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/bin')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index c5684e69994..2fa4363e658 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -29,6 +29,9 @@ extern crate bootstrap; use std::env; use std::ffi::OsString; +use std::io; +use std::io::prelude::*; +use std::str::FromStr; use std::path::PathBuf; use std::process::{Command, ExitStatus}; @@ -41,6 +44,11 @@ fn main() { .and_then(|w| w[1].to_str()); let version = args.iter().find(|w| &**w == "-vV"); + let verbose = match env::var("RUSTC_VERBOSE") { + Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"), + Err(_) => 0, + }; + // Build scripts always use the snapshot compiler which is guaranteed to be // able to produce an executable, whereas intermediate compilers may not // have the standard library built yet and may not be able to produce an @@ -95,6 +103,15 @@ fn main() { cmd.args(&s.split(" ").filter(|s| !s.is_empty()).collect::<Vec<_>>()); } + // Pass down incremental directory, if any. + if let Ok(dir) = env::var("RUSTC_INCREMENTAL") { + cmd.arg(format!("-Zincremental={}", dir)); + + if verbose > 0 { + cmd.arg("-Zincremental-info"); + } + } + // If we're compiling specifically the `panic_abort` crate then we pass // the `-C panic=abort` option. Note that we do not do this for any // other crate intentionally as this is the only crate for now that we @@ -176,9 +193,19 @@ fn main() { if let Some(rpath) = rpath { cmd.arg("-C").arg(format!("link-args={}", rpath)); } + + if let Ok(s) = env::var("RUSTFLAGS") { + for flag in s.split_whitespace() { + cmd.arg(flag); + } + } } } + if verbose > 1 { + writeln!(&mut io::stderr(), "rustc command: {:?}", cmd).unwrap(); + } + // Actually run the compiler! std::process::exit(match exec_cmd(&mut cmd) { Ok(s) => s.code().unwrap_or(0xfe), |
