public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries) { Target = target; Runtime = runtime; CompilationOptions = compilationOptions; CompileLibraries = compileLibraries; RuntimeLibraries = runtimeLibraries; }
private static void CheckMetadata(Library library) { if (string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase)) { if (string.IsNullOrWhiteSpace(library.Name) || string.IsNullOrWhiteSpace(library.Hash) || string.IsNullOrWhiteSpace(library.Version)) { Error($"Empty metadata for {library.GetType().ToString()} {library.Name}"); } } }
private JObject WriteTargetLibrary(Library library, bool runtime) { return new JObject( new JProperty(DependencyContextStrings.DependenciesPropertyName, WriteDependencies(library.Dependencies)), new JProperty(runtime ? DependencyContextStrings.RunTimeAssembliesKey : DependencyContextStrings.CompileTimeAssembliesKey, WriteAssemblies(library.Assemblies)) ); }
private JObject WriteLibrary(Library library) { return new JObject( new JProperty(DependencyContextStrings.TypePropertyName, library.LibraryType), new JProperty(DependencyContextStrings.ServiceablePropertyName, library.Serviceable), new JProperty(DependencyContextStrings.Sha512PropertyName, library.Hash) ); }
private JObject WriteTargetLibrary(Library library) { string propertyName; string[] assemblies; var runtimeLibrary = library as RuntimeLibrary; if (runtimeLibrary != null) { propertyName = DependencyContextStrings.RunTimeAssembliesKey; assemblies = runtimeLibrary.Assemblies.Select(assembly => assembly.Path).ToArray(); } else { var compilationLibrary = library as CompilationLibrary; if (compilationLibrary != null) { propertyName = DependencyContextStrings.CompileTimeAssembliesKey; assemblies = compilationLibrary.Assemblies.ToArray(); } else { throw new NotSupportedException(); } } return new JObject( new JProperty(DependencyContextStrings.DependenciesPropertyName, WriteDependencies(library.Dependencies)), new JProperty(propertyName, WriteAssemblies(assemblies)) ); }
/// <inheritdoc/> public Assembly GetFrom(Microsoft.Extensions.DependencyModel.Library library) { return(Assembly.Load(new AssemblyName(library.Name))); }
private static bool IsReferencingNancy(Library library) { return library.Dependencies.Any(dependency => dependency.Name.Equals(NancyAssembly.GetName().Name)); }