-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow Remove item operation to match on specified metadata instead of just item identity #4997
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
This allows users to import and map metadata between two or more item types.
|
This would be readily useful in #4931 |
|
Another interesting scenario would be when the two items have differing metadata names that need to match. Say, Remove all items from |
|
Oops, took the PR out of draft mode by mistake (thinking it was another PR). Sadly I can't find the option to make it a draft again. Ah well. |
… adding match on metadata tests
|
@cdmihai a few notes about my changes:
|
|
For perf testing of evaluation, here's what I do nowadays:
|
Forgind
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.
Only a partial review.
src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupIntrinsicTask.cs
Outdated
Show resolved
Hide resolved
src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupIntrinsicTask.cs
Outdated
Show resolved
Hide resolved
src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupIntrinsicTask.cs
Outdated
Show resolved
Hide resolved
|
Thanks to @Forgind for doing some end to end testing of this along with #4931! @rainersigwald @cdmihai that PR has been rebased on top of this one so this is good to go for a final round of review. |
|
LGTM, pending comments (apparently I can't approve the PR since it was opened by me 😃) |
rainersigwald
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.
Looking nice! Many nits but overall 👍
I can't remember--is this the one we evaluated doc impact on/drafted doc changes? Or was that another PR?
src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupIntrinsicTask.cs
Outdated
Show resolved
Hide resolved
|
@rainersigwald I think I'm caught up with all the feedback other than this comment, let me know if I missed anything. I'm not aware of any pending docs changes. |
Forgind
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 think the only comment I had that I still feel pretty strongly about is unifying the ItemSpec methods. 90% of the logic is the same, so I really don't see why we should have duplicate code.
Forgind
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.
LGTM!
|
🥳 |
PR based on #4975. Merge that one in first. The changes for this PR are in 7aa753e
If you have two items
I2andI1, and you want to remove all the items fromI2that match on some metadata with items fromI1, today you have to go through some msbuild gymnastics. It would be nice to be able to express this with just one operation:<I2 Remove="@(I1)" MatchOnMetadata="M"/>.Benefits:
Example which shows the gymnastics users have to go through today (second itemgroup), and what the gymnastics would be replaced with via this PR (third itemgroup)
Output using this PR:
Specs:
MatchOnMetadatais present, then the Remove attribute must only contain one item reference@()MatchOnMetadatamay specify a single metadata:<I2 Remove="@(I1)" MatchOnMetadata="M1"/>Todos:
MatchOnMetadatacan have multiple semicolon delimited metadata namesMatchOnMetadatacan contain metadata which does not exist on the items. Nothing should match.MatchOnMetadatais present, a Remove with anything other than one item reference fails the build.%()) inMatchOnMetadataMatchOnMetadatais now a reserved msbuild keyword, project parsing should error if you do<I Include="foo" MatchOnMetadata="bar"/>