Skip to content
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

feat: enable CI workflows to use NuGet WDK packages #236

Open
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

svasista-ms
Copy link
Contributor

@svasista-ms svasista-ms commented Oct 14, 2024

Enables the CI pipeline to use NuGet WDK/SDK packages instead of WinGet WDK installation.
These changes allow the workflows to use multiple WDK versions in the matrix.

NOTE: The latest WDK version is installed as a NuGet package. Older versions of WDK (before v10.0.26100) still rely on WinGet. On a local computer eWDK environement can be used.

Closes #214 partially. NI WDK and LLVM still use WinGet at the moment.

Summary of changes,

  1. Added the script nuget-install-wdk.ps1 to
  • Download the specified version of NuGet WDK/SDK packages
  • Move WDK tools, signtool, certmgr, MakeCert to WDK bin directory to ensure all required binaries are under WDK Tool Root dir
  • Move ARM64 KM, UM, KMDF, UMDF headers to x64 directory (to mirror standard WDK and EWDK installations)
  • Set WDKContentRoot ENV variable to NuGet package root for the detect_wdk_content_root function to setup WDK content root path.
  1. Modified workflows to use the above script to install WDK build numbers >= 26100.

  2. Added packages.config that contains WDK packages and dependencies to be downloaded.

@@ -98,6 +98,19 @@ pub fn detect_wdk_content_root() -> Option<PathBuf> {
);
}

// If NugetWdkContentRoot is present in environment, use it
if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should be doing custom handling here for nuget since NugetWdkContentRoot doesn't exist normally for the Kit. How does building with nuget generally work in a non-rust environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand. The C samples use the Build-SampleSet.ps1 script. Adding the NugetWdkContentRoot was one of the ways to point to the NuGet pkg root. I'm not fully aware of how msbuild works with NuGet pkgs and how SxS WDK installations work.

Copy link
Collaborator

@wmmc88 wmmc88 Oct 14, 2024

Choose a reason for hiding this comment

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

I very much do not want to add new scaffolding to windows-drivers-rs when existing mechanisms exist. In order to make sure this doesn't diverge from the original kit, I think you need to find out how C/C++ WDK handles pointing to the WDKContentRoot when using the new nuget install methods. For eWDK, we check for the env vars that eWDK prompts set. For installed WDK, we look for the reg keys that the WDK installer sets. For nuget, we should use whatever mechanism DDX has for nuget for root discovery. @NateD-MSFT do you have insight/contacts for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll spin up a thread with the WDK team to ask.

crates/wdk-build/src/cargo_make.rs Outdated Show resolved Hide resolved
@@ -20,6 +20,7 @@ jobs:
matrix:
wdk:
- Microsoft.WindowsWDK.10.0.22621 # NI WDK
- Microsoft.Windows.WDK # Latest WDK
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even with nuget, we want to be able to test specific versions of the kit

@svasista-ms svasista-ms changed the title feat: enable CI workflows to use the latest NuGet WDK packages feat: enable CI workflows to use NuGet WDK packages Oct 16, 2024
WDF_DRIVER_CONFIG,
WDF_NO_HANDLE,
WDF_NO_OBJECT_ATTRIBUTES,
call_unsafe_wdf_function_binding, ntddk::DbgPrint, DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING, PDRIVER_OBJECT, ULONG, UNICODE_STRING, WCHAR, WDFDEVICE, WDFDEVICE_INIT, WDFDRIVER, WDF_DRIVER_CONFIG, WDF_NO_HANDLE, WDF_NO_OBJECT_ATTRIBUTES
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but I am curious how this reformat wasn't caught sooner by CI/other pipeline checkins.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change actually needs to be reverted? I suspect that whats going on is that:

  • cargo fmt check is only run at repo root. AFAIU, it traverses files it sees based on cargo-metadata (ie. it only looks in the workspace)
  • the mixed-package-kmdf-workspace is actually its own cargo workspace, so that cargo fmt has no idea it exists

There are some gaps in the top-level examples and tests folders where certain pipelines are not fully covering them. spent some time figuring out what gaps there are (mostly due to changes related to #186 ) and will be adding the rundown to github in a pr

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.

Port the pipelines to use the NuGet pkgs
3 participants