From 83453bc673ab110a70c214c6c2bce8355ca8cf1a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 16 Nov 2016 18:02:56 -0500 Subject: add and document `--incremental` flag along with misc other changes For example: - we now support `-vv` to get very verbose output. - RUSTFLAGS is respected by `x.py` - better error messages for some cases --- src/bootstrap/bin/rustc.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/bootstrap/bin') diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 20ff9d9af3c..a17b0c53d0a 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; @@ -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::>()); } + // 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 cmd.status() { Ok(s) => s.code().unwrap_or(1), -- cgit 1.4.1-3-g733a5