aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authordatdenkikniet <jcdra1@gmail.com>2023-04-16 14:14:49 +0200
committerdatdenkikniet <jcdra1@gmail.com>2023-04-16 14:14:49 +0200
commitb7e4498a7136041d89541bdc7725c8c023fa5c9c (patch)
treee581994359143057e456374c0ef1d41d6b9b6d73 /xtask/src
parent2b9e8cbf1fa53a201759f5c38c5c9f5a330d2f99 (diff)
Also allow denying for QEMU, and fix the link-arg problem caused by
overriding RUSTFLAGS
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/cargo_command.rs24
-rw-r--r--xtask/src/run.rs7
2 files changed, 25 insertions, 6 deletions
diff --git a/xtask/src/cargo_command.rs b/xtask/src/cargo_command.rs
index 401bab4..1d5f3c5 100644
--- a/xtask/src/cargo_command.rs
+++ b/xtask/src/cargo_command.rs
@@ -100,6 +100,7 @@ pub enum CargoCommand<'a> {
mode: BuildMode,
arguments: Option<ExtraArguments>,
dir: Option<PathBuf>,
+ deny_warnings: bool,
},
}
@@ -345,8 +346,10 @@ impl core::fmt::Display for CargoCommand<'_> {
mode,
arguments: _,
dir,
+ deny_warnings,
} => {
- let details = details(false, target, Some(mode), features, cargoarg, dir.as_ref());
+ let warns = *deny_warnings;
+ let details = details(warns, target, Some(mode), features, cargoarg, dir.as_ref());
write!(f, "Compute size of example {example} {details}")
}
}
@@ -645,6 +648,8 @@ impl<'a> CargoCommand<'a> {
target: _,
// dir is exposed through `chdir`
dir: _,
+ // deny_warnings is exposed through `extra_env`
+ deny_warnings: _,
} => {
let extra = ["--example", example]
.into_iter()
@@ -688,12 +693,23 @@ impl<'a> CargoCommand<'a> {
// through an argument to rustc.
CargoCommand::Clippy { .. } => None,
CargoCommand::Doc { .. } => Some(("RUSTDOCFLAGS", "-D warnings")),
+
+ CargoCommand::Qemu { deny_warnings, .. }
+ | CargoCommand::ExampleBuild { deny_warnings, .. }
+ | CargoCommand::ExampleSize { deny_warnings, .. } => {
+ if *deny_warnings {
+ // NOTE: this also needs the link-arg because .cargo/config.toml
+ // is ignored if you set the RUSTFLAGS env variable.
+ Some(("RUSTFLAGS", "-D warnings -C link-arg=-Tlink.x"))
+ } else {
+ None
+ }
+ }
+
CargoCommand::Check { deny_warnings, .. }
| CargoCommand::ExampleCheck { deny_warnings, .. }
| CargoCommand::Build { deny_warnings, .. }
- | CargoCommand::ExampleBuild { deny_warnings, .. }
- | CargoCommand::Test { deny_warnings, .. }
- | CargoCommand::Qemu { deny_warnings, .. } => {
+ | CargoCommand::Test { deny_warnings, .. } => {
if *deny_warnings {
Some(("RUSTFLAGS", "-D warnings"))
} else {
diff --git a/xtask/src/run.rs b/xtask/src/run.rs
index bf8d3b7..6057551 100644
--- a/xtask/src/run.rs
+++ b/xtask/src/run.rs
@@ -381,13 +381,15 @@ pub fn qemu_run_examples<'c>(
into_iter(examples)
.flat_map(|example| {
let target = target.into();
+ let dir = Some(PathBuf::from("./rtic"));
+
let cmd_build = CargoCommand::ExampleBuild {
cargoarg: &None,
example,
target,
features: features.clone(),
mode: BuildMode::Release,
- dir: Some(PathBuf::from("./rtic")),
+ dir: dir.clone(),
deny_warnings: globals.deny_warnings,
};
@@ -397,7 +399,7 @@ pub fn qemu_run_examples<'c>(
target,
features: features.clone(),
mode: BuildMode::Release,
- dir: Some(PathBuf::from("./rtic")),
+ dir,
deny_warnings: globals.deny_warnings,
};
@@ -441,6 +443,7 @@ pub fn build_and_check_size<'c>(
mode: BuildMode::Release,
arguments: arguments.clone(),
dir: Some(PathBuf::from("./rtic")),
+ deny_warnings: globals.deny_warnings,
};
[cmd_build, cmd_size]