aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/cargo_command.rs
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/cargo_command.rs
parent2b9e8cbf1fa53a201759f5c38c5c9f5a330d2f99 (diff)
Also allow denying for QEMU, and fix the link-arg problem caused by
overriding RUSTFLAGS
Diffstat (limited to 'xtask/src/cargo_command.rs')
-rw-r--r--xtask/src/cargo_command.rs24
1 files changed, 20 insertions, 4 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 {