xtask: Default backend needs no argument

Propagate features for check and build
This commit is contained in:
Henrik Tjäder 2023-02-23 19:34:52 +01:00
parent 1c26eb722f
commit aa30d1d251

View file

@ -69,7 +69,7 @@ impl Backends {
struct Cli { struct Cli {
/// For which backend to build /// For which backend to build
#[arg(value_enum, short, long)] #[arg(value_enum, short, long)]
backend: Backends, backend: Option<Backends>,
/// List of comma separated examples to include, all others are excluded /// List of comma separated examples to include, all others are excluded
/// ///
@ -254,7 +254,11 @@ fn main() -> anyhow::Result<()> {
trace!("default logging level: {0}", cli.verbose); trace!("default logging level: {0}", cli.verbose);
let backend = cli.backend; let backend = if let Some(backend) = cli.backend {
backend
} else {
Backends::default()
};
let example = cli.example; let example = cli.example;
let exampleexclude = cli.exampleexclude; let exampleexclude = cli.exampleexclude;
@ -366,12 +370,14 @@ fn cargo_build(
package: &Package, package: &Package,
backend: Backends, backend: Backends,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let s = format!("{},{}", DEFAULT_FEATURES, backend.to_rtic_feature());
let features: Option<&str> = Some(&s);
command_parser( command_parser(
&CargoCommand::Build { &CargoCommand::Build {
cargoarg, cargoarg,
package: package_filter(package), package: package_filter(package),
target: backend.to_target(), target: backend.to_target(),
features: None, features,
mode: BuildMode::Release, mode: BuildMode::Release,
}, },
false, false,
@ -384,12 +390,14 @@ fn cargo_check(
package: &Package, package: &Package,
backend: Backends, backend: Backends,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let s = format!("{},{}", DEFAULT_FEATURES, backend.to_rtic_feature());
let features: Option<&str> = Some(&s);
command_parser( command_parser(
&CargoCommand::Check { &CargoCommand::Check {
cargoarg, cargoarg,
package: package_filter(package), package: package_filter(package),
target: backend.to_target(), target: backend.to_target(),
features: None, features,
}, },
false, false,
)?; )?;