-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support multiple runtime packs per FrameworkReference #24873
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAResolveFrameworkReferencesTask.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| // Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using FluentAssertions; | ||
| using Microsoft.Build.Framework; | ||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Reflection; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.NET.Build.Tasks.UnitTests | ||
| { | ||
| public class GivenAResolveFrameworkReferences | ||
| { | ||
| [Fact] | ||
| public void It_resolves_with_multiple_runtime_packs() | ||
| { | ||
| var task = new ResolveFrameworkReferences | ||
| { | ||
| FrameworkReferences = new[] | ||
| { | ||
| new MockTaskItem("Microsoft.NETCore.App", new Dictionary<string, string>()), | ||
| new MockTaskItem("Microsoft.Android", new Dictionary<string, string>()), | ||
| }, | ||
|
|
||
| ResolvedTargetingPacks = new[] | ||
| { | ||
| new MockTaskItem("Microsoft.NETCore.App", | ||
| new Dictionary<string, string>() | ||
| { | ||
| {"NuGetPackageId", "Microsoft.NETCore.App.Ref"}, | ||
| {"NuGetPackageVersion", "6.0.2"}, | ||
| {"Path", "empty"}, | ||
| }), | ||
| new MockTaskItem("Microsoft.Android", | ||
| new Dictionary<string, string>() | ||
| { | ||
| {"NuGetPackageId", "Microsoft.Android.Ref.32"}, | ||
| {"NuGetPackageVersion", "32.0.300"}, | ||
| {"Path", "empty"}, | ||
| {"Profile", "Android"}, | ||
| }), | ||
| }, | ||
|
|
||
| ResolvedRuntimePacks = new[] | ||
| { | ||
| new MockTaskItem("Microsoft.NETCore.App.Runtime.Mono.android-arm", | ||
| new Dictionary<string, string>() | ||
| { | ||
| {"FrameworkName", "Microsoft.NetCore.App"}, | ||
| {"NuGetPackageId", "Microsoft.NETCore.App.Runtime.Mono.android-arm"}, | ||
| {"NuGetPackageVersion", "6.0.4"}, | ||
| {"PackageDirectory", "empty"}, | ||
| }), | ||
| new MockTaskItem("Microsoft.Android.Runtime.32", | ||
| new Dictionary<string, string>() | ||
| { | ||
| {"FrameworkName", "Microsoft.Android"}, | ||
| {"NuGetPackageId", "Microsoft.Android.Runtime.32"}, | ||
| {"NuGetPackageVersion", "32.0.300"}, | ||
| {"PackageDirectory", "empty"}, | ||
| }), | ||
| new MockTaskItem("Microsoft.Android.Runtime.32.android-arm", | ||
| new Dictionary<string, string>() | ||
| { | ||
| {"FrameworkName", "Microsoft.Android"}, | ||
| {"NuGetPackageId", "Microsoft.Android.Runtime.32.android-arm"}, | ||
| {"NuGetPackageVersion", "32.0.300"}, | ||
| {"PackageDirectory", "empty"}, | ||
| }), | ||
| }, | ||
| }; | ||
|
|
||
| task.Execute().Should().BeTrue(); | ||
| task.ResolvedFrameworkReferences.Length.Should().Be(2); | ||
| task.ResolvedFrameworkReferences[0].GetMetadata("RuntimePackPath").Should().Be("empty"); | ||
| task.ResolvedFrameworkReferences[0].GetMetadata("RuntimePackName").Should().Be("Microsoft.NETCore.App.Runtime.Mono.android-arm"); | ||
| task.ResolvedFrameworkReferences[0].GetMetadata("RuntimePackVersion").Should().Be("6.0.4"); | ||
| task.ResolvedFrameworkReferences[1].GetMetadata("RuntimePackPath").Should().Be("empty;empty"); | ||
| task.ResolvedFrameworkReferences[1].GetMetadata("RuntimePackName").Should().Be("Microsoft.Android.Runtime.32;Microsoft.Android.Runtime.32.android-arm"); | ||
| task.ResolvedFrameworkReferences[1].GetMetadata("RuntimePackVersion").Should().Be("32.0.300;32.0.300"); | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't see any changes in code that consumes these metadata values. Is that code going to be able to handle the multiple runtime packs?
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 couldn't find any references in dotnet/sdk, aside from the tests that only make sure that this metadata is set. Maybe there are external usages that could break? Are you familiar with anything else that depends on these?
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 it's used somewhere but I'm not sure. If it's really not used, then we don't even need to set the metadata at all (though it could be useful for debugging).
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.
@dsplaisted are there any other folks we should loop in to determine whether we should remove this metadata or not? I'm not sure how to proceed.