summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/flags.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
commit3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch)
treedaf049b282ab10e8c3d03e409b3cd84ff3f7690c /src/bootstrap/flags.rs
parentAdding debian version 1.68.2+dfsg1-1. (diff)
downloadrustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz
rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bootstrap/flags.rs')
-rw-r--r--src/bootstrap/flags.rs34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 52c3dc0bf..9d1504c34 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -80,6 +80,10 @@ pub struct Flags {
pub llvm_profile_generate: bool,
pub llvm_bolt_profile_generate: bool,
pub llvm_bolt_profile_use: Option<String>,
+
+ /// Arguments appearing after `--` to be forwarded to tools,
+ /// e.g. `--fix-broken` or test arguments.
+ pub free_args: Option<Vec<String>>,
}
#[derive(Debug)]
@@ -124,6 +128,7 @@ pub enum Subcommand {
fail_fast: bool,
doc_tests: DocTests,
rustfix_coverage: bool,
+ only_modified: bool,
},
Bench {
paths: Vec<PathBuf>,
@@ -156,6 +161,12 @@ impl Default for Subcommand {
impl Flags {
pub fn parse(args: &[String]) -> Flags {
+ let (args, free_args) = if let Some(pos) = args.iter().position(|s| s == "--") {
+ let (args, free) = args.split_at(pos);
+ (args, Some(free[1..].to_vec()))
+ } else {
+ (args, None)
+ };
let mut subcommand_help = String::from(
"\
Usage: x.py <subcommand> [options] [<paths>...]
@@ -301,6 +312,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
opts.optflag("", "doc", "only run doc tests");
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
opts.optflag("", "force-rerun", "rerun tests even if the inputs are unchanged");
+ opts.optflag("", "only-modified", "only run tests that result has been changed");
opts.optopt(
"",
"compare-mode",
@@ -542,7 +554,8 @@ Arguments:
Kind::Setup => {
subcommand_help.push_str(&format!(
"\n
-x.py setup creates a `config.toml` which changes the defaults for x.py itself.
+x.py setup creates a `config.toml` which changes the defaults for x.py itself,
+as well as setting up a git pre-push hook, VS code config and toolchain link.
Arguments:
This subcommand accepts a 'profile' to use for builds. For example:
@@ -552,7 +565,13 @@ Arguments:
The profile is optional and you will be prompted interactively if it is not given.
The following profiles are available:
-{}",
+{}
+
+ To only set up the git hook, VS code or toolchain link, you may use
+ ./x.py setup hook
+ ./x.py setup vscode
+ ./x.py setup link
+",
Profile::all_for_help(" ").trim_end()
));
}
@@ -598,6 +617,7 @@ Arguments:
rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"),
rustfix_coverage: matches.opt_present("rustfix-coverage"),
+ only_modified: matches.opt_present("only-modified"),
doc_tests: if matches.opt_present("doc") {
DocTests::Only
} else if matches.opt_present("no-doc") {
@@ -625,7 +645,7 @@ Arguments:
}
Kind::Setup => {
let profile = if paths.len() > 1 {
- eprintln!("\nerror: At most one profile can be passed to setup\n");
+ eprintln!("\nerror: At most one option 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(
@@ -706,6 +726,7 @@ Arguments:
llvm_profile_generate: matches.opt_present("llvm-profile-generate"),
llvm_bolt_profile_generate: matches.opt_present("llvm-bolt-profile-generate"),
llvm_bolt_profile_use: matches.opt_str("llvm-bolt-profile-use"),
+ free_args,
}
}
}
@@ -777,6 +798,13 @@ impl Subcommand {
}
}
+ pub fn only_modified(&self) -> bool {
+ match *self {
+ Subcommand::Test { only_modified, .. } => only_modified,
+ _ => false,
+ }
+ }
+
pub fn force_rerun(&self) -> bool {
match *self {
Subcommand::Test { force_rerun, .. } => force_rerun,