-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[release/2.1] Add @(ProjectReference)
items for patched projects
#29037
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
@Tratcher I believe I've confirmed #29023 is a real issue but would appreciate your confirmation. With the current state of this PR, I'd expect some Kestrel tests (for example) to fail but all I see listed in the Tests tab are projects with direct Microsoft.AspNetCore.Http references. Do you agree many more tests should have failed❔ |
Lol, you intentionally broke cookies? I would not expect any kestrel tests to fail, kestrel provides values rather than consumes them. However I'm surprised I don't see any failures in Security. |
😏 |
🆗 the binary log 💯% confirmed Microsoft.AspNetCore.Http.dll was resolved from the baseline package in every project except test projects containing /fyi @dotnet/aspnet-build |
fb95fbc
to
b4f09b3
Compare
b4f09b3
to
b8c2b78
Compare
With help from @Forgind and @yuehuang010, this new target is now working. Many thanks❕ I'm going to try out a couple of tweaks locally then back out the first two commits (i.e. don't intentionally break tests) and turn this into a real PR😃 |
Note latest iteration failed many more tests than previous ones i.e. transitive references to the project I broke are no longer hiding the break from test projects and samples. |
- #29023 - ensure tests do not use baseline assemblies for projects in current patch
b8c2b78
to
2c68337
Compare
/fyi test run with the fix failed 404 tests on Windows and 322 elsewhere while run before fix failed far fewer -- 206 tests on Windows and 103 elsewhere. |
@(ProjectReference)
items for patched projects
This is |
|
||
<!-- Ignore unreferenced assemblies and directly-referenced projects. --> | ||
<_ProjectsToAdd Remove="@(_ProjectsToAdd)" /> | ||
<!-- Condition uses same Filename metadata when evaluating the other two item groups. --> |
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.
Put another way, the Condition
s here and at the end of the target use a corner case of the task batching features. Shared metadata and batching on that metadata are the keys.
<_ProjectsToAdd Remove="@(_ProjectsToAdd)" /> | ||
<!-- Condition uses same Filename metadata when evaluating the other two item groups. --> | ||
<_ProjectsToAdd Include="@(_ProjectsInPatch)" | ||
Condition=" '%(Filename)' != '' AND |
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.
What is this condition doing exactly? Add a direct reference to the projects being patched, unless...
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.
My mental model may be wrong (@Forgind and @yuehuang010, please chime in) but https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-batching?view=vs-2019#item-and-property-mutations contains some of the information
- The
%(Filename)
item metadata causes the implicitCreateItem
task to be batched - Use of that metadata also limits the
@(ResolvedCompileFileDefinitions)
and@(RuntimeCopyLocalItems)
item groups to the item(s) with the same%(Filename)
- This part doesn't seem to be explicit in the documentation
- The
OR
clause confirms at least one such item exists
At a higher level, this creates a @(_ProjectsToAdd)
item group containing those @(_ProjectsInPatch)
items that match on filename with one or more @(ResolvedCompileFileDefinitions)
or @(RuntimeCopyLocalItems)
items, excluding existing @(ProjectReference)
items. Another way of looking at it is the created item group contains the projects in the current patch that (a) aren't referenced directly but (b) match assemblies in the current build.
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 see it used in this exampled (https://docs.microsoft.com/en-us/visualstudio/msbuild/item-metadata-in-task-batching?view=vs-2019#divide-several-item-lists-into-batches). So, it is feature name is "Divide several item lists into batches":
<Target Name="ShowMessage">
<Message
Text = "Number: %(Number) -- Items in ExampColl: @(ExampColl) ExampColl2: @(ExampColl2)"/>
</Target>
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.
Good point @yuehuang010. I'm not sure how many times I read that example without thinking "Oh, this makes intersection / subsetting dead easy"😃
@wtgodbe is there a reason the aspnetcore-pr-validation-temp pipeline still exists and is still the one we require for release/2.1 merges❔ Tests failed in the first run since I got rid of the intentional break but only in that pipeline. The same tests ran fine in aspnetcore-ci. |
No, I can remove the validation-temp runs |
Originally was an attempt to demonstrate #29023