Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ The script accepts commands, flags, and filters to determine what to do:
./x.py build --stage 0 src/libtest
```

If files are dirty that would normally be rebuilt from stage 0, that can be
overidden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
that belong to stage n or earlier:

```
# keep old build products for stage 0 and build stage 1
./x.py build --keep-stage 0 --stage 1
```

* `test` - a command for executing unit tests. Like the `build` command this
will execute the entire test suite by default, and otherwise it can be used to
select which test suite is run:
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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()
}),
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down