mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 15:04:32 +01:00
xtask: Make target flag optional, default to all targets
This commit is contained in:
parent
0f7e0e9736
commit
81ba62787c
1 changed files with 20 additions and 15 deletions
|
@ -32,10 +32,10 @@ struct Options {
|
|||
///
|
||||
/// * thumbv7m-none-eabi
|
||||
#[structopt(short, long)]
|
||||
target: String,
|
||||
target: Option<String>,
|
||||
/// Example to run, by default all examples are run
|
||||
///
|
||||
/// Example: `cargo xtask --target <..> --example complex`
|
||||
/// Example: `cargo xtask --example complex`
|
||||
#[structopt(short, long)]
|
||||
example: Option<String>,
|
||||
/// Enables also running `cargo size` on the selected examples
|
||||
|
@ -43,7 +43,7 @@ struct Options {
|
|||
/// To pass options to `cargo size`, add `--` and then the following
|
||||
/// arguments will be passed on
|
||||
///
|
||||
/// Example: `cargo xtask --target <..> -s -- -A`
|
||||
/// Example: `cargo xtask -s -- -A`
|
||||
#[structopt(short, long)]
|
||||
size: bool,
|
||||
/// Options to pass to `cargo size`
|
||||
|
@ -147,20 +147,25 @@ fn main() -> anyhow::Result<()> {
|
|||
}
|
||||
init_build_dir()?;
|
||||
|
||||
if target == "all" {
|
||||
match target {
|
||||
None => {
|
||||
for t in targets {
|
||||
println!("Testing all targets: {targets:?}");
|
||||
run_test(t, &examples, check_size, size_arguments)?;
|
||||
}
|
||||
} else if targets.contains(&target.as_str()) {
|
||||
}
|
||||
Some(target) => {
|
||||
if targets.contains(&target.as_str()) {
|
||||
run_test(target, &examples, check_size, size_arguments)?;
|
||||
} else {
|
||||
eprintln!(
|
||||
"The target you specified is not available. Available targets are:\
|
||||
\n{targets:?}\n\
|
||||
as well as `all` (testing on all of the above)",
|
||||
\n{targets:?}\n",
|
||||
);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue