Add support for json deps file

This commit is contained in:
Pavel Krymets 2016-02-25 11:00:48 -08:00
parent 3ed9361763
commit 3f4c263670
2 changed files with 41 additions and 2 deletions

View file

@ -15,13 +15,21 @@ namespace Microsoft.Extensions.DependencyModel
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;
Runtime = runtime;
IsPortable = isPortable;
CompilationOptions = compilationOptions;
CompileLibraries = compileLibraries;
RuntimeLibraries = runtimeLibraries;
RuntimeGraph = runtimeGraph;
}
public static DependencyContext Default => _defaultContext.Value;
@ -30,12 +38,16 @@ namespace Microsoft.Extensions.DependencyModel
public string Runtime { get; }
public bool IsPortable { get; }
public CompilationOptions CompilationOptions { get; }
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
public IReadOnlyList<KeyValuePair<string, string[]>> RuntimeGraph { get; }
private static DependencyContext LoadDefault()
{
var entryAssembly = Assembly.GetEntryAssembly();

View file

@ -8,12 +8,39 @@ namespace Microsoft.Extensions.DependencyModel
{
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)
{
Assemblies = assemblies.Select(path => new RuntimeAssembly(path)).ToArray();
SubTargets = subTargets;
}
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; }
}
}