コード例 #1
0
ファイル: DependencyContext.cs プロジェクト: ans-ashkan/cli
 public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
 {
     Target = target;
     Runtime = runtime;
     CompilationOptions = compilationOptions;
     CompileLibraries = compileLibraries;
     RuntimeLibraries = runtimeLibraries;
 }
コード例 #2
0
            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);
            }
コード例 #3
0
 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));
 }
コード例 #4
0
        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);
        }
コード例 #5
0
 public Dependency(RuntimeLibrary library, DependencyClassification classification)
 {
     Library = library;
     Classification = classification;
 }
コード例 #6
0
        public static IEnumerable <RuntimeFile> GetDefaultNativeRuntimeFileAssets(this RuntimeLibrary self, DependencyContext context)
        {
            ThrowHelper.ThrowIfNull(self);

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