Fix #2327 - fix bug in dependency context adding assets to wrong groups
This commit is contained in:
parent
29183b045e
commit
bfdedfd75c
2 changed files with 39 additions and 2 deletions
|
@ -195,7 +195,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
var nativeLibraryGroups = new List<RuntimeAssetGroup>();
|
var nativeLibraryGroups = new List<RuntimeAssetGroup>();
|
||||||
foreach (var ridGroup in entries.GroupBy(e => e.Rid))
|
foreach (var ridGroup in entries.GroupBy(e => e.Rid))
|
||||||
{
|
{
|
||||||
var groupRuntimeAssemblies = entries.Where(e => e.Type == DependencyContextStrings.RuntimeAssetType)
|
var groupRuntimeAssemblies = ridGroup
|
||||||
|
.Where(e => e.Type == DependencyContextStrings.RuntimeAssetType)
|
||||||
.Select(e => e.Path)
|
.Select(e => e.Path)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
@ -206,7 +207,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
groupRuntimeAssemblies.Where(a => Path.GetFileName(a) != "_._")));
|
groupRuntimeAssemblies.Where(a => Path.GetFileName(a) != "_._")));
|
||||||
}
|
}
|
||||||
|
|
||||||
var groupNativeLibraries = entries.Where(e => e.Type == DependencyContextStrings.NativeAssetType)
|
var groupNativeLibraries = ridGroup
|
||||||
|
.Where(e => e.Type == DependencyContextStrings.NativeAssetType)
|
||||||
.Select(e => e.Path)
|
.Select(e => e.Path)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,41 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
context.Target.Runtime.Should().Be("osx.10.10-x64");
|
context.Target.Runtime.Should().Be("osx.10.10-x64");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void GroupsRuntimeAssets()
|
||||||
|
{
|
||||||
|
var context = Read(@"
|
||||||
|
{
|
||||||
|
""targets"": {
|
||||||
|
"".NETStandard,Version=v1.5"": {
|
||||||
|
""System.Banana/1.0.0"": {
|
||||||
|
""runtimeTargets"": {
|
||||||
|
""runtimes/unix/Banana.dll"": { ""rid"": ""unix"", ""assetType"": ""runtime"" },
|
||||||
|
""runtimes/win7/Banana.dll"": { ""rid"": ""win7"", ""assetType"": ""runtime"" },
|
||||||
|
|
||||||
|
""runtimes/native/win7/Apple.dll"": { ""rid"": ""win7"", ""assetType"": ""native"" },
|
||||||
|
""runtimes/native/unix/libapple.so"": { ""rid"": ""unix"", ""assetType"": ""native"" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
""libraries"": {
|
||||||
|
""System.Banana/1.0.0"": {
|
||||||
|
""type"": ""package"",
|
||||||
|
""serviceable"": false,
|
||||||
|
""sha512"": ""HASH-System.Banana""
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
context.RuntimeLibraries.Should().HaveCount(1);
|
||||||
|
var runtimeLib = context.RuntimeLibraries.Single();
|
||||||
|
runtimeLib.RuntimeAssemblyGroups.Should().HaveCount(2);
|
||||||
|
runtimeLib.RuntimeAssemblyGroups.All(g => g.AssetPaths.Count == 1).Should().BeTrue();
|
||||||
|
|
||||||
|
runtimeLib.NativeLibraryGroups.Should().HaveCount(2);
|
||||||
|
runtimeLib.NativeLibraryGroups.All(g => g.AssetPaths.Count == 1).Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SetsPortableIfRuntimeTargetHasNoRid()
|
public void SetsPortableIfRuntimeTargetHasNoRid()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue