Skip to content

Commit

Permalink
bootstrap: add --include-default-paths to ./x.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Oct 12, 2020
1 parent 2f387e9 commit 60ae018
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/bootstrap/builder.rs
Expand Up @@ -193,37 +193,37 @@ impl StepDescription {
);
}

if paths.is_empty() {
for (desc, should_run) in v.iter().zip(should_runs) {
if paths.is_empty() || builder.config.include_default_paths {
for (desc, should_run) in v.iter().zip(&should_runs) {
if desc.default && should_run.is_really_default {
for pathset in &should_run.paths {
desc.maybe_run(builder, pathset);
}
}
}
} else {
for path in paths {
// strip CurDir prefix if present
let path = match path.strip_prefix(".") {
Ok(p) => p,
Err(_) => path,
};
}

let mut attempted_run = false;
for (desc, should_run) in v.iter().zip(&should_runs) {
if let Some(suite) = should_run.is_suite_path(path) {
attempted_run = true;
desc.maybe_run(builder, suite);
} else if let Some(pathset) = should_run.pathset_for_path(path) {
attempted_run = true;
desc.maybe_run(builder, pathset);
}
}
for path in paths {
// strip CurDir prefix if present
let path = match path.strip_prefix(".") {
Ok(p) => p,
Err(_) => path,
};

if !attempted_run {
panic!("error: no rules matched {}", path.display());
let mut attempted_run = false;
for (desc, should_run) in v.iter().zip(&should_runs) {
if let Some(suite) = should_run.is_suite_path(path) {
attempted_run = true;
desc.maybe_run(builder, suite);
} else if let Some(pathset) = should_run.pathset_for_path(path) {
attempted_run = true;
desc.maybe_run(builder, pathset);
}
}

if !attempted_run {
panic!("error: no rules matched {}", path.display());
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Expand Up @@ -61,6 +61,7 @@ pub struct Config {
pub profiler: bool,
pub ignore_git: bool,
pub exclude: Vec<PathBuf>,
pub include_default_paths: bool,
pub rustc_error_format: Option<String>,
pub json_output: bool,
pub test_compare_mode: bool,
Expand Down Expand Up @@ -532,6 +533,7 @@ impl Config {

let mut config = Config::default_opts();
config.exclude = flags.exclude;
config.include_default_paths = flags.include_default_paths;
config.rustc_error_format = flags.rustc_error_format;
config.json_output = flags.json_output;
config.on_fail = flags.on_fail;
Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/flags.rs
Expand Up @@ -30,6 +30,7 @@ pub struct Flags {
pub cmd: Subcommand,
pub incremental: bool,
pub exclude: Vec<PathBuf>,
pub include_default_paths: bool,
pub rustc_error_format: Option<String>,
pub json_output: bool,
pub dry_run: bool,
Expand Down Expand Up @@ -137,6 +138,11 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
opts.optmulti("", "host", "host targets to build", "HOST");
opts.optmulti("", "target", "target targets to build", "TARGET");
opts.optmulti("", "exclude", "build paths to exclude", "PATH");
opts.optflag(
"",
"include-default-paths",
"include default paths in addition to the provided ones",
);
opts.optopt("", "on-fail", "command to run on failure", "CMD");
opts.optflag("", "dry-run", "dry run; don't build anything");
opts.optopt(
Expand Down Expand Up @@ -618,6 +624,7 @@ Arguments:
.into_iter()
.map(|p| p.into())
.collect::<Vec<_>>(),
include_default_paths: matches.opt_present("include-default-paths"),
deny_warnings: parse_deny_warnings(&matches),
llvm_skip_rebuild: matches.opt_str("llvm-skip-rebuild").map(|s| s.to_lowercase()).map(
|s| s.parse::<bool>().expect("`llvm-skip-rebuild` should be either true or false"),
Expand Down

0 comments on commit 60ae018

Please sign in to comment.