xtask: Do not add rtic features to all workspace crates

This commit is contained in:
Henrik Tjäder 2023-02-24 01:05:21 +01:00
parent 60bd09117d
commit bb8621f2d7

View file

@ -386,18 +386,34 @@ 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 packages_to_check = package_filter(package);
let features: Option<&str> = Some(&s); if packages_to_check.contains(&"rtic".to_owned()) {
command_parser( // rtic crate has features which needs special handling
&CargoCommand::Build { let s = format!("{},{}", DEFAULT_FEATURES, backend.to_rtic_feature());
cargoarg, let features: Option<&str> = Some(&s);
package: package_filter(package),
target: backend.to_target(), command_parser(
features, &CargoCommand::Build {
mode: BuildMode::Release, cargoarg,
}, package: packages_to_check,
false, target: backend.to_target(),
)?; features,
mode: BuildMode::Release,
},
false,
)?;
} else {
command_parser(
&CargoCommand::Build {
cargoarg,
package: package_filter(package),
target: backend.to_target(),
features: None,
mode: BuildMode::Release,
},
false,
)?;
}
Ok(()) Ok(())
} }
@ -406,17 +422,32 @@ 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 packages_to_check = package_filter(package);
let features: Option<&str> = Some(&s); if packages_to_check.contains(&"rtic".to_owned()) {
command_parser( // rtic crate has features which needs special handling
&CargoCommand::Check { let s = format!("{},{}", DEFAULT_FEATURES, backend.to_rtic_feature());
cargoarg, let features: Option<&str> = Some(&s);
package: package_filter(package),
target: backend.to_target(), command_parser(
features, &CargoCommand::Check {
}, cargoarg,
false, package: package_filter(package),
)?; target: backend.to_target(),
features,
},
false,
)?;
} else {
command_parser(
&CargoCommand::Check {
cargoarg,
package: package_filter(package),
target: backend.to_target(),
features: None,
},
false,
)?;
}
Ok(()) Ok(())
} }
@ -425,15 +456,32 @@ fn cargo_clippy(
package: &Package, package: &Package,
backend: Backends, backend: Backends,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
command_parser( let packages_to_check = package_filter(package);
&CargoCommand::Clippy { if packages_to_check.contains(&"rtic".to_owned()) {
cargoarg, // rtic crate has features which needs special handling
package: package_filter(package), let s = format!("{},{}", DEFAULT_FEATURES, backend.to_rtic_feature());
target: backend.to_target(), let features: Option<&str> = Some(&s);
features: None,
}, command_parser(
false, &CargoCommand::Clippy {
)?; cargoarg,
package: package_filter(package),
target: backend.to_target(),
features,
},
false,
)?;
} else {
command_parser(
&CargoCommand::Clippy {
cargoarg,
package: package_filter(package),
target: backend.to_target(),
features: None,
},
false,
)?;
}
Ok(()) Ok(())
} }