mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 06:54:33 +01:00
Also allow denying for QEMU, and fix the link-arg problem caused by
overriding RUSTFLAGS
This commit is contained in:
parent
2b9e8cbf1f
commit
b7e4498a71
2 changed files with 25 additions and 6 deletions
|
@ -100,6 +100,7 @@ pub enum CargoCommand<'a> {
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
arguments: Option<ExtraArguments>,
|
arguments: Option<ExtraArguments>,
|
||||||
dir: Option<PathBuf>,
|
dir: Option<PathBuf>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,8 +346,10 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
mode,
|
mode,
|
||||||
arguments: _,
|
arguments: _,
|
||||||
dir,
|
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}")
|
write!(f, "Compute size of example {example} {details}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,6 +648,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
target: _,
|
target: _,
|
||||||
// dir is exposed through `chdir`
|
// dir is exposed through `chdir`
|
||||||
dir: _,
|
dir: _,
|
||||||
|
// deny_warnings is exposed through `extra_env`
|
||||||
|
deny_warnings: _,
|
||||||
} => {
|
} => {
|
||||||
let extra = ["--example", example]
|
let extra = ["--example", example]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -688,12 +693,23 @@ impl<'a> CargoCommand<'a> {
|
||||||
// through an argument to rustc.
|
// through an argument to rustc.
|
||||||
CargoCommand::Clippy { .. } => None,
|
CargoCommand::Clippy { .. } => None,
|
||||||
CargoCommand::Doc { .. } => Some(("RUSTDOCFLAGS", "-D warnings")),
|
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::Check { deny_warnings, .. }
|
||||||
| CargoCommand::ExampleCheck { deny_warnings, .. }
|
| CargoCommand::ExampleCheck { deny_warnings, .. }
|
||||||
| CargoCommand::Build { deny_warnings, .. }
|
| CargoCommand::Build { deny_warnings, .. }
|
||||||
| CargoCommand::ExampleBuild { deny_warnings, .. }
|
| CargoCommand::Test { deny_warnings, .. } => {
|
||||||
| CargoCommand::Test { deny_warnings, .. }
|
|
||||||
| CargoCommand::Qemu { deny_warnings, .. } => {
|
|
||||||
if *deny_warnings {
|
if *deny_warnings {
|
||||||
Some(("RUSTFLAGS", "-D warnings"))
|
Some(("RUSTFLAGS", "-D warnings"))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -381,13 +381,15 @@ pub fn qemu_run_examples<'c>(
|
||||||
into_iter(examples)
|
into_iter(examples)
|
||||||
.flat_map(|example| {
|
.flat_map(|example| {
|
||||||
let target = target.into();
|
let target = target.into();
|
||||||
|
let dir = Some(PathBuf::from("./rtic"));
|
||||||
|
|
||||||
let cmd_build = CargoCommand::ExampleBuild {
|
let cmd_build = CargoCommand::ExampleBuild {
|
||||||
cargoarg: &None,
|
cargoarg: &None,
|
||||||
example,
|
example,
|
||||||
target,
|
target,
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: dir.clone(),
|
||||||
deny_warnings: globals.deny_warnings,
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -397,7 +399,7 @@ pub fn qemu_run_examples<'c>(
|
||||||
target,
|
target,
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir,
|
||||||
deny_warnings: globals.deny_warnings,
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -441,6 +443,7 @@ pub fn build_and_check_size<'c>(
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
arguments: arguments.clone(),
|
arguments: arguments.clone(),
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: Some(PathBuf::from("./rtic")),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
[cmd_build, cmd_size]
|
[cmd_build, cmd_size]
|
||||||
|
|
Loading…
Reference in a new issue