diff options
Diffstat (limited to 'src/bootstrap/flags.rs')
| -rw-r--r-- | src/bootstrap/flags.rs | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 516be6a30c2..fb380af0a47 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -31,9 +31,10 @@ pub struct Flags { pub incremental: bool, pub exclude: Vec<PathBuf>, pub rustc_error_format: Option<String>, + pub json_output: bool, pub dry_run: bool, - // This overrides the deny-warnings configuation option, + // This overrides the deny-warnings configuration option, // which passes -Dwarnings to the compiler invocations. // // true => deny, false => warn @@ -86,6 +87,9 @@ pub enum Subcommand { Install { paths: Vec<PathBuf>, }, + Run { + paths: Vec<PathBuf>, + }, } impl Default for Subcommand { @@ -102,17 +106,18 @@ impl Flags { Usage: x.py <subcommand> [options] [<paths>...] Subcommands: - build Compile either the compiler or libraries - check Compile either the compiler or libraries, using cargo check + build, b Compile either the compiler or libraries + check, c Compile either the compiler or libraries, using cargo check clippy Run clippy (uses rustup/cargo-installed clippy binary) fix Run cargo fix fmt Run rustfmt - test Build and run some test suites + test, t Build and run some test suites bench Build and run some benchmarks doc Build documentation clean Clean out build directories dist Build distribution artifacts install Install distribution artifacts + run, r Run tools contained in this repository To learn more about a subcommand, run `./x.py <subcommand> -h`", ); @@ -152,6 +157,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`", "VALUE", ); opts.optopt("", "error-format", "rustc error format", "FORMAT"); + opts.optflag("", "json-output", "use message-format=json"); opts.optopt( "", "llvm-skip-rebuild", @@ -178,16 +184,21 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`", // there on out. let subcommand = args.iter().find(|&s| { (s == "build") + || (s == "b") || (s == "check") + || (s == "c") || (s == "clippy") || (s == "fix") || (s == "fmt") || (s == "test") + || (s == "t") || (s == "bench") || (s == "doc") || (s == "clean") || (s == "dist") || (s == "install") + || (s == "run") + || (s == "r") }); let subcommand = match subcommand { Some(s) => s, @@ -203,7 +214,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`", // Some subcommands get extra options match subcommand.as_str() { - "test" => { + "test" | "t" => { opts.optflag("", "no-fail-fast", "Run all tests regardless of failure"); opts.optmulti("", "test-args", "extra arguments", "ARGS"); opts.optmulti( @@ -278,7 +289,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`", } // Extra help text for some commands match subcommand.as_str() { - "build" => { + "build" | "b" => { subcommand_help.push_str( "\n Arguments: @@ -305,7 +316,7 @@ Arguments: Once this is done, build/$ARCH/stage1 contains a usable compiler.", ); } - "check" => { + "check" | "c" => { subcommand_help.push_str( "\n Arguments: @@ -355,11 +366,11 @@ Arguments: ./x.py fmt --check", ); } - "test" => { + "test" | "t" => { subcommand_help.push_str( "\n Arguments: - This subcommand accepts a number of paths to directories to tests that + This subcommand accepts a number of paths to test directories that should be compiled and run. For example: ./x.py test src/test/ui @@ -372,6 +383,10 @@ Arguments: just like `build src/libstd --stage N` it tests the compiler produced by the previous stage. + Execute tool tests with a tool name argument: + + ./x.py test tidy + If no arguments are passed then the complete artifacts for that stage are compiled and tested. @@ -396,6 +411,18 @@ Arguments: ./x.py doc --stage 1", ); } + "run" | "r" => { + subcommand_help.push_str( + "\n +Arguments: + This subcommand accepts a number of paths to tools to build and run. For + example: + + ./x.py run src/tool/expand-yaml-anchors + + At least a tool needs to be called.", + ); + } _ => {} }; // Get any optional paths which occur after the subcommand @@ -430,11 +457,11 @@ Arguments: } let cmd = match subcommand.as_str() { - "build" => Subcommand::Build { paths }, - "check" => Subcommand::Check { paths }, + "build" | "b" => Subcommand::Build { paths }, + "check" | "c" => Subcommand::Check { paths }, "clippy" => Subcommand::Clippy { paths }, "fix" => Subcommand::Fix { paths }, - "test" => Subcommand::Test { + "test" | "t" => Subcommand::Test { paths, bless: matches.opt_present("bless"), compare_mode: matches.opt_str("compare-mode"), @@ -464,6 +491,13 @@ Arguments: "fmt" => Subcommand::Format { check: matches.opt_present("check") }, "dist" => Subcommand::Dist { paths }, "install" => Subcommand::Install { paths }, + "run" | "r" => { + if paths.is_empty() { + println!("\nrun requires at least a path!\n"); + usage(1, &opts, &subcommand_help, &extra_help); + } + Subcommand::Run { paths } + } _ => { usage(1, &opts, &subcommand_help, &extra_help); } @@ -475,6 +509,7 @@ Arguments: dry_run: matches.opt_present("dry-run"), on_fail: matches.opt_str("on-fail"), rustc_error_format: matches.opt_str("error-format"), + json_output: matches.opt_present("json-output"), keep_stage: matches .opt_strs("keep-stage") .into_iter() |
