Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/rustsec/audit-check-2
Browse files Browse the repository at this point in the history
  • Loading branch information
wmmc88 authored Oct 10, 2024
2 parents aace35b + 51481b3 commit 04b9d70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/wdk-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ clap = { workspace = true, features = ["derive"] }
clap-cargo.workspace = true
lazy_static.workspace = true
paste.workspace = true
rustversion.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/wdk-build/src/cargo_make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl ParseCargoArgs for CompilationOptions {
);
}

configure_wdf_build_output_dir(target, &cargo_make_cargo_profile);
configure_wdf_build_output_dir(target.as_ref(), &cargo_make_cargo_profile);

if let Some(timings_option) = &timings {
timings_option.as_ref().map_or_else(
Expand Down Expand Up @@ -1007,7 +1007,7 @@ pub fn package_driver_flow_condition_script() -> anyhow::Result<()> {
})
}

fn configure_wdf_build_output_dir(target_arg: &Option<String>, cargo_make_cargo_profile: &str) {
fn configure_wdf_build_output_dir(target_arg: Option<&String>, cargo_make_cargo_profile: &str) {
let cargo_make_crate_custom_triple_target_directory =
env::var(CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY_ENV_VAR).unwrap_or_else(|_| {
panic!(
Expand Down
9 changes: 9 additions & 0 deletions crates/wdk-build/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,21 @@ pub fn detect_cpu_architecture_in_build_script() -> CpuArchitecture {

/// Validates that a given string matches the WDK version format (10.xxx.yyy.zzz
/// where xxx, yyy, and zzz are numeric and not necessarily 3 digits long).
#[rustversion::attr(
nightly,
allow(
clippy::nonminimal_bool,
reason = "is_some_or is not stable until 1.82.0 is released on 10/17/24"
)
)]
pub fn validate_wdk_version_format<S: AsRef<str>>(version_string: S) -> bool {
let version = version_string.as_ref();
let version_parts: Vec<&str> = version.split('.').collect();

// First, check if we have "10" as our first value
if !version_parts.first().is_some_and(|first| *first == "10") {
// FIXME: Once is_some_or is stabilized, replace the above with:
// if version_parts.first().is_none_or(|first| *first != "10") {
return false;
}

Expand Down

0 comments on commit 04b9d70

Please sign in to comment.