bootstrap: add --include-default-paths to ./x.py

上级 2f387e9d
......@@ -193,37 +193,37 @@ fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) {
);
}
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());
}
}
}
}
......
......@@ -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,
......@@ -532,6 +533,7 @@ pub fn parse(args: &[String]) -> 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;
......
......@@ -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,
......@@ -137,6 +138,11 @@ pub fn parse(args: &[String]) -> Flags {
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(
......@@ -618,6 +624,7 @@ pub fn parse(args: &[String]) -> Flags {
.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"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册