Skip to content

Added buildTransitive assets group to allow flowing build assets transitively - #2667

Merged
jainaashish merged 3 commits into
devfrom
dev-asja-fix6091
Jan 25, 2019
Merged

jainaashish merged 3 commits into
devfrom
dev-asja-fix6091

Conversation

@jainaashish

@jainaashish jainaashish commented Jan 3, 2019 •

Copy link
Copy Markdown

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 PrivateAssets for 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 called buildTransitive which means assets inside this folder will flow transitively and existing folder build still 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:

@jainaashish jainaashish changed the title [wip] Added buildTransitive assets group to allow flowing build assets transitively Added buildTransitive assets group to allow flowing build assets transitively Jan 10, 2019
@jainaashish jainaashish assigned zivkan and unassigned zivkan Jan 10, 2019
@jainaashish

Copy link
Copy Markdown
Author

@NuGet/nuget-client 🔔

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you remind why we need to do this again?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's no scenario where they'd be different?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you need the && build here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

},
pathPatterns: new PatternDefinition[]
{
new PatternDefinition("buildTransitive/{tfm}/{msbuild}", table: DotnetAnyTable),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👏
An overdue addition.

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.

3 participants