-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add SelectRuntimeIdentifierSpecificItems MSBuild task for filtering items by compatible RuntimeIdentifier #50615
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
Co-authored-by: baronfel <[email protected]>
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
… Microsoft.NET.RuntimeIdentifierInference.targets Co-authored-by: baronfel <[email protected]>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
…ations Co-authored-by: baronfel <[email protected]>
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
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 introduces a new MSBuild task SelectRuntimeIdentifierSpecificItems
that filters items based on Runtime Identifier compatibility using NuGet's runtime graph. The task enables downstream consumers to filter assets by RID compatibility rather than just equality, supporting container incrementality scenarios.
- Implements the core task with proper nullable reference type annotations
- Adds comprehensive unit tests covering compatibility filtering, exact matches, and edge cases
- Makes the task ambiently available through UsingTask declaration in targets file
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
Microsoft.NET.RuntimeIdentifierInference.targets | Adds UsingTask declaration to make the new task available to consumers |
SelectRuntimeIdentifierSpecificItems.cs | Implements the main task logic with RID compatibility filtering using RuntimeGraph |
GivenASelectRuntimeIdentifierSpecificItems.cs | Provides comprehensive unit test coverage for all task scenarios |
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
[Required] | ||
public string? RuntimeIdentifierGraphPath { get; set; } |
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.
Properties marked with [Required] should not be nullable. The MSBuild framework expects required properties to have non-null values, making the nullable annotation misleading and potentially causing confusion for consumers.
[Required] | |
public string? RuntimeIdentifierGraphPath { get; set; } | |
public string RuntimeIdentifierGraphPath { get; set; } |
Copilot uses AI. Check for mistakes.
src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenASelectRuntimeIdentifierSpecificItems.cs
Show resolved
Hide resolved
…e() directly Co-authored-by: baronfel <[email protected]>
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: baronfel <[email protected]>
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/SelectRuntimeIdentifierSpecificItems.cs
Outdated
Show resolved
Hide resolved
ccb1705
to
c3e81c1
Compare
/backport to release/10.0.1xx |
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17780051830 |
Fixes #50614
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
@baronfel note: I've reviewed and tested this PR and am happy with its semantics and coverage.