mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 12:12:50 +01:00
Deny on warnings in xtasks
This commit is contained in:
parent
4d3361658b
commit
2db26c1015
10 changed files with 123 additions and 58 deletions
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
|
@ -25,9 +25,6 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Fail on warnings
|
|
||||||
run: find . -type f -name lib.rs -execdir sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' {} +
|
|
||||||
|
|
||||||
- name: Cache Dependencies
|
- name: Cache Dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
@ -62,13 +59,10 @@ jobs:
|
||||||
rustup target add thumbv8m.base-none-eabi
|
rustup target add thumbv8m.base-none-eabi
|
||||||
rustup target add thumbv8m.main-none-eabi
|
rustup target add thumbv8m.main-none-eabi
|
||||||
|
|
||||||
- name: Fail on warnings
|
|
||||||
run: find . -type f -name lib.rs -execdir sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' {} +
|
|
||||||
|
|
||||||
- name: Cache Dependencies
|
- name: Cache Dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- run: cargo xtask --backend ${{ matrix.backend }} check
|
- run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} check
|
||||||
|
|
||||||
# Clippy
|
# Clippy
|
||||||
clippy:
|
clippy:
|
||||||
|
@ -101,13 +95,10 @@ jobs:
|
||||||
- name: Add Rust component clippy
|
- name: Add Rust component clippy
|
||||||
run: rustup component add clippy
|
run: rustup component add clippy
|
||||||
|
|
||||||
- name: Fail on warnings
|
|
||||||
run: find . -type f -name lib.rs -execdir sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' {} +
|
|
||||||
|
|
||||||
- name: Cache Dependencies
|
- name: Cache Dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- run: cargo xtask --backend ${{ matrix.backend }} clippy
|
- run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} clippy
|
||||||
|
|
||||||
# Verify all examples, checks
|
# Verify all examples, checks
|
||||||
checkexamples:
|
checkexamples:
|
||||||
|
@ -219,12 +210,8 @@ jobs:
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y qemu-system-arm
|
sudo apt install -y qemu-system-arm
|
||||||
|
|
||||||
- name: Fail on warnings
|
|
||||||
working-directory: ./rtic
|
|
||||||
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs
|
|
||||||
|
|
||||||
- name: Run-pass tests
|
- name: Run-pass tests
|
||||||
run: cargo xtask --backend ${{ matrix.backend }} qemu
|
run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} qemu
|
||||||
|
|
||||||
# Run test suite
|
# Run test suite
|
||||||
tests:
|
tests:
|
||||||
|
@ -260,11 +247,8 @@ jobs:
|
||||||
rustup target add thumbv8m.base-none-eabi
|
rustup target add thumbv8m.base-none-eabi
|
||||||
rustup target add thumbv8m.main-none-eabi
|
rustup target add thumbv8m.main-none-eabi
|
||||||
|
|
||||||
- name: Fail on warnings
|
|
||||||
run: find . -type f -name lib.rs -execdir sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' {} +
|
|
||||||
|
|
||||||
- name: Run cargo test
|
- name: Run cargo test
|
||||||
run: cargo xtask --backend ${{ matrix.backend }} test ${{ matrix.package }}
|
run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} test ${{ matrix.package }}
|
||||||
|
|
||||||
# Build documentation, check links
|
# Build documentation, check links
|
||||||
docs:
|
docs:
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
html_logo_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg",
|
html_logo_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg",
|
||||||
html_favicon_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg"
|
html_favicon_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg"
|
||||||
)]
|
)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use std::{env, fs, path::Path};
|
use std::{env, fs, path::Path};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
|
|
||||||
pub mod arbiter;
|
pub mod arbiter;
|
||||||
pub mod channel;
|
pub mod channel;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
html_logo_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg",
|
html_logo_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg",
|
||||||
html_favicon_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg"
|
html_favicon_url = "https://raw.githubusercontent.com/rtic-rs/rtic/master/book/en/src/RTIC.svg"
|
||||||
)]
|
)]
|
||||||
//deny_warnings_placeholder_for_ci
|
|
||||||
#![allow(clippy::inline_always)]
|
#![allow(clippy::inline_always)]
|
||||||
|
|
||||||
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
||||||
|
|
|
@ -94,7 +94,11 @@ impl Package {
|
||||||
pub struct TestMetadata {}
|
pub struct TestMetadata {}
|
||||||
|
|
||||||
impl TestMetadata {
|
impl TestMetadata {
|
||||||
pub fn match_package(package: Package, backend: Backends) -> CargoCommand<'static> {
|
pub fn match_package(
|
||||||
|
deny_warnings: bool,
|
||||||
|
package: Package,
|
||||||
|
backend: Backends,
|
||||||
|
) -> CargoCommand<'static> {
|
||||||
match package {
|
match package {
|
||||||
Package::Rtic => {
|
Package::Rtic => {
|
||||||
let features = format!(
|
let features = format!(
|
||||||
|
@ -107,32 +111,38 @@ impl TestMetadata {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features,
|
features,
|
||||||
test: Some("ui".to_owned()),
|
test: Some("ui".to_owned()),
|
||||||
|
deny_warnings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Package::RticMacros => CargoCommand::Test {
|
Package::RticMacros => CargoCommand::Test {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features: Some(backend.to_rtic_macros_feature().to_owned()),
|
features: Some(backend.to_rtic_macros_feature().to_owned()),
|
||||||
test: None,
|
test: None,
|
||||||
|
deny_warnings,
|
||||||
},
|
},
|
||||||
Package::RticSync => CargoCommand::Test {
|
Package::RticSync => CargoCommand::Test {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features: Some("testing".to_owned()),
|
features: Some("testing".to_owned()),
|
||||||
test: None,
|
test: None,
|
||||||
|
deny_warnings,
|
||||||
},
|
},
|
||||||
Package::RticCommon => CargoCommand::Test {
|
Package::RticCommon => CargoCommand::Test {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features: Some("testing".to_owned()),
|
features: Some("testing".to_owned()),
|
||||||
test: None,
|
test: None,
|
||||||
|
deny_warnings,
|
||||||
},
|
},
|
||||||
Package::RticMonotonics => CargoCommand::Test {
|
Package::RticMonotonics => CargoCommand::Test {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features: None,
|
features: None,
|
||||||
test: None,
|
test: None,
|
||||||
|
deny_warnings,
|
||||||
},
|
},
|
||||||
Package::RticTime => CargoCommand::Test {
|
Package::RticTime => CargoCommand::Test {
|
||||||
package: Some(package.name()),
|
package: Some(package.name()),
|
||||||
features: Some("critical-section/std".into()),
|
features: Some("critical-section/std".into()),
|
||||||
test: None,
|
test: None,
|
||||||
|
deny_warnings,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,6 +202,10 @@ pub enum BuildOrCheck {
|
||||||
|
|
||||||
#[derive(Parser, Clone)]
|
#[derive(Parser, Clone)]
|
||||||
pub struct Globals {
|
pub struct Globals {
|
||||||
|
/// Error out on warnings
|
||||||
|
#[arg(short = 'D', long)]
|
||||||
|
pub deny_warnings: bool,
|
||||||
|
|
||||||
/// For which backend to build.
|
/// For which backend to build.
|
||||||
#[arg(value_enum, short, default_value = "thumbv7", long, global = true)]
|
#[arg(value_enum, short, default_value = "thumbv7", long, global = true)]
|
||||||
pub backend: Option<Backends>,
|
pub backend: Option<Backends>,
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub enum CargoCommand<'a> {
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
dir: Option<PathBuf>,
|
dir: Option<PathBuf>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
ExampleBuild {
|
ExampleBuild {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
|
@ -36,6 +37,7 @@ pub enum CargoCommand<'a> {
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
dir: Option<PathBuf>,
|
dir: Option<PathBuf>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
ExampleCheck {
|
ExampleCheck {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
|
@ -43,6 +45,7 @@ pub enum CargoCommand<'a> {
|
||||||
target: Option<Target<'a>>,
|
target: Option<Target<'a>>,
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
Build {
|
Build {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
|
@ -51,6 +54,7 @@ pub enum CargoCommand<'a> {
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
dir: Option<PathBuf>,
|
dir: Option<PathBuf>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
Check {
|
Check {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
|
@ -59,6 +63,7 @@ pub enum CargoCommand<'a> {
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
dir: Option<PathBuf>,
|
dir: Option<PathBuf>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
Clippy {
|
Clippy {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
|
@ -81,6 +86,7 @@ pub enum CargoCommand<'a> {
|
||||||
package: Option<String>,
|
package: Option<String>,
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
test: Option<String>,
|
test: Option<String>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
Book {
|
Book {
|
||||||
arguments: Option<ExtraArguments>,
|
arguments: Option<ExtraArguments>,
|
||||||
|
@ -123,6 +129,7 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn details(
|
fn details(
|
||||||
|
deny_warnings: bool,
|
||||||
target: &Option<Target>,
|
target: &Option<Target>,
|
||||||
mode: Option<&BuildMode>,
|
mode: Option<&BuildMode>,
|
||||||
features: &Option<String>,
|
features: &Option<String>,
|
||||||
|
@ -150,14 +157,20 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
format!("debug")
|
format!("debug")
|
||||||
};
|
};
|
||||||
|
|
||||||
if cargoarg.is_some() && path.is_some() {
|
let deny_warnings = if deny_warnings {
|
||||||
format!("({target}, {mode}, {feat}, {carg}, {in_dir})")
|
format!("deny warnings, ")
|
||||||
} else if cargoarg.is_some() {
|
|
||||||
format!("({target}, {mode}, {feat}, {carg})")
|
|
||||||
} else if path.is_some() {
|
|
||||||
format!("({target}, {mode}, {feat}, {in_dir})")
|
|
||||||
} else {
|
} else {
|
||||||
format!("({target}, {mode}, {feat})")
|
format!("")
|
||||||
|
};
|
||||||
|
|
||||||
|
if cargoarg.is_some() && path.is_some() {
|
||||||
|
format!("({deny_warnings}{target}, {mode}, {feat}, {carg}, {in_dir})")
|
||||||
|
} else if cargoarg.is_some() {
|
||||||
|
format!("({deny_warnings}{target}, {mode}, {feat}, {carg})")
|
||||||
|
} else if path.is_some() {
|
||||||
|
format!("({deny_warnings}{target}, {mode}, {feat}, {in_dir})")
|
||||||
|
} else {
|
||||||
|
format!("({deny_warnings}{target}, {mode}, {feat})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +186,7 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"Run example {example} {}",
|
"Run example {example} {}",
|
||||||
details(target, Some(mode), features, cargoarg, dir.as_ref())
|
details(false, target, Some(mode), features, cargoarg, dir.as_ref())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
CargoCommand::Qemu {
|
CargoCommand::Qemu {
|
||||||
|
@ -183,8 +196,10 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
dir,
|
dir,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let details = details(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, "Run example {example} in QEMU {details}",)
|
write!(f, "Run example {example} in QEMU {details}",)
|
||||||
}
|
}
|
||||||
CargoCommand::ExampleBuild {
|
CargoCommand::ExampleBuild {
|
||||||
|
@ -194,8 +209,10 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
dir,
|
dir,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let details = details(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, "Build example {example} {details}",)
|
write!(f, "Build example {example} {details}",)
|
||||||
}
|
}
|
||||||
CargoCommand::ExampleCheck {
|
CargoCommand::ExampleCheck {
|
||||||
|
@ -204,10 +221,11 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
target,
|
target,
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
|
deny_warnings,
|
||||||
} => write!(
|
} => write!(
|
||||||
f,
|
f,
|
||||||
"Check example {example} {}",
|
"Check example {example} {}",
|
||||||
details(target, Some(mode), features, cargoarg, None)
|
details(*deny_warnings, target, Some(mode), features, cargoarg, None)
|
||||||
),
|
),
|
||||||
CargoCommand::Build {
|
CargoCommand::Build {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -216,12 +234,14 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
dir,
|
dir,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let package = p(package);
|
let package = p(package);
|
||||||
|
let warns = *deny_warnings;
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"Build {package} {}",
|
"Build {package} {}",
|
||||||
details(target, Some(mode), features, cargoarg, dir.as_ref())
|
details(warns, target, Some(mode), features, cargoarg, dir.as_ref())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,12 +252,14 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
dir,
|
dir,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let package = p(package);
|
let package = p(package);
|
||||||
|
let warns = *deny_warnings;
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"Check {package} {}",
|
"Check {package} {}",
|
||||||
details(target, Some(mode), features, cargoarg, dir.as_ref())
|
details(warns, target, Some(mode), features, cargoarg, dir.as_ref())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
CargoCommand::Clippy {
|
CargoCommand::Clippy {
|
||||||
|
@ -247,14 +269,9 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
features,
|
features,
|
||||||
deny_warnings,
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let details = details(target, None, features, cargoarg, None);
|
let details = details(*deny_warnings, target, None, features, cargoarg, None);
|
||||||
let package = p(package);
|
let package = p(package);
|
||||||
let deny_warns = if *deny_warnings {
|
write!(f, "Clippy {package} {details}")
|
||||||
format!(" (deny warnings)")
|
|
||||||
} else {
|
|
||||||
format!("")
|
|
||||||
};
|
|
||||||
write!(f, "Clippy{deny_warns} {package} {details}")
|
|
||||||
}
|
}
|
||||||
CargoCommand::Format {
|
CargoCommand::Format {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -297,14 +314,20 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
package,
|
package,
|
||||||
features,
|
features,
|
||||||
test,
|
test,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let p = p(package);
|
let p = p(package);
|
||||||
let test = test
|
let test = test
|
||||||
.clone()
|
.clone()
|
||||||
.map(|t| format!("test {t}"))
|
.map(|t| format!("test {t}"))
|
||||||
.unwrap_or("all tests".into());
|
.unwrap_or("all tests".into());
|
||||||
|
let deny_warnings = if *deny_warnings {
|
||||||
|
format!("deny warnings, ")
|
||||||
|
} else {
|
||||||
|
format!("")
|
||||||
|
};
|
||||||
let feat = feat(features);
|
let feat = feat(features);
|
||||||
write!(f, "Run {test} in {p} (features: {feat})")
|
write!(f, "Run {test} in {p} ({deny_warnings}features: {feat})")
|
||||||
}
|
}
|
||||||
CargoCommand::Book { arguments: _ } => write!(f, "Build the book"),
|
CargoCommand::Book { arguments: _ } => write!(f, "Build the book"),
|
||||||
CargoCommand::ExampleSize {
|
CargoCommand::ExampleSize {
|
||||||
|
@ -316,7 +339,7 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
arguments: _,
|
arguments: _,
|
||||||
dir,
|
dir,
|
||||||
} => {
|
} => {
|
||||||
let details = details(target, Some(mode), features, cargoarg, dir.as_ref());
|
let details = details(false, target, Some(mode), features, cargoarg, dir.as_ref());
|
||||||
write!(f, "Compute size of example {example} {details}")
|
write!(f, "Compute size of example {example} {details}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,6 +482,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -471,10 +496,12 @@ impl<'a> CargoCommand<'a> {
|
||||||
package,
|
package,
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
// Dir is exposed through `chdir`
|
|
||||||
dir: _,
|
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
// Dir is exposed through `chdir`
|
||||||
|
dir: _,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
||||||
CargoCommand::Check {
|
CargoCommand::Check {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -485,23 +512,25 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
||||||
CargoCommand::Clippy {
|
CargoCommand::Clippy {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
package,
|
package,
|
||||||
features,
|
features,
|
||||||
deny_warnings,
|
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let package = p(package);
|
let deny_warnings = if *deny_warnings {
|
||||||
let extra = if *deny_warnings {
|
vec!["--", "-D", "warnings"]
|
||||||
vec!["--", "-D", "warnings"].into_iter()
|
|
||||||
} else {
|
} else {
|
||||||
vec![].into_iter()
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
self.build_args(true, cargoarg, features, None, package.chain(extra))
|
let extra = p(package).chain(deny_warnings);
|
||||||
|
self.build_args(true, cargoarg, features, None, extra)
|
||||||
}
|
}
|
||||||
CargoCommand::Doc {
|
CargoCommand::Doc {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -515,6 +544,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
package,
|
package,
|
||||||
features,
|
features,
|
||||||
test,
|
test,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => {
|
} => {
|
||||||
let extra = if let Some(test) = test {
|
let extra = if let Some(test) = test {
|
||||||
vec!["--test", test]
|
vec!["--test", test]
|
||||||
|
@ -564,6 +595,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -578,6 +611,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
mode,
|
mode,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
|
// deny_warnings is exposed through `rustflags`
|
||||||
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -632,6 +667,27 @@ impl<'a> CargoCommand<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rustflags(&self) -> Option<&str> {
|
||||||
|
match self {
|
||||||
|
// Clippy is a special case: it sets deny warnings
|
||||||
|
// through an argument to rustc.
|
||||||
|
CargoCommand::Clippy { .. } => 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, .. } => {
|
||||||
|
if *deny_warnings {
|
||||||
|
Some("-D warnings")
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn print_stdout_intermediate(&self) -> bool {
|
pub fn print_stdout_intermediate(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::ExampleSize { .. } => true,
|
Self::ExampleSize { .. } => true,
|
||||||
|
|
|
@ -172,6 +172,7 @@ pub fn cargo<'c>(
|
||||||
features,
|
features,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: None,
|
dir: None,
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
BuildOrCheck::Build => CargoCommand::Build {
|
BuildOrCheck::Build => CargoCommand::Build {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -180,6 +181,7 @@ pub fn cargo<'c>(
|
||||||
features,
|
features,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: None,
|
dir: None,
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,6 +211,7 @@ pub fn cargo_usage_example(
|
||||||
package: None,
|
package: None,
|
||||||
target: None,
|
target: None,
|
||||||
features: None,
|
features: None,
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
BuildOrCheck::Build => CargoCommand::Build {
|
BuildOrCheck::Build => CargoCommand::Build {
|
||||||
cargoarg: &None,
|
cargoarg: &None,
|
||||||
|
@ -217,6 +220,7 @@ pub fn cargo_usage_example(
|
||||||
features: None,
|
features: None,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(path.into()),
|
dir: Some(path.into()),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
(globals, command, false)
|
(globals, command, false)
|
||||||
|
@ -244,6 +248,7 @@ pub fn cargo_example<'c>(
|
||||||
target: Some(backend.to_target()),
|
target: Some(backend.to_target()),
|
||||||
features,
|
features,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
BuildOrCheck::Build => CargoCommand::ExampleBuild {
|
BuildOrCheck::Build => CargoCommand::ExampleBuild {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -252,6 +257,7 @@ pub fn cargo_example<'c>(
|
||||||
features,
|
features,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: Some(PathBuf::from("./rtic")),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
(globals, command, false)
|
(globals, command, false)
|
||||||
|
@ -337,7 +343,10 @@ pub fn cargo_test<'c>(
|
||||||
) -> Vec<FinalRunResult<'c>> {
|
) -> Vec<FinalRunResult<'c>> {
|
||||||
package
|
package
|
||||||
.packages()
|
.packages()
|
||||||
.map(|p| (globals, TestMetadata::match_package(p, backend), false))
|
.map(|p| {
|
||||||
|
let meta = TestMetadata::match_package(globals.deny_warnings, p, backend);
|
||||||
|
(globals, meta, false)
|
||||||
|
})
|
||||||
.run_and_coalesce()
|
.run_and_coalesce()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +387,7 @@ pub fn qemu_run_examples<'c>(
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: Some(PathBuf::from("./rtic")),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
let cmd_qemu = CargoCommand::Qemu {
|
let cmd_qemu = CargoCommand::Qemu {
|
||||||
|
@ -387,6 +397,7 @@ pub fn qemu_run_examples<'c>(
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: Some(PathBuf::from("./rtic")),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
into_iter([cmd_build, cmd_qemu])
|
into_iter([cmd_build, cmd_qemu])
|
||||||
|
@ -417,7 +428,9 @@ pub fn build_and_check_size<'c>(
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
dir: Some(PathBuf::from("./rtic")),
|
dir: Some(PathBuf::from("./rtic")),
|
||||||
|
deny_warnings: globals.deny_warnings,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(err) = command_parser(globals, &cmd, false) {
|
if let Err(err) = command_parser(globals, &cmd, false) {
|
||||||
error!("{err}");
|
error!("{err}");
|
||||||
}
|
}
|
||||||
|
@ -455,6 +468,10 @@ fn run_command(
|
||||||
process.current_dir(dir.canonicalize()?);
|
process.current_dir(dir.canonicalize()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(rustflags) = command.rustflags() {
|
||||||
|
process.env("RUSTFLAGS", rustflags);
|
||||||
|
}
|
||||||
|
|
||||||
let result = process.output()?;
|
let result = process.output()?;
|
||||||
|
|
||||||
let exit_status = result.status;
|
let exit_status = result.status;
|
||||||
|
|
Loading…
Reference in a new issue