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/flags.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/flags.rs')
| -rw-r--r-- | src/bootstrap/flags.rs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 5c8d7cab966..e5ace62406a 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -27,7 +27,7 @@ use step; /// Deserialized version of all flags for this compile. pub struct Flags { - pub verbose: bool, + pub verbose: usize, // verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose pub stage: Option<u32>, pub keep_stage: Option<u32>, pub build: String, @@ -37,6 +37,17 @@ pub struct Flags { pub src: Option<PathBuf>, pub jobs: Option<u32>, pub cmd: Subcommand, + pub incremental: bool, +} + +impl Flags { + pub fn verbose(&self) -> bool { + self.verbose > 0 + } + + pub fn very_verbose(&self) -> bool { + self.verbose > 1 + } } pub enum Subcommand { @@ -63,7 +74,8 @@ pub enum Subcommand { impl Flags { pub fn parse(args: &[String]) -> Flags { let mut opts = Options::new(); - opts.optflag("v", "verbose", "use verbose output"); + opts.optflagmulti("v", "verbose", "use verbose output (-vv for very verbose)"); + opts.optflag("i", "incremental", "use incremental compilation"); opts.optopt("", "config", "TOML configuration file for build", "FILE"); opts.optopt("", "build", "build target of the stage0 compiler", "BUILD"); opts.optmulti("", "host", "host targets to build", "HOST"); @@ -256,8 +268,18 @@ To learn more about a subcommand, run `./x.py <command> -h` } }); + let mut stage = m.opt_str("stage").map(|j| j.parse().unwrap()); + + let incremental = m.opt_present("i"); + + if incremental { + if stage.is_none() { + stage = Some(1); + } + } + Flags { - verbose: m.opt_present("v"), + verbose: m.opt_count("v"), stage: m.opt_str("stage").map(|j| j.parse().unwrap()), keep_stage: m.opt_str("keep-stage").map(|j| j.parse().unwrap()), build: m.opt_str("build").unwrap_or_else(|| { @@ -269,6 +291,7 @@ To learn more about a subcommand, run `./x.py <command> -h` src: m.opt_str("src").map(PathBuf::from), jobs: m.opt_str("jobs").map(|j| j.parse().unwrap()), cmd: cmd, + incremental: incremental, } } } |
