Skip to content
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

Add support for transitive framework references #3221

Merged
merged 7 commits into from
May 14, 2019

Conversation

dsplaisted
Copy link
Member

Fixes dotnet/cli#10666

@dsplaisted dsplaisted requested review from nguerrera and a team May 9, 2019 23:25
@@ -1103,6 +1108,17 @@ private void WriteTransitiveProjectReferences()
}
}

private void WriteFrameworkReferences()
{
foreach (var library in _runtimeTarget.Libraries)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a DisableTransitiveFrameworkReferences here to match the DisableTransitiveProjectReferences. Also, I think we should dedupe here like we do for framework assemblies. Better to keep the cache small than to dedupe in targets afterwards.

Finally, if transitive framework references are disabled, we should change resolve framework references to not download all packs.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nguerrera I'm not sure there's value in opting out of transitive FrameworkReferences. There's no split between compile and runtime assets for framework references, so disabling transitive framework references would either have no effect (since you already have the same direct references), or would break your app at runtime (since the framework your dependency needs isn't written to the runtimeconfig).

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd still like there to be an escape hatch.

<_TransitiveFrameworkReferenceToResolve Include="@(TransitiveFrameworkReferences->Distinct())"/>
<_TransitiveFrameworkReferenceToResolve Remove="@(FrameworkReference)" />

<FrameworkReference Include="@(_TransitiveFrameworkReferenceToResolve)" />
Copy link
Contributor

Choose a reason for hiding this comment

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

After deduping in C#, I think this could be:

Suggested change
<FrameworkReference Include="@(_TransitiveFrameworkReferenceToResolve)" />
<FrameworkReference Include="@(TransitiveFrameworkReferences)" Exclude="@(FrameworkReference)" />

@dsplaisted dsplaisted force-pushed the transitive-framework-references branch from 963676a to 1e55736 Compare May 10, 2019 20:01
}
if (!frameworkReferences.Contains(frameworkReference))
{
frameworkReferences.Add(frameworkReference);
Copy link
Contributor

Choose a reason for hiding this comment

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

What did we decide about case sensitivity of framework references?


// Currently there are only 2 different frameworks that we expect to
// show up as framework references, so use a list here instead of a
// HashSet
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd just use a HashSet, I don't think it will be much worse for 2 elements (looks like it will be backed by 3 element Slot struct array) and then we don't need to think hard about this every time we come across the O(N^2) here. Unless we've measured meaningful gain, I prefer the natural data structure that scales than one that needs a comment like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, but we probably want the order to be deterministic, meaning we'd need SortedSet or a List AND a HashSet.... Less sure now.

Copy link
Member Author

Choose a reason for hiding this comment

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

I implemented it the same way other similar methods work: the HashSet keeps track of items for which you've already called WriteItem

@@ -151,3 +149,33 @@ jobs:
BuildConfig: $(_BuildConfig)
BlobFeedUrl: $(PB_PublishBlobFeedUrl)
PublishType: $(_PublishType)

- task: PublishTestResults@1
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be needed. It is done by arcade. Any reason why you are adding it back?

Copy link
Member Author

Choose a reason for hiding this comment

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

Arcade doesn't give you meaningful names for the test results or the zip files. See here for example:

image

There's discussion of this on this arcade PR: dotnet/arcade#2525. I made a similar change to core-sdk here: dotnet/installer#1609

@dsplaisted dsplaisted force-pushed the transitive-framework-references branch from 4639b1e to 5032fcc Compare May 11, 2019 00:18
@dsplaisted
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dsplaisted dsplaisted force-pushed the transitive-framework-references branch from 5032fcc to 4d31c70 Compare May 13, 2019 23:33
@dsplaisted
Copy link
Member Author

@nguerrera @livarcocc This is passing now, does anyone want to sign off on it?

@dsplaisted dsplaisted merged commit bb764de into dotnet:master May 14, 2019
dsplaisted pushed a commit to dsplaisted/sdk that referenced this pull request Feb 19, 2020
….6 (dotnet#3221)

- Microsoft.DotNet.Cli.Runtime - 3.1.100-preview2.19517.6
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.

Automatically reference shared frameworks from dependencies
3 participants