Exemplo n.º 1
0
 public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries)
 {
     Target = target;
     Runtime = runtime;
     CompilationOptions = compilationOptions;
     CompileLibraries = compileLibraries;
     RuntimeLibraries = runtimeLibraries;
 }
Exemplo n.º 2
0
 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}");
         }
     }
 }
Exemplo n.º 3
0
 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))
         );
 }
Exemplo n.º 4
0
 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)
         );
 }
Exemplo n.º 5
0
        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));
 }