Esempio n. 1
0
        private IEnumerable <RuntimeDependency> GetDependenciesInternal(string pathToProjectOrDll, string[] packageSources = null, bool restorePackages = true)
        {
            packageSources = packageSources ?? new string[0];
            ScriptDependencyInfo dependencyInfo;

            if (restorePackages)
            {
                dependencyInfo = _scriptDependencyInfoProvider.GetDependencyInfo(pathToProjectOrDll, packageSources);
            }
            else
            {
                dependencyInfo = _scriptDependencyInfoProvider.GetDependencyInfo(pathToProjectOrDll);
            }

            var           dependencyContext   = dependencyInfo.DependencyContext;
            List <string> nuGetPackageFolders = dependencyInfo.NugetPackageFolders.ToList();

            nuGetPackageFolders.Add(_scriptEnvironment.NuGetStoreFolder);

            var runtimeDependencies = new List <RuntimeDependency>();

            var runtimeLibraries = dependencyContext.RuntimeLibraries;

            foreach (var runtimeLibrary in runtimeLibraries)
            {
                var runtimeDependency = new RuntimeDependency(runtimeLibrary.Name, runtimeLibrary.Version,
                                                              ProcessRuntimeAssemblies(runtimeLibrary, nuGetPackageFolders.ToArray()),
                                                              ProcessNativeLibraries(runtimeLibrary, nuGetPackageFolders.ToArray()),
                                                              ProcessScriptFiles(runtimeLibrary, nuGetPackageFolders.ToArray()));

                runtimeDependencies.Add(runtimeDependency);
            }

            return(runtimeDependencies);
        }
        private IEnumerable <RuntimeDependency> GetDependenciesInternal(string pathToProjectFile)
        {
            var dependencyInfo = _scriptDependencyInfoProvider.GetDependencyInfo(pathToProjectFile);

            var           dependencyContext   = dependencyInfo.DependencyContext;
            List <string> nuGetPackageFolders = dependencyInfo.NugetPackageFolders.ToList();

            nuGetPackageFolders.Add(RuntimeHelper.GetPathToNuGetStoreFolder());

            var runtimeDependencies = new List <RuntimeDependency>();

            var runtimeLibraries = dependencyContext.RuntimeLibraries;


            foreach (var runtimeLibrary in runtimeLibraries)
            {
                var runtimeDependency = new RuntimeDependency(runtimeLibrary.Name, runtimeLibrary.Version,
                                                              ProcessRuntimeAssemblies(runtimeLibrary, nuGetPackageFolders.ToArray()),
                                                              ProcessNativeLibraries(runtimeLibrary, nuGetPackageFolders.ToArray()),
                                                              ProcessScriptFiles(runtimeLibrary, nuGetPackageFolders.ToArray()));

                runtimeDependencies.Add(runtimeDependency);
            }

            return(runtimeDependencies);
        }
        private IEnumerable <RuntimeDependency> GetDependenciesInternal(string pathToAssetsFile)
        {
            var context = _dependencyContextReader.ReadDependencyContext(pathToAssetsFile);
            var result  = new List <RuntimeDependency>();

            foreach (var scriptDependency in context.Dependencies)
            {
                var runtimeAssemblies = scriptDependency.RuntimeDependencyPaths.Select(rdp => new RuntimeAssembly(AssemblyName.GetAssemblyName(rdp), rdp)).ToList();
                var runtimeDependency = new RuntimeDependency(scriptDependency.Name, scriptDependency.Version, runtimeAssemblies, scriptDependency.NativeAssetPaths, scriptDependency.ScriptPaths);
                result.Add(runtimeDependency);
            }

            return(result);
        }