feat(cargo-wdk): add --target-platform option to the build command - #683
Conversation
There was a problem hiding this comment.
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-platformCLI argument and plumbs it throughBuildActionintoPackageTask. - Adds a
TargetPlatformenum and uses it to select theinfverifmode 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.
--target-platform option to build command to set InfVerif mode--target-platform option to build command to set InfVerif mode
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
…if mode handling + update README
…rget platform options
…ldActionParams and PackageTaskParams
Signed-off-by: Gurinder Singh <gurisingh@microsoft.com>
--target-platform option to build command to set InfVerif mode--target-platform option to the build command
There was a problem hiding this comment.
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-platformhelp 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
There was a problem hiding this comment.
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-platformhelp text is a bit too terse and lacks a trailing period. Since this option directly controls whichInfVerifmode flag is used, consider mentioning that in the doc comment so it shows up in--helpoutput.
/// Driver target platform
There was a problem hiding this comment.
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
/samplesflag, but the code currently passes/msftfor 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 inrun_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..;
… locked option tests
Pull request overview
Adds an explicit
--target-platformswitch tocargo wdk buildso users can control whichInfVerifvalidation mode is used when verifying the pacakge's INF.The option mirrors the Target Platform setting in Visual Studio (Configuration Properties → Driver Settings):
--target-platformdesktop/huniversal(default)/uwindows-driver/wChanges
--target-platformCLI argument (kebab-case, case-insensitive) and plumbs it throughBuildActionintoPackageTask.TargetPlatformenum that maps each platform to itsInfVerifmode flag.When
--target-platformis not specified, theInfVerifmode now defaults touniversal(/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/uinstead of/w. To retain the previous validation, pass--target-platform windows-driver.Notes
InfVerifaccepts only one mode at a time, so--target-platformselects exactly one.InfVerifswitches (e.g./rulever,/wbuild) via an--infverif-argspassthrough is intentionally deferred to a follow-up PR, where it can include validation to prevent specifying multiple modes.Screenshots
Resolves #490.