Add support for json deps file
This commit is contained in:
parent
3ed9361763
commit
3f4c263670
2 changed files with 41 additions and 2 deletions
|
@ -15,13 +15,21 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||||
|
|
||||||
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
|
public DependencyContext(string target,
|
||||||
|
string runtime,
|
||||||
|
bool isPortable,
|
||||||
|
CompilationOptions compilationOptions,
|
||||||
|
CompilationLibrary[] compileLibraries,
|
||||||
|
RuntimeLibrary[] runtimeLibraries,
|
||||||
|
IReadOnlyList<KeyValuePair<string, string[]>> runtimeGraph)
|
||||||
{
|
{
|
||||||
Target = target;
|
Target = target;
|
||||||
Runtime = runtime;
|
Runtime = runtime;
|
||||||
|
IsPortable = isPortable;
|
||||||
CompilationOptions = compilationOptions;
|
CompilationOptions = compilationOptions;
|
||||||
CompileLibraries = compileLibraries;
|
CompileLibraries = compileLibraries;
|
||||||
RuntimeLibraries = runtimeLibraries;
|
RuntimeLibraries = runtimeLibraries;
|
||||||
|
RuntimeGraph = runtimeGraph;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DependencyContext Default => _defaultContext.Value;
|
public static DependencyContext Default => _defaultContext.Value;
|
||||||
|
@ -30,12 +38,16 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
public string Runtime { get; }
|
public string Runtime { get; }
|
||||||
|
|
||||||
|
public bool IsPortable { get; }
|
||||||
|
|
||||||
public CompilationOptions CompilationOptions { get; }
|
public CompilationOptions CompilationOptions { get; }
|
||||||
|
|
||||||
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
|
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
|
||||||
|
|
||||||
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
|
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<KeyValuePair<string, string[]>> RuntimeGraph { get; }
|
||||||
|
|
||||||
private static DependencyContext LoadDefault()
|
private static DependencyContext LoadDefault()
|
||||||
{
|
{
|
||||||
var entryAssembly = Assembly.GetEntryAssembly();
|
var entryAssembly = Assembly.GetEntryAssembly();
|
||||||
|
|
|
@ -8,12 +8,39 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
public class RuntimeLibrary : Library
|
public class RuntimeLibrary : Library
|
||||||
{
|
{
|
||||||
public RuntimeLibrary(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
|
public RuntimeLibrary(
|
||||||
|
string libraryType,
|
||||||
|
string packageName,
|
||||||
|
string version,
|
||||||
|
string hash,
|
||||||
|
string[] assemblies,
|
||||||
|
RuntimeTarget[] subTargets,
|
||||||
|
Dependency[] dependencies,
|
||||||
|
bool serviceable)
|
||||||
: base(libraryType, packageName, version, hash, dependencies, serviceable)
|
: base(libraryType, packageName, version, hash, dependencies, serviceable)
|
||||||
{
|
{
|
||||||
Assemblies = assemblies.Select(path => new RuntimeAssembly(path)).ToArray();
|
Assemblies = assemblies.Select(path => new RuntimeAssembly(path)).ToArray();
|
||||||
|
SubTargets = subTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<RuntimeTarget> SubTargets { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RuntimeTarget
|
||||||
|
{
|
||||||
|
public RuntimeTarget(string runtime, IReadOnlyList<RuntimeAssembly> assemblies, IReadOnlyList<string> nativeLibraries)
|
||||||
|
{
|
||||||
|
Runtime = runtime;
|
||||||
|
Assemblies = assemblies;
|
||||||
|
NativeLibraries = nativeLibraries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Runtime { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<string> NativeLibraries { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue