summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/flags.rs')
-rw-r--r--src/bootstrap/flags.rs56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 37a8eb884..52c3dc0bf 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -130,6 +130,7 @@ pub enum Subcommand {
test_args: Vec<String>,
},
Clean {
+ paths: Vec<PathBuf>,
all: bool,
},
Dist {
@@ -143,7 +144,7 @@ pub enum Subcommand {
args: Vec<String>,
},
Setup {
- profile: Option<Profile>,
+ profile: Option<PathBuf>,
},
}
@@ -351,22 +352,32 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
// fn usage()
let usage = |exit_code: i32, opts: &Options, verbose: bool, subcommand_help: &str| -> ! {
- let config = Config::parse(&["build".to_string()]);
- let build = Build::new(config);
- let paths = Builder::get_help(&build, subcommand);
-
println!("{}", opts.usage(subcommand_help));
- if let Some(s) = paths {
- if verbose {
+ if verbose {
+ // We have an unfortunate situation here: some Steps use `builder.in_tree_crates` to determine their paths.
+ // To determine those crates, we need to run `cargo metadata`, which means we need all submodules to be checked out.
+ // That takes a while to run, so only do it when paths were explicitly requested, not on all CLI errors.
+ // `Build::new` won't load submodules for the `setup` command.
+ let cmd = if verbose {
+ println!("note: updating submodules before printing available paths");
+ "build"
+ } else {
+ "setup"
+ };
+ let config = Config::parse(&[cmd.to_string()]);
+ let build = Build::new(config);
+ let paths = Builder::get_help(&build, subcommand);
+
+ if let Some(s) = paths {
println!("{}", s);
} else {
- println!(
- "Run `./x.py {} -h -v` to see a list of available paths.",
- subcommand.as_str()
- );
+ panic!("No paths available for subcommand `{}`", subcommand.as_str());
}
- } else if verbose {
- panic!("No paths available for subcommand `{}`", subcommand.as_str());
+ } else {
+ println!(
+ "Run `./x.py {} -h -v` to see a list of available paths.",
+ subcommand.as_str()
+ );
}
crate::detail_exit(exit_code);
};
@@ -476,13 +487,13 @@ Arguments:
This subcommand accepts a number of paths to test directories that
should be compiled and run. For example:
- ./x.py test src/test/ui
+ ./x.py test tests/ui
./x.py test library/std --test-args hash_map
./x.py test library/std --stage 0 --no-doc
- ./x.py test src/test/ui --bless
- ./x.py test src/test/ui --compare-mode chalk
+ ./x.py test tests/ui --bless
+ ./x.py test tests/ui --compare-mode chalk
- Note that `test src/test/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
+ Note that `test tests/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
just like `build library/std --stage N` it tests the compiler produced by the previous
stage.
@@ -601,14 +612,7 @@ Arguments:
open: matches.opt_present("open"),
json: matches.opt_present("json"),
},
- Kind::Clean => {
- if !paths.is_empty() {
- println!("\nclean does not take a path argument\n");
- usage(1, &opts, verbose, &subcommand_help);
- }
-
- Subcommand::Clean { all: matches.opt_present("all") }
- }
+ Kind::Clean => Subcommand::Clean { all: matches.opt_present("all"), paths },
Kind::Format => Subcommand::Format { check: matches.opt_present("check"), paths },
Kind::Dist => Subcommand::Dist { paths },
Kind::Install => Subcommand::Install { paths },
@@ -621,7 +625,7 @@ Arguments:
}
Kind::Setup => {
let profile = if paths.len() > 1 {
- println!("\nat most one profile can be passed to setup\n");
+ eprintln!("\nerror: At most one profile can be passed to setup\n");
usage(1, &opts, verbose, &subcommand_help)
} else if let Some(path) = paths.pop() {
let profile_string = t!(path.into_os_string().into_string().map_err(