コード例 #1
0
ファイル: DependencyContext.cs プロジェクト: yonglehou/cli-1
 public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries)
 {
     Target = target;
     Runtime = runtime;
     CompilationOptions = compilationOptions;
     CompileLibraries = compileLibraries;
     RuntimeLibraries = runtimeLibraries;
 }
コード例 #2
0
ファイル: Validator.cs プロジェクト: krwq/cli
 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}");
         }
     }
 }
コード例 #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))
         );
 }
コード例 #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)
         );
 }
コード例 #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))
                );
        }
コード例 #6
0
 /// <inheritdoc/>
 public Assembly GetFrom(Microsoft.Extensions.DependencyModel.Library library)
 {
     return(Assembly.Load(new AssemblyName(library.Name)));
 }
コード例 #7
0
 private static bool IsReferencingNancy(Library library)
 {
     return library.Dependencies.Any(dependency => dependency.Name.Equals(NancyAssembly.GetName().Name));
 }