-
Notifications
You must be signed in to change notification settings - Fork 102
fix: use latest version of ucx in the WDKContent as default #411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…the default when adding usb headers
gurry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "use the UCX header from the latest version" logic implemented here is only a temporary fix right? I assume we're going to make it smart enough later to pick the right header version according to the chosen kit version, especially when we have the relevant enhancements for this in cargo-wdk. Is that understanding correct?
It's tracked in #412. The current thinking is default it to latest, but configurable in metadata in the future |
Got it. Thanks. |
fix: added new type for basic verions (major.minor) and tests
gurry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
…mprove error handling, implement from_str for TwoPartVersion type
wmmc88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! left a couple nit comments of where you could add some tracking issue comments. if you want to quickly fix up the tiny things and ping me, ill re-approve
wmmc88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the Box leak should definitely be fixed before merge. Probably can just make usb_headers fn return a Cow<'static, str>
Remember YAGNI |
test cases for bindgen_header_contents function to cover usb headers combinations updated wdk-sys build script accordingly
There was a problem hiding this comment.
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 enhances the build scripts to automatically select the latest UCX header version from the WDK content, refactors the header-path logic for reuse, and adds corresponding utility functions and tests.
- Introduces
TwoPartVersionandfind_max_version_in_directoryto detect the newest “x.y” subdirectory. - Refactors
Config::headersandbindgen_header_contentsto returnResultand propagate errors. - Extracts
sdk_library_path, implementsConfig::ucx_header, and updates UCX include logic. - Adds tests for version parsing, directory scanning, and USB header generation branches.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/wdk-sys/build.rs | Added ? to propagate errors in binding‐generation helper calls |
| crates/wdk-build/src/utils.rs | Defined TwoPartVersion, parsing, directory‐version scan, and tests |
| crates/wdk-build/src/lib.rs | Refactored headers, bindgen_header_contents, extracted helpers |
| crates/wdk-build/Cargo.toml | Added assert_fs as a dev‐dependency |
| crates/wdk-build/rust-driver-makefile.toml | Minor change to .map usage |
| .github/workflows/codeql.yml | Updated WDK installation and cleanup script |
Comments suppressed due to low confidence (3)
crates/wdk-build/src/utils.rs:415
- The doc comment mentions
BasicVersionbut the function returnsTwoPartVersion. Update the documentation to refer to the correct return type.
/// * `Some(BasicVersion)` - The maximum version found
crates/wdk-build/src/utils.rs:422
- Using
.flatten()on an iterator ofResult<DirEntry, io::Error>won’t compile becauseResultdoesn’t implementIntoIteratorforDirEntry. Consider using.filter_map(Result::ok)to skip entries that failed to read.
.flatten()
crates/wdk-build/Cargo.toml:40
- The
assert_fs.workspace = trueentry under[dev-dependencies]uses invalid TOML syntax and won’t pull in the external crate. It should be something likeassert_fs = { version = "<version>", workspace = true }or specify a version key.
assert_fs.workspace = true
krishnakumar4a4
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve added a few minor comments, primarily on the tests.
When tested with WDK Version 22621, the following bug was found -
--- stderr D:\a\windows-drivers-rs\windows-drivers-rs\crates\wdk-sys\types-input.h:53:10: fatal error: 'ucx/1.6/ucxclass.h' file not foundhttps://github.com/microsoft/windows-drivers-rs/actions/runs/15851446771/job/44685702556#step:9:1631
Instead of using version
1.6, the latest version ofucxavailable in the$WDKContentRoot\Include\10.0.26100.0\km\ucxdirectory is used.Summary of changes,
ucx_header_pathfunction inimpl Configthat determines the latest version of UCX header in the directory.utils::find_max_version_in_directoryfunction to find the max version in a directory that contains folders of the formx.ywhere x and y are validu32s.windows_sdk_library_pathconstruction into toarch_sdk_library_pathfor reusability.