put 'native' section in to runtime targets for deps file
This commit is contained in:
parent
dc11ed2ba8
commit
008a1ad0fa
7 changed files with 38 additions and 8 deletions
|
@ -129,6 +129,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
export.Library.Identity.Version.ToString(),
|
export.Library.Identity.Version.ToString(),
|
||||||
export.Library.Hash,
|
export.Library.Hash,
|
||||||
assemblies.Select(RuntimeAssembly.Create),
|
assemblies.Select(RuntimeAssembly.Create),
|
||||||
|
export.NativeLibraries.Select(l => l.RelativePath),
|
||||||
export.ResourceAssemblies.Select(CreateResourceAssembly),
|
export.ResourceAssemblies.Select(CreateResourceAssembly),
|
||||||
export.RuntimeTargets.Select(CreateRuntimeTarget),
|
export.RuntimeTargets.Select(CreateRuntimeTarget),
|
||||||
libraryDependencies,
|
libraryDependencies,
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
version: identity.Item3,
|
version: identity.Item3,
|
||||||
hash: identity.Item4,
|
hash: identity.Item4,
|
||||||
assemblies: packageGroup.Select(l => RuntimeAssembly.Create(l.AssetPath)),
|
assemblies: packageGroup.Select(l => RuntimeAssembly.Create(l.AssetPath)),
|
||||||
|
nativeLibraries: Enumerable.Empty<string>(),
|
||||||
resourceAssemblies: Enumerable.Empty<ResourceAssembly>(),
|
resourceAssemblies: Enumerable.Empty<ResourceAssembly>(),
|
||||||
subTargets: Enumerable.Empty<RuntimeTarget>(),
|
subTargets: Enumerable.Empty<RuntimeTarget>(),
|
||||||
dependencies: Enumerable.Empty<Dependency>(),
|
dependencies: Enumerable.Empty<Dependency>(),
|
||||||
|
|
|
@ -169,10 +169,12 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
var assemblies = ReadAssemblies(libraryObject, DependencyContextStrings.RuntimeAssembliesKey)
|
var assemblies = ReadAssetList(libraryObject, DependencyContextStrings.RuntimeAssembliesKey)
|
||||||
.Select(RuntimeAssembly.Create)
|
.Select(RuntimeAssembly.Create)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
var nativeLibraries = ReadAssetList(libraryObject, DependencyContextStrings.NativeLibrariesKey);
|
||||||
|
|
||||||
var resourceAssemblies = ReadResourceAssemblies((JObject)libraryObject[DependencyContextStrings.ResourceAssembliesPropertyName]);
|
var resourceAssemblies = ReadResourceAssemblies((JObject)libraryObject[DependencyContextStrings.ResourceAssembliesPropertyName]);
|
||||||
|
|
||||||
return new RuntimeLibrary(
|
return new RuntimeLibrary(
|
||||||
|
@ -181,6 +183,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
version: version,
|
version: version,
|
||||||
hash: stub.Hash,
|
hash: stub.Hash,
|
||||||
assemblies: assemblies,
|
assemblies: assemblies,
|
||||||
|
nativeLibraries: nativeLibraries,
|
||||||
resourceAssemblies: resourceAssemblies,
|
resourceAssemblies: resourceAssemblies,
|
||||||
subTargets: runtimeTargets.ToArray(),
|
subTargets: runtimeTargets.ToArray(),
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
|
@ -188,7 +191,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var assemblies = ReadAssemblies(libraryObject, DependencyContextStrings.CompileTimeAssembliesKey);
|
var assemblies = ReadAssetList(libraryObject, DependencyContextStrings.CompileTimeAssembliesKey);
|
||||||
return new CompilationLibrary(stub.Type, name, version, stub.Hash, assemblies, dependencies, stub.Serviceable);
|
return new CompilationLibrary(stub.Type, name, version, stub.Hash, assemblies, dependencies, stub.Serviceable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +229,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] ReadAssemblies(JObject libraryObject, string name)
|
private static string[] ReadAssetList(JObject libraryObject, string name)
|
||||||
{
|
{
|
||||||
var assembliesObject = (JObject) libraryObject[name];
|
var assembliesObject = (JObject) libraryObject[name];
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
internal const string RuntimeAssembliesKey = "runtime";
|
internal const string RuntimeAssembliesKey = "runtime";
|
||||||
|
|
||||||
|
internal const string NativeLibrariesKey = "native";
|
||||||
|
|
||||||
internal const string RuntimeTargetPropertyName = "runtimeTarget";
|
internal const string RuntimeTargetPropertyName = "runtimeTarget";
|
||||||
|
|
||||||
internal const string LibrariesPropertyName = "libraries";
|
internal const string LibrariesPropertyName = "libraries";
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libraryObject.Add(new JProperty(DependencyContextStrings.CompileTimeAssembliesKey,
|
libraryObject.Add(new JProperty(DependencyContextStrings.CompileTimeAssembliesKey,
|
||||||
WriteAssemblies(compilationAssemblies))
|
WriteAssetList(compilationAssemblies))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libraryObject.Add(new JProperty(DependencyContextStrings.RuntimeAssembliesKey,
|
libraryObject.Add(new JProperty(DependencyContextStrings.RuntimeAssembliesKey,
|
||||||
WriteAssemblies(runtimeAssemblies.Select(a => a.Path)))
|
WriteAssetList(runtimeAssemblies.Select(a => a.Path)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +197,12 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
AddDependencies(libraryObject, runtimeLibrary.Dependencies);
|
AddDependencies(libraryObject, runtimeLibrary.Dependencies);
|
||||||
AddRuntimeAssemblies(libraryObject, runtimeLibrary.Assemblies);
|
AddRuntimeAssemblies(libraryObject, runtimeLibrary.Assemblies);
|
||||||
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
||||||
|
|
||||||
|
if (runtimeLibrary.NativeLibraries.Any())
|
||||||
|
{
|
||||||
|
libraryObject.Add(DependencyContextStrings.NativeLibrariesKey, WriteAssetList(runtimeLibrary.NativeLibraries));
|
||||||
|
}
|
||||||
|
|
||||||
return libraryObject;
|
return libraryObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +219,6 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
private JObject WritePortableTargetLibrary(RuntimeLibrary runtimeLibrary, CompilationLibrary compilationLibrary)
|
private JObject WritePortableTargetLibrary(RuntimeLibrary runtimeLibrary, CompilationLibrary compilationLibrary)
|
||||||
{
|
{
|
||||||
|
|
||||||
var libraryObject = new JObject();
|
var libraryObject = new JObject();
|
||||||
|
|
||||||
var dependencies = new HashSet<Dependency>();
|
var dependencies = new HashSet<Dependency>();
|
||||||
|
@ -229,6 +234,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
||||||
AddRuntimeAssemblies(libraryObject, runtimeLibrary.Assemblies);
|
AddRuntimeAssemblies(libraryObject, runtimeLibrary.Assemblies);
|
||||||
|
libraryObject.Add(DependencyContextStrings.NativeLibrariesKey, WriteAssetList(runtimeLibrary.NativeLibraries));
|
||||||
|
|
||||||
dependencies.UnionWith(runtimeLibrary.Dependencies);
|
dependencies.UnionWith(runtimeLibrary.Dependencies);
|
||||||
}
|
}
|
||||||
|
@ -272,9 +278,9 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JObject WriteAssemblies(IEnumerable<string> assemblies)
|
private JObject WriteAssetList(IEnumerable<string> assetPaths)
|
||||||
{
|
{
|
||||||
return new JObject(assemblies.Select(assembly => new JProperty(NormalizePath(assembly), new JObject())));
|
return new JObject(assetPaths.Select(assembly => new JProperty(NormalizePath(assembly), new JObject())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JObject WriteLibraries(DependencyContext context)
|
private JObject WriteLibraries(DependencyContext context)
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
string version,
|
string version,
|
||||||
string hash,
|
string hash,
|
||||||
IEnumerable<RuntimeAssembly> assemblies,
|
IEnumerable<RuntimeAssembly> assemblies,
|
||||||
|
IEnumerable<string> nativeLibraries,
|
||||||
IEnumerable<ResourceAssembly> resourceAssemblies,
|
IEnumerable<ResourceAssembly> resourceAssemblies,
|
||||||
IEnumerable<RuntimeTarget> subTargets,
|
IEnumerable<RuntimeTarget> subTargets,
|
||||||
IEnumerable<Dependency> dependencies,
|
IEnumerable<Dependency> dependencies,
|
||||||
|
@ -23,9 +24,12 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
Assemblies = assemblies.ToArray();
|
Assemblies = assemblies.ToArray();
|
||||||
ResourceAssemblies = resourceAssemblies.ToArray();
|
ResourceAssemblies = resourceAssemblies.ToArray();
|
||||||
RuntimeTargets = subTargets.ToArray();
|
RuntimeTargets = subTargets.ToArray();
|
||||||
|
NativeLibraries = nativeLibraries.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<string> NativeLibraries { get; }
|
||||||
|
|
||||||
public IReadOnlyList<ResourceAssembly> ResourceAssemblies { get; }
|
public IReadOnlyList<ResourceAssembly> ResourceAssemblies { get; }
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"HASH",
|
"HASH",
|
||||||
new [] { RuntimeAssembly.Create("Banana.dll")},
|
new [] { RuntimeAssembly.Create("Banana.dll")},
|
||||||
|
new [] { "runtimes\\linux\\native\\native.so" },
|
||||||
new [] { new ResourceAssembly("en-US\\Banana.Resource.dll", "en-US")},
|
new [] { new ResourceAssembly("en-US\\Banana.Resource.dll", "en-US")},
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
|
@ -172,8 +173,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
var library = target.Should().HavePropertyAsObject("PackageName/1.2.3").Subject;
|
var library = target.Should().HavePropertyAsObject("PackageName/1.2.3").Subject;
|
||||||
var dependencies = library.Should().HavePropertyAsObject("dependencies").Subject;
|
var dependencies = library.Should().HavePropertyAsObject("dependencies").Subject;
|
||||||
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
||||||
|
|
||||||
library.Should().HavePropertyAsObject("runtime")
|
library.Should().HavePropertyAsObject("runtime")
|
||||||
.Subject.Should().HaveProperty("Banana.dll");
|
.Subject.Should().HaveProperty("Banana.dll");
|
||||||
|
library.Should().HavePropertyAsObject("native")
|
||||||
|
.Subject.Should().HaveProperty("runtimes/linux/native/native.so");
|
||||||
|
|
||||||
var runtimeTargets = library.Should().HavePropertyAsObject("runtimeTargets").Subject;
|
var runtimeTargets = library.Should().HavePropertyAsObject("runtimeTargets").Subject;
|
||||||
|
|
||||||
|
@ -226,6 +230,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"HASH",
|
"HASH",
|
||||||
new [] { RuntimeAssembly.Create("Banana.dll")},
|
new [] { RuntimeAssembly.Create("Banana.dll")},
|
||||||
|
new [] { "native.dll" },
|
||||||
new ResourceAssembly[] {},
|
new ResourceAssembly[] {},
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
|
@ -247,8 +252,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
var library = target.Should().HavePropertyAsObject("PackageName/1.2.3").Subject;
|
var library = target.Should().HavePropertyAsObject("PackageName/1.2.3").Subject;
|
||||||
var dependencies = library.Should().HavePropertyAsObject("dependencies").Subject;
|
var dependencies = library.Should().HavePropertyAsObject("dependencies").Subject;
|
||||||
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
||||||
|
|
||||||
library.Should().HavePropertyAsObject("runtime")
|
library.Should().HavePropertyAsObject("runtime")
|
||||||
.Subject.Should().HaveProperty("Banana.dll");
|
.Subject.Should().HaveProperty("Banana.dll");
|
||||||
|
library.Should().HavePropertyAsObject("native")
|
||||||
|
.Subject.Should().HaveProperty("native.dll");
|
||||||
|
|
||||||
library.Should().HavePropertyAsObject("compile")
|
library.Should().HavePropertyAsObject("compile")
|
||||||
.Subject.Should().HaveProperty("ref/Banana.dll");
|
.Subject.Should().HaveProperty("ref/Banana.dll");
|
||||||
|
@ -286,6 +294,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"HASH",
|
"HASH",
|
||||||
new [] { RuntimeAssembly.Create("Banana.dll")},
|
new [] { RuntimeAssembly.Create("Banana.dll")},
|
||||||
|
new [] { "runtimes\\osx\\native\\native.dylib" },
|
||||||
new ResourceAssembly[] {},
|
new ResourceAssembly[] {},
|
||||||
new RuntimeTarget[] {},
|
new RuntimeTarget[] {},
|
||||||
new [] {
|
new [] {
|
||||||
|
@ -303,6 +312,8 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
dependencies.Should().HavePropertyValue("Fruits.Abstract.dll", "2.0.0");
|
||||||
library.Should().HavePropertyAsObject("runtime")
|
library.Should().HavePropertyAsObject("runtime")
|
||||||
.Subject.Should().HaveProperty("Banana.dll");
|
.Subject.Should().HaveProperty("Banana.dll");
|
||||||
|
library.Should().HavePropertyAsObject("native")
|
||||||
|
.Subject.Should().HaveProperty("runtimes/osx/native/native.dylib");
|
||||||
|
|
||||||
//libraries
|
//libraries
|
||||||
var libraries = result.Should().HavePropertyAsObject("libraries").Subject;
|
var libraries = result.Should().HavePropertyAsObject("libraries").Subject;
|
||||||
|
@ -327,6 +338,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"HASH",
|
"HASH",
|
||||||
new RuntimeAssembly[] { },
|
new RuntimeAssembly[] { },
|
||||||
|
new string[] { },
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
new ResourceAssembly("en-US/Fruits.resources.dll", "en-US")
|
new ResourceAssembly("en-US/Fruits.resources.dll", "en-US")
|
||||||
|
@ -361,6 +373,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"HASH",
|
"HASH",
|
||||||
new RuntimeAssembly[] { },
|
new RuntimeAssembly[] { },
|
||||||
|
new string[] { },
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
new ResourceAssembly("en-US/Fruits.resources.dll", "en-US")
|
new ResourceAssembly("en-US/Fruits.resources.dll", "en-US")
|
||||||
|
|
Loading…
Reference in a new issue