rustbuild: Add cli option --keep-stage
This option is intended to be used like: ./x.py build --stage 1 --keep-stage 0 Which skips all stage 0 steps, so that stage 1 can be recompiled directly (even if for example libcore has changes). This is useful when working on `cfg(not(stage0))` parts of the libraries, or when re-running stage 1 tests in libraries in general.
This commit is contained in:
parent
fd5dc05793
commit
4e696edc71
2 changed files with 7 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ use step;
|
|||
pub struct Flags {
|
||||
pub verbose: bool,
|
||||
pub stage: Option<u32>,
|
||||
pub keep_stage: Option<u32>,
|
||||
pub build: String,
|
||||
pub host: Vec<String>,
|
||||
pub target: Vec<String>,
|
||||
|
|
@ -68,6 +69,7 @@ impl Flags {
|
|||
opts.optmulti("", "host", "host targets to build", "HOST");
|
||||
opts.optmulti("", "target", "target targets to build", "TARGET");
|
||||
opts.optopt("", "stage", "stage to build", "N");
|
||||
opts.optopt("", "keep-stage", "stage to keep without recompiling", "N");
|
||||
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
|
||||
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
|
||||
opts.optflag("h", "help", "print this help message");
|
||||
|
|
@ -258,6 +260,7 @@ To learn more about a subcommand, run `./x.py <command> -h`
|
|||
Flags {
|
||||
verbose: m.opt_present("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(|| {
|
||||
env::var("BUILD").unwrap()
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -871,6 +871,10 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
|
||||
// And finally, iterate over everything and execute it.
|
||||
for step in order.iter() {
|
||||
if self.build.flags.keep_stage.map_or(false, |s| step.stage <= s) {
|
||||
self.build.verbose(&format!("keeping step {:?}", step));
|
||||
continue;
|
||||
}
|
||||
self.build.verbose(&format!("executing step {:?}", step));
|
||||
(self.rules[step.name].run)(step);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue