Add runtime signature into deps.json
This commit is contained in:
parent
a81f1c08f0
commit
f75481f731
15 changed files with 187 additions and 78 deletions
|
@ -84,15 +84,15 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Build(portable: true);
|
||||
|
||||
context.IsPortable.Should().BeTrue();
|
||||
context.Target.IsPortable.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FillsRuntimeAndTarget()
|
||||
{
|
||||
var context = Build(target: new NuGetFramework("SomeFramework",new Version(1,2)), runtime: "win8-x86");
|
||||
context.Runtime.Should().Be("win8-x86");
|
||||
context.TargetFramework.Should().Be("SomeFramework,Version=v1.2");
|
||||
context.Target.Runtime.Should().Be("win8-x86");
|
||||
context.Target.Framework.Should().Be("SomeFramework,Version=v1.2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -291,6 +291,19 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
lib.Dependencies.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GeneratesRuntimeSignatureOutOfPackageNamesAndVersions()
|
||||
{
|
||||
var context = Build(runtimeExports: new[]
|
||||
{
|
||||
Export(PackageDescription("Pack.Age", new NuGetVersion(1, 2, 3))),
|
||||
Export(PackageDescription("Pack.Age", new NuGetVersion(1, 2, 3))),
|
||||
});
|
||||
|
||||
context.Target.RuntimeSignature.Should().Be("d0fc00006ed69e4aae80383dda08599a6892fd31");
|
||||
}
|
||||
|
||||
|
||||
private LibraryExport Export(
|
||||
LibraryDescription description,
|
||||
IEnumerable<LibraryAsset> compilationAssemblies = null,
|
||||
|
|
|
@ -25,14 +25,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""runtimeTarget"": {
|
||||
""name"":"".NETStandardApp,Version=v1.5/osx.10.10-x64""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeFalse();
|
||||
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Runtime.Should().Be("osx.10.10-x64");
|
||||
context.Target.IsPortable.Should().BeFalse();
|
||||
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Target.Runtime.Should().Be("osx.10.10-x64");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -44,7 +46,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
"".NETStandardApp,Version=v1.5"": {}
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeTrue();
|
||||
context.Target.IsPortable.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -52,12 +54,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""runtimeTarget"": {
|
||||
""name"": "".NETStandardApp,Version=v1.5/osx.10.10-x64""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeFalse();
|
||||
context.Target.IsPortable.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -69,7 +73,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
"".NETStandardApp,Version=v1.5"": {}
|
||||
}
|
||||
}");
|
||||
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -152,7 +156,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5"",
|
||||
""runtimeTarget"": {
|
||||
""name"": "".NETStandardApp,Version=v1.5""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5"": {
|
||||
""MyApp/1.0.1"": {
|
||||
|
|
|
@ -37,12 +37,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
CompilationOptions compilationOptions = null,
|
||||
CompilationLibrary[] compileLibraries = null,
|
||||
RuntimeLibrary[] runtimeLibraries = null,
|
||||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null)
|
||||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null,
|
||||
string runtimeSignature = null)
|
||||
{
|
||||
return new DependencyContext(
|
||||
return new DependencyContext(new TargetInfo(
|
||||
target ?? "DefaultTarget",
|
||||
runtime ?? string.Empty,
|
||||
isPortable ?? false,
|
||||
runtimeSignature ?? string.Empty,
|
||||
isPortable ?? false),
|
||||
compilationOptions ?? CompilationOptions.Default,
|
||||
compileLibraries ?? new CompilationLibrary[0],
|
||||
runtimeLibraries ?? new RuntimeLibrary[0],
|
||||
|
@ -80,10 +82,13 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
var result = Save(Create(
|
||||
"Target",
|
||||
"runtime",
|
||||
false)
|
||||
false,
|
||||
runtimeSignature: "runtimeSignature")
|
||||
);
|
||||
|
||||
result.Should().HavePropertyValue("runtimeTarget", "Target/runtime");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("name", "Target/runtime");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("signature", "runtimeSignature");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -92,9 +97,13 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
var result = Save(Create(
|
||||
"Target",
|
||||
"runtime",
|
||||
true)
|
||||
true,
|
||||
runtimeSignature: "runtimeSignature")
|
||||
);
|
||||
result.Should().HavePropertyValue("runtimeTarget", "Target");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("name", "Target");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("signature", "runtimeSignature");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -39,18 +39,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
};
|
||||
|
||||
var context = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
compilationLibraries,
|
||||
runtimeLibraries,
|
||||
new RuntimeFallbacks[] { });
|
||||
|
||||
var contextRedist = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
compilationLibrariesRedist,
|
||||
runtimeLibrariesRedist,
|
||||
|
@ -76,9 +72,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
public void MergeMergesRuntimeGraph()
|
||||
{
|
||||
var context = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
Enumerable.Empty<CompilationLibrary>(),
|
||||
Enumerable.Empty<RuntimeLibrary>(),
|
||||
|
@ -88,9 +82,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
});
|
||||
|
||||
var contextRedist = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
Enumerable.Empty<CompilationLibrary>(),
|
||||
Enumerable.Empty<RuntimeLibrary>(),
|
||||
|
@ -106,6 +98,15 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
Subject.Fallbacks.Should().BeEquivalentTo("win7-x64", "win7-x86");
|
||||
}
|
||||
|
||||
private TargetInfo CreateTargetInfo()
|
||||
{
|
||||
return new TargetInfo(
|
||||
"Framework",
|
||||
"runtime",
|
||||
"runtimeSignature",
|
||||
true);
|
||||
}
|
||||
|
||||
private CompilationLibrary CreateCompilation(string name)
|
||||
{
|
||||
return new CompilationLibrary(
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
[InlineData("FlibbidyFlob", "FlibbidyFlob")]
|
||||
public void GetRuntimeAssemblyNamesExtractsCorrectAssemblyName(string path, string expected)
|
||||
{
|
||||
var context = new DependencyContext(
|
||||
".NETStandard,Version=v1.3",
|
||||
string.Empty,
|
||||
isPortable: true,
|
||||
var context = new DependencyContext(new TargetInfo(".NETStandard,Version=v1.3", string.Empty, string.Empty, true),
|
||||
compilationOptions: CompilationOptions.Default,
|
||||
compileLibraries: new CompilationLibrary[] { },
|
||||
runtimeLibraries: new[] {
|
||||
|
@ -94,10 +91,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
|
||||
private DependencyContext BuildTestContext()
|
||||
{
|
||||
return new DependencyContext(
|
||||
".NETStandard,Version=v1.3",
|
||||
string.Empty,
|
||||
isPortable: true,
|
||||
return new DependencyContext(new TargetInfo(".NETStandard,Version=v1.3", string.Empty, string.Empty, true),
|
||||
compilationOptions: CompilationOptions.Default,
|
||||
compileLibraries: new[]
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue