private static async Task <RestoreTargetGraph> GetPlatformSpecificGraph(RestoreTargetGraph independentGraph, string package, string version, NuGetFramework framework, string runtimeIdentifier, RemoteWalkContext context, LocalPackageExtractor extractor) { var graphTask = independentGraph.Flattened .Where(m => m.Data?.Match?.Library?.Type == LibraryType.Package) .Select(GetRuntimeGraphTask); var graphs = (await Task.WhenAll(graphTask)) .Where(i => i != null); var runtimeGraph = graphs.Aggregate(RuntimeGraph.Empty, RuntimeGraph.Merge); // This results in additional entries var resultWin = await new RemoteDependencyWalker(context).WalkAsync( new LibraryRange(package, VersionRange.Parse(version), LibraryDependencyTarget.All), framework, runtimeGraph: runtimeGraph, recursive: true, runtimeIdentifier: runtimeIdentifier); return(RestoreTargetGraph.Create(runtimeGraph, new[] { resultWin }, context, context.Logger, framework, runtimeIdentifier)); async Task <RuntimeGraph> GetRuntimeGraphTask(GraphItem <RemoteResolveResult> item) { var packageIdentity = ToPackageIdentity(item.Data.Match); var localPackageSourceInfo = await extractor.EnsureLocalPackage(item.Data.Match.Provider, packageIdentity); return(localPackageSourceInfo?.Package?.RuntimeGraph); } }
public Task <LocalPackageSourceInfo> DownloadPackage(GraphItem <RemoteResolveResult> item) => _localPackageExtractor.EnsureLocalPackage(item.Data.Match.Provider, ToPackageIdentity(item.Data.Match));