feat: add feature selection options to build command#665
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends cargo wdk build with standard Cargo feature-selection flags and forwards them through the internal Cargo calls used by the build pipeline, making it easier to build driver projects with specific feature sets enabled.
Changes:
- Added
--all-features,--no-default-features, and-F/--featurestocargo wdk buildvia a newFeatureArgsstruct. - Forwarded feature-selection flags to
cargo metadata,cargo build, and thecargo rustc -- --print cfginvocation used for target-arch detection. - Refactored
BuildTask::newto take aBuildTaskParamsstruct and updated tests + README accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/cargo-wdk/src/cli.rs | Exposes feature-selection flags on the build subcommand and wires them into BuildActionParams. |
| crates/cargo-wdk/src/actions/mod.rs | Introduces FeatureArgs and a helper to emit equivalent Cargo CLI args. |
| crates/cargo-wdk/src/actions/build/mod.rs | Plumbs feature args through build orchestration, metadata, and rustc --print cfg path. |
| crates/cargo-wdk/src/actions/build/build_task.rs | Refactors BuildTask construction and forwards feature args to the cargo build invocation (with tests). |
| crates/cargo-wdk/src/actions/build/tests.rs | Updates test scaffolding to carry feature-selection args through BuildAction initialization. |
| crates/cargo-wdk/README.md | Documents the new flags and provides an example usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…e related documentation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
==========================================
+ Coverage 79.78% 79.93% +0.15%
==========================================
Files 26 26
Lines 5590 5633 +43
Branches 5590 5633 +43
==========================================
+ Hits 4460 4503 +43
- Misses 1001 1002 +1
+ Partials 129 128 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…metadata feature Enabling the cargo_metadata feature on clap-cargo adds cargo_metadata, serde, and serde_json as transitive deps. The cargo-wdk test fixtures are independent workspaces that path-depend on wdk-build (which uses clap-cargo), so their Cargo.lock files need the new transitive entries for cargo metadata --locked to succeed. This unblocks kmdf_driver_builds_successfully_with_locked_flag.
The requested changes have been already made. Dismissing requested change to unblock the merging of the PR.
|
@copilot The merge is failing due to a transient network error. Can you keep retrying the merge until it succeeds? |
Adds standard cargo feature-selection flags to
cargo wdk buildFunctional Changes
cargo wdk buildfor feature-selection.cargoinvocations:cargo metadata,cargo buildandcargo rustcResolves #434
Screenshots
cargo wdk build --helpcargo wdk build --sample --features hidonexamples/sample-kmdf-driverVerbose Output showing features flag being forwarded to the

cargo buildinvocation: