Skip to content

Commit e1a033a

Browse files
committed
bootstrap: add --include-default-paths to ./x.py
1 parent 380f541 commit e1a033a

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

src/bootstrap/builder.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -193,37 +193,37 @@ impl StepDescription {
193193
);
194194
}
195195

196-
if paths.is_empty() {
197-
for (desc, should_run) in v.iter().zip(should_runs) {
196+
if paths.is_empty() || builder.config.include_default_paths {
197+
for (desc, should_run) in v.iter().zip(&should_runs) {
198198
if desc.default && should_run.is_really_default {
199199
for pathset in &should_run.paths {
200200
desc.maybe_run(builder, pathset);
201201
}
202202
}
203203
}
204-
} else {
205-
for path in paths {
206-
// strip CurDir prefix if present
207-
let path = match path.strip_prefix(".") {
208-
Ok(p) => p,
209-
Err(_) => path,
210-
};
204+
}
211205

212-
let mut attempted_run = false;
213-
for (desc, should_run) in v.iter().zip(&should_runs) {
214-
if let Some(suite) = should_run.is_suite_path(path) {
215-
attempted_run = true;
216-
desc.maybe_run(builder, suite);
217-
} else if let Some(pathset) = should_run.pathset_for_path(path) {
218-
attempted_run = true;
219-
desc.maybe_run(builder, pathset);
220-
}
221-
}
206+
for path in paths {
207+
// strip CurDir prefix if present
208+
let path = match path.strip_prefix(".") {
209+
Ok(p) => p,
210+
Err(_) => path,
211+
};
222212

223-
if !attempted_run {
224-
panic!("error: no rules matched {}", path.display());
213+
let mut attempted_run = false;
214+
for (desc, should_run) in v.iter().zip(&should_runs) {
215+
if let Some(suite) = should_run.is_suite_path(path) {
216+
attempted_run = true;
217+
desc.maybe_run(builder, suite);
218+
} else if let Some(pathset) = should_run.pathset_for_path(path) {
219+
attempted_run = true;
220+
desc.maybe_run(builder, pathset);
225221
}
226222
}
223+
224+
if !attempted_run {
225+
panic!("error: no rules matched {}", path.display());
226+
}
227227
}
228228
}
229229
}

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub struct Config {
6161
pub profiler: bool,
6262
pub ignore_git: bool,
6363
pub exclude: Vec<PathBuf>,
64+
pub include_default_paths: bool,
6465
pub rustc_error_format: Option<String>,
6566
pub json_output: bool,
6667
pub test_compare_mode: bool,
@@ -532,6 +533,7 @@ impl Config {
532533

533534
let mut config = Config::default_opts();
534535
config.exclude = flags.exclude;
536+
config.include_default_paths = flags.include_default_paths;
535537
config.rustc_error_format = flags.rustc_error_format;
536538
config.json_output = flags.json_output;
537539
config.on_fail = flags.on_fail;

src/bootstrap/flags.rs

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct Flags {
2929
pub cmd: Subcommand,
3030
pub incremental: bool,
3131
pub exclude: Vec<PathBuf>,
32+
pub include_default_paths: bool,
3233
pub rustc_error_format: Option<String>,
3334
pub json_output: bool,
3435
pub dry_run: bool,
@@ -133,6 +134,11 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
133134
opts.optmulti("", "host", "host targets to build", "HOST");
134135
opts.optmulti("", "target", "target targets to build", "TARGET");
135136
opts.optmulti("", "exclude", "build paths to exclude", "PATH");
137+
opts.optflag(
138+
"",
139+
"include-default-paths",
140+
"include default paths in addition to the provided ones",
141+
);
136142
opts.optopt("", "on-fail", "command to run on failure", "CMD");
137143
opts.optflag("", "dry-run", "dry run; don't build anything");
138144
opts.optopt(
@@ -601,6 +607,7 @@ Arguments:
601607
.into_iter()
602608
.map(|p| p.into())
603609
.collect::<Vec<_>>(),
610+
include_default_paths: matches.opt_present("include-default-paths"),
604611
deny_warnings: parse_deny_warnings(&matches),
605612
llvm_skip_rebuild: matches.opt_str("llvm-skip-rebuild").map(|s| s.to_lowercase()).map(
606613
|s| s.parse::<bool>().expect("`llvm-skip-rebuild` should be either true or false"),

0 commit comments

Comments
 (0)