public NuGet.RuntimeModel.RuntimeGraph Collect(IEnumerable <LibraryExport> exports) { var graph = RuntimeGraph.Empty; foreach (var export in exports) { if (export.Library.Identity.Type == LibraryType.Package) { PackageDescription description = (PackageDescription)export.Library; var runtimeJson = description.PackageLibrary.Files.FirstOrDefault(f => f == RuntimeJsonFileName); if (runtimeJson != null) { // Convert the package-name to lower-case in the path to lookup runtime.json string lowercasedPackageName = description.Identity.Name.ToLower(); string pathToPackage = export.Library.Path.Replace(description.Identity.Name, lowercasedPackageName); var runtimeJsonFullName = Path.Combine(pathToPackage, runtimeJson); graph = RuntimeGraph.Merge(graph, JsonRuntimeFormat.ReadRuntimeGraph(runtimeJsonFullName)); } } } return(graph); }
private static CommandSpec ConfigureCommandFromPackage(string commandName, IEnumerable<string> args, PackageDescription commandPackage, ProjectContext projectContext, string depsPath = null) { var files = commandPackage.Library.Files; var packageRoot = projectContext.PackagesDirectory; var packagePath = commandPackage.Path; var packageDir = Path.Combine(packageRoot, packagePath); return ConfigureCommandFromPackage(commandName, args, files, packageDir, depsPath); }