Skip to content

feat: add feature selection options to build command#665

Open
svasista-ms wants to merge 15 commits into
microsoft:mainfrom
svasista-ms:add-features-flag
Open

feat: add feature selection options to build command#665
svasista-ms wants to merge 15 commits into
microsoft:mainfrom
svasista-ms:add-features-flag

Conversation

@svasista-ms

@svasista-ms svasista-ms commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Adds standard cargo feature-selection flags to cargo wdk build

Functional Changes

  1. New CLI flags on cargo wdk build for feature-selection.
  2. Flags are forwarded to all internal cargo invocations: cargo metadata, cargo build and cargo rustc

Resolves #434

Screenshots

  1. cargo wdk build --help
image
  1. cargo wdk build --sample --features hid on examples/sample-kmdf-driver
image

Verbose Output showing features flag being forwarded to the cargo build invocation:
image

Copilot AI review requested due to automatic review settings June 8, 2026 04: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

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/--features to cargo wdk build via a new FeatureArgs struct.
  • Forwarded feature-selection flags to cargo metadata, cargo build, and the cargo rustc -- --print cfg invocation used for target-arch detection.
  • Refactored BuildTask::new to take a BuildTaskParams struct 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.

Comment thread crates/cargo-wdk/src/actions/mod.rs Outdated
Copilot AI review requested due to automatic review settings June 8, 2026 05:26

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 3 comments.

Comment thread crates/cargo-wdk/src/actions/mod.rs Outdated
Comment thread crates/cargo-wdk/src/actions/mod.rs Outdated
Comment thread crates/cargo-wdk/README.md Outdated
wmmc88
wmmc88 previously requested changes Jun 8, 2026
Comment thread crates/cargo-wdk/src/actions/mod.rs Outdated
@codecov-commenter

codecov-commenter commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.18699% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.93%. Comparing base (0e3499d) to head (9b3f8e3).

Files with missing lines Patch % Lines
crates/cargo-wdk/src/actions/build/mod.rs 96.77% 1 Missing ⚠️
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.
📢 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.

…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.
Copilot AI review requested due to automatic review settings June 9, 2026 07:03

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 7 out of 11 changed files in this pull request and generated 2 comments.

Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/actions/build/mod.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/mod.rs
Copilot AI review requested due to automatic review settings June 15, 2026 04:51

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 7 out of 11 changed files in this pull request and generated no new comments.

@svasista-ms svasista-ms requested review from gurry and wmmc88 June 17, 2026 06:38
Comment thread crates/cargo-wdk/src/actions/build/build_task.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 7 out of 11 changed files in this pull request and generated no new comments.

@gurry gurry enabled auto-merge June 22, 2026 10:00
@gurry gurry dismissed wmmc88’s stale review June 22, 2026 10:07

The requested changes have been already made. Dismissing requested change to unblock the merging of the PR.

@gurry gurry added this pull request to the merge queue Jun 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 22, 2026
@svasista-ms svasista-ms added this pull request to the merge queue Jun 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 22, 2026
@svasista-ms svasista-ms added this pull request to the merge queue Jun 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 22, 2026
@krishnakumar4a4 krishnakumar4a4 added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry

gurry commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@copilot The merge is failing due to a transient network error. Can you keep retrying the merge until it succeeds?

@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@svasista-ms svasista-ms added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@gurry gurry added this pull request to the merge queue Jun 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 24, 2026
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.

Add --features flag to cargo-wdk

6 participants