Skip to content

feat(cargo-wdk): add --target-platform option to the build command - #683

Merged
Shravan Vasista (svasista-ms) merged 15 commits into
microsoft:mainfrom
svasista-ms:infverif-mode
Jul 21, 2026
Merged

feat(cargo-wdk): add --target-platform option to the build command#683
Shravan Vasista (svasista-ms) merged 15 commits into
microsoft:mainfrom
svasista-ms:infverif-mode

Conversation

@svasista-ms

@svasista-ms Shravan Vasista (svasista-ms) commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Pull request overview

Adds an explicit --target-platform switch to cargo wdk build so users can control which InfVerif validation mode is used when verifying the pacakge's INF.

The option mirrors the Target Platform setting in Visual Studio (Configuration Properties → Driver Settings):

--target-platform InfVerif mode Validates against
desktop /h WHQL signature requirements
universal (default) /u Universal driver requirements
windows-driver /w Windows Driver requirements

Changes

  • Introduces the --target-platform CLI argument (kebab-case, case-insensitive) and plumbs it through BuildAction into PackageTask.
  • Adds a TargetPlatform enum that maps each platform to its InfVerif mode flag.
  • Updates the tests and README.

⚠️ Behavior change

When --target-platform is not specified, the InfVerif mode now defaults to universal (/u) for all driver models, matching the Visual Studio's defaults.

Previously the mode was derived from the driver model (KMDF/WDM/w, UMDF/u). KMDF/WDM drivers built without the new flag will now be validated with /u instead of /w. To retain the previous validation, pass --target-platform windows-driver.

Notes

  • InfVerif accepts only one mode at a time, so --target-platform selects exactly one.
  • Support for additional InfVerif switches (e.g. /rulever, /wbuild) via an --infverif-args passthrough is intentionally deferred to a follow-up PR, where it can include validation to prevent specifying multiple modes.

Screenshots

image

Resolves #490.

Copilot AI review requested due to automatic review settings June 17, 2026 06:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an explicit --target-platform switch to cargo wdk build so users can control which InfVerif mode flag is used (/h, /u, /w), addressing the “Desktop drivers need /h” scenario from #490.

Changes:

  • Introduces --target-platform CLI argument and plumbs it through BuildAction into PackageTask.
  • Adds a TargetPlatform enum and uses it to select the infverif mode flag (with UMDF default behavior conditional on detected WDK build number).
  • Updates tests and README documentation to cover the new option and the default derivation logic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
crates/cargo-wdk/src/cli.rs Adds --target-platform parsing and maps CLI enum to internal TargetPlatform.
crates/cargo-wdk/src/actions/build/mod.rs Threads target_platform through build action params into packaging.
crates/cargo-wdk/src/actions/build/package_task.rs Implements TargetPlatform and uses it to select InfVerif mode flag; adds UMDF build-number-based default and tests.
crates/cargo-wdk/src/actions/build/tests.rs Extends build-action tests to cover overriding InfVerif mode via target_platform.
crates/cargo-wdk/README.md Documents the new flag and how default InfVerif mode is derived.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/cargo-wdk/src/actions/build/tests.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/README.md Outdated
@svasista-ms Shravan Vasista (svasista-ms) changed the title feat: add --target-platform option to build command to set InfVerif mode feat(cargo-wdk): add --target-platform option to build command to set InfVerif mode Jun 17, 2026
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.42%. Comparing base (a96fd81) to head (c085483).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #683      +/-   ##
==========================================
+ Coverage   79.93%   80.42%   +0.48%     
==========================================
  Files          26       26              
  Lines        5633     5721      +88     
  Branches     5633     5721      +88     
==========================================
+ Hits         4503     4601      +98     
+ Misses       1002      992      -10     
  Partials      128      128              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svasista-ms
Shravan Vasista (svasista-ms) marked this pull request as draft June 17, 2026 07:48
Copilot AI review requested due to automatic review settings June 22, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/tests.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/mod.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Signed-off-by: Gurinder Singh <gurisingh@microsoft.com>
Copilot AI review requested due to automatic review settings July 1, 2026 04:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/README.md
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/README.md
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs Outdated
@svasista-ms Shravan Vasista (svasista-ms) changed the title feat(cargo-wdk): add --target-platform option to build command to set InfVerif mode feat(cargo-wdk): add --target-platform option to the build command Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread crates/cargo-wdk/src/actions/build/package_task.rs
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
@svasista-ms
Shravan Vasista (svasista-ms) requested a review from a team July 13, 2026 04:57
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/tests.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Copilot AI review requested due to automatic review settings July 20, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

crates/cargo-wdk/src/cli.rs:123

  • The --target-platform help text is a bit ambiguous for a user discovering the flag via --help. Since this option directly selects the InfVerif validation mode (/u, /h, /w), consider stating that explicitly in the doc comment so the generated help output is self-explanatory.
    /// Driver target platform

…ctations + use default Umdf config struct + remove infverif skip range test
Copilot AI review requested due to automatic review settings July 20, 2026 12:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

crates/cargo-wdk/src/cli.rs:123

  • The --target-platform help text is a bit too terse and lacks a trailing period. Since this option directly controls which InfVerif mode flag is used, consider mentioning that in the doc comment so it shows up in --help output.
    /// Driver target platform

Comment thread crates/cargo-wdk/src/actions/build/tests.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

crates/cargo-wdk/src/actions/build/package_task.rs:35

  • The comment mentions waiting for the InfVerif /samples flag, but the code currently passes /msft for sample-class validation. This makes the workaround description misleading; consider referencing both flag names (or the generic “sample-class flag”) so it matches the behavior in run_infverif() and future maintenance is clearer.
// FIXME: This range is inclusive of 25798. Update with range end after
// `/samples` flag is added to InfVerif CLI
const MISSING_SAMPLE_FLAG_WDK_BUILD_NUMBER_RANGE: RangeFrom<u32> = 25798..;

Copilot AI review requested due to automatic review settings July 21, 2026 06:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@svasista-ms
Shravan Vasista (svasista-ms) added this pull request to the merge queue Jul 21, 2026
Merged via the queue into microsoft:main with commit 62c01dd Jul 21, 2026
276 of 277 checks passed
@svasista-ms
Shravan Vasista (svasista-ms) deleted the infverif-mode branch July 21, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo wdk build: Support InfVerif /h (Desktop Drivers) in addition to InfVerif /w (Windows Drivers)

5 participants