Repository navigation
Added buildTransitive assets group to allow flowing build assets transitively - #2667
Conversation
8a32f97 to
c90355a
Compare
|
@NuGet/nuget-client 🔔 |
nkolev92
left a comment
There was a problem hiding this comment.
A few questions, but looks great for the most part.
I have created a docs issue. https://github.com/NuGet/Home/issues/7726
| // filter any build asset already being added as part of build transitive | ||
| var filteredBuildGroup = GetBuildItemsForPackageId(buildGroup, library.Name). | ||
| Where(buildItem => !filteredBTGroup.Any( | ||
| btItem => Path.GetFileName(btItem.Path).Equals(Path.GetFileName(buildItem.Path), StringComparison.OrdinalIgnoreCase))); |
There was a problem hiding this comment.
Can you remind why we need to do this again?
There was a problem hiding this comment.
because /buildTransitive assets will be duplicated in /build folder as well (for PC compatibility) and we don't want to add the same asset from both folders.
There was a problem hiding this comment.
There's no scenario where they'd be different?
There was a problem hiding this comment.
Suppose packageA has
/buildTransitive/packageA.props
/build/packageA.props and /build/packageA.targets`
Now, in the consuming project, it will be /buildTransitive/packageA.props and /build/packageA.targets. We dont want /build/packageA.props` as well hence this filtering.
Hope this clarifies!
There was a problem hiding this comment.
Yeah, makes sense.
Basically there is no scenario where that's the wanted experience.
I'm fine with the change as is.
|
|
||
| if ((dependencyType & LibraryIncludeFlags.Build) == LibraryIncludeFlags.None) | ||
| if ((dependencyType & LibraryIncludeFlags.BuildTransitive) == LibraryIncludeFlags.None && | ||
| (dependencyType & LibraryIncludeFlags.Build) == LibraryIncludeFlags.None) |
There was a problem hiding this comment.
Do you need the && build here?
There was a problem hiding this comment.
You seem to have a test here.
https://github.com/NuGet/NuGet.Client/pull/2667/files#diff-b5fc9c4873b83ec596c278b4b6a7fb93R268 and I found that you were handling that case here https://github.com/NuGet/NuGet.Client/pull/2667/files#diff-d43b8c1e0e4c5dbc97ca65932c8856f7R60.
Disregard the above concern, but I'd leave comment so that it's easier to follow.
| }, | ||
| pathPatterns: new PatternDefinition[] | ||
| { | ||
| new PatternDefinition("buildTransitive/{tfm}/{msbuild}", table: DotnetAnyTable), |
There was a problem hiding this comment.
We should probably be using any table for both of these.
DotnetAnyTable just applies any to netframework, but that's a separate issue I guess.
c90355a to
fe628a2
Compare
Bug
Fixes: NuGet/Home#6091
Regression: Yes/No
If Regression then when did it last work:
If Regression then how are we preventing it in future:
Fix
Details: Currently build assets from packages or projects don't flow transitively by default. But package consumer has a way to override this behavior by updating
PrivateAssetsfor their dependencies while packing their own package or make a transitive dependency as direct to consume their respective build assets. But there is no way for package authors to indicate consumers that their packages build assets should flow transitively or not. This PR allows Package authors to communicate their build assets status by introducing another folder calledbuildTransitivewhich means assets inside this folder will flow transitively and existing folderbuildstill continue to be non-transitive.More details at spec - https://github.com/NuGet/Home/wiki/Allow-package--authors-to-define-build-assets-transitive-behavior
Testing/Validation
Tests Added: Yes
Reason for not adding tests:
Validation done: