(TaskGraph graph, Target target, BuildOptions targetBuildOptions, string outputPath)
| 427 | } |
| 428 | |
| 429 | private static void DeployFiles(TaskGraph graph, Target target, BuildOptions targetBuildOptions, string outputPath) |
| 430 | { |
| 431 | using (new ProfileEventScope("DeployFiles")) |
| 432 | { |
| 433 | foreach (var srcFile in targetBuildOptions.OptionalDependencyFiles.Where(File.Exists).Union(targetBuildOptions.DependencyFiles)) |
| 434 | { |
| 435 | var dstFile = Path.Combine(outputPath, Path.GetFileName(srcFile)); |
| 436 | graph.AddCopyFile(dstFile, srcFile); |
| 437 | } |
| 438 | |
| 439 | if (targetBuildOptions.NugetPackageReferences.Any()) |
| 440 | { |
| 441 | // Find all packages to deploy (incl. dependencies) and restore if needed |
| 442 | var nugetPath = Utilities.GetNugetPackagesPath(); |
| 443 | Log.Verbose($"Deploying NuGet packages from {nugetPath}"); |
| 444 | var restoreOnce = true; |
| 445 | var nugetFiles = new HashSet<string>(); |
| 446 | foreach (var reference in targetBuildOptions.NugetPackageReferences) |
| 447 | { |
| 448 | var folder = reference.GetLibFolder(nugetPath); |
| 449 | if (!Directory.Exists(folder) && restoreOnce) |
| 450 | { |
| 451 | // Package binaries folder is missing so restore packages (incl. dependency packages) |
| 452 | RestoreNugetPackages(graph, target, targetBuildOptions); |
| 453 | restoreOnce = false; |
| 454 | } |
| 455 | |
| 456 | DeployNuGetPackage(nugetPath, targetBuildOptions, nugetFiles, reference, folder); |
| 457 | } |
| 458 | |
| 459 | // Copy libraries from all referenced packages to the output folder |
| 460 | foreach (var file in nugetFiles) |
| 461 | { |
| 462 | var dstFile = Path.Combine(outputPath, Path.GetFileName(file)); |
| 463 | graph.AddCopyFile(dstFile, file); |
| 464 | } |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | private static void RestoreNugetPackages(TaskGraph graph, Target target, BuildOptions targetBuildOptions) |
| 470 | { |
nothing calls this directly
no test coverage detected