Exemple #1
0
 public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
 {
     Target = target;
     Runtime = runtime;
     CompilationOptions = compilationOptions;
     CompileLibraries = compileLibraries;
     RuntimeLibraries = runtimeLibraries;
 }
            private Dependency CreateDependency(RuntimeLibrary library, ISet<string> referenceAssemblies)
            {
                var classification = DependencyClassification.Unknown;
                if (referenceAssemblies.Contains(library.Name))
                {
                    classification = DependencyClassification.MvcReference;
                }

                return new Dependency(library, classification);
            }
 public static IEnumerable <string> GetRuntimeNativeAssets(this RuntimeLibrary self, DependencyContext context, string runtimeIdentifier)
 {
     if (self == null)
     {
         throw new ArgumentNullException(nameof(self));
     }
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (runtimeIdentifier == null)
     {
         throw new ArgumentNullException(nameof(runtimeIdentifier));
     }
     return(ResolveAssets(context, runtimeIdentifier, self.NativeLibraryGroups));
 }
        private JObject WritePortableTargetLibrary(RuntimeLibrary runtimeLibrary, CompilationLibrary compilationLibrary)
        {
            var libraryObject = new JObject();

            var dependencies = new HashSet <Dependency>();

            if (runtimeLibrary != null)
            {
                // Add runtime-agnostic assets
                AddAssets(libraryObject, DependencyContextStrings.RuntimeAssembliesKey, runtimeLibrary.RuntimeAssemblyGroups.GetDefaultGroup());
                AddAssets(libraryObject, DependencyContextStrings.NativeLibrariesKey, runtimeLibrary.NativeLibraryGroups.GetDefaultGroup());
                AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);

                // Add runtime-specific assets
                var runtimeTargets = new JObject();
                AddRuntimeSpecificAssetGroups(runtimeTargets, DependencyContextStrings.RuntimeAssetType, runtimeLibrary.RuntimeAssemblyGroups);
                AddRuntimeSpecificAssetGroups(runtimeTargets, DependencyContextStrings.NativeAssetType, runtimeLibrary.NativeLibraryGroups);
                if (runtimeTargets.Count > 0)
                {
                    libraryObject.Add(DependencyContextStrings.RuntimeTargetsPropertyName, runtimeTargets);
                }

                dependencies.UnionWith(runtimeLibrary.Dependencies);
            }

            if (compilationLibrary != null)
            {
                AddCompilationAssemblies(libraryObject, compilationLibrary.Assemblies);

                dependencies.UnionWith(compilationLibrary.Dependencies);
            }

            AddDependencies(libraryObject, dependencies);
            if (compilationLibrary != null && runtimeLibrary == null)
            {
                libraryObject.Add(DependencyContextStrings.CompilationOnlyPropertyName, true);
            }
            return(libraryObject);
        }
 public Dependency(RuntimeLibrary library, DependencyClassification classification)
 {
     Library = library;
     Classification = classification;
 }
        public static IEnumerable <RuntimeFile> GetDefaultNativeRuntimeFileAssets(this RuntimeLibrary self, DependencyContext context)
        {
            ThrowHelper.ThrowIfNull(self);

            return(ResolveRuntimeFiles(context, string.Empty, self.NativeLibraryGroups));
        }
 public static IEnumerable <AssemblyName> GetRuntimeAssemblyNames(this RuntimeLibrary self, DependencyContext context, string runtimeIdentifier)
 {
     return(ResolveAssets(context, runtimeIdentifier, self.RuntimeAssemblyGroups).Select(GetAssemblyName));
 }
 public static IEnumerable <AssemblyName> GetDefaultAssemblyNames(this RuntimeLibrary self, DependencyContext context)
 {
     return(ResolveAssets(context, string.Empty, self.RuntimeAssemblyGroups).Select(GetAssemblyName));
 }
 public static IEnumerable <string> GetRuntimeNativeAssets(this RuntimeLibrary self, DependencyContext context, string runtimeIdentifier)
 {
     return(ResolveAssets(context, runtimeIdentifier, self.NativeLibraryGroups));
 }
 public static IEnumerable <string> GetDefaultNativeAssets(this RuntimeLibrary self, DependencyContext context)
 {
     return(ResolveAssets(context, string.Empty, self.NativeLibraryGroups));
 }
 private bool IsCandidateLibrary(RuntimeLibrary library)
 {
     return library.Dependencies.Any(dependency => string.Equals(AssemblyRoot, dependency.Name, StringComparison.Ordinal));
 }
 private static bool IsCandidateLibrary(RuntimeLibrary library)
 {
     Debug.Assert(ReferenceAssemblies != null);
     return !ReferenceAssemblies.Contains(library.Name) &&
         library.Dependencies.Any(dependency => ReferenceAssemblies.Contains(dependency.Name));
 }