Merge pull request #1318 from dotnet/pakrym/paths3

Fix build for full clr
This commit is contained in:
Pavel Krymets 2016-02-09 14:04:20 -08:00
commit 98b37fdd5e
3 changed files with 37 additions and 11 deletions

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
@ -79,10 +80,15 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
private static void CopyAllDependencies(string outputPath, LibraryExporter exporter) private static void CopyAllDependencies(string outputPath, LibraryExporter exporter)
{ {
exporter var libraryExports = exporter.GetAllExports();
.GetAllExports()
.SelectMany(e => e.RuntimeAssets()) libraryExports
.SelectMany(e => e.RuntimeAssemblies)
.CopyTo(outputPath); .CopyTo(outputPath);
libraryExports
.SelectMany(RuntimeAssets)
.StructuredCopyTo(outputPath);
} }
private static void WriteDepsFileAndCopyProjectDependencies( private static void WriteDepsFileAndCopyProjectDependencies(
@ -94,11 +100,24 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
.GetDependencies(LibraryType.Package) .GetDependencies(LibraryType.Package)
.WriteDepsTo(Path.Combine(outputPath, projectFileName + FileNameSuffixes.Deps)); .WriteDepsTo(Path.Combine(outputPath, projectFileName + FileNameSuffixes.Deps));
exporter var projectExports = exporter.GetAllExports()
.GetAllExports()
.Where(e => e.Library.Identity.Type == LibraryType.Project) .Where(e => e.Library.Identity.Type == LibraryType.Project)
.SelectMany(e => e.RuntimeAssets()) .ToArray();
projectExports
.SelectMany(e => e.RuntimeAssemblies)
.CopyTo(outputPath); .CopyTo(outputPath);
projectExports
.SelectMany(RuntimeAssets)
.StructuredCopyTo(outputPath);
}
private static IEnumerable<LibraryAsset> RuntimeAssets(LibraryExport export)
{
return export.NativeLibraries
.Union(export.RuntimeAssets);
} }
public void GenerateBindingRedirects(LibraryExporter exporter) public void GenerateBindingRedirects(LibraryExporter exporter)

View file

@ -40,13 +40,20 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
})); }));
} }
internal static IEnumerable<LibraryAsset> RuntimeAssets(this LibraryExport export) public static void CopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath)
{ {
return export.RuntimeAssemblies.Union(export.NativeLibraries) if (!Directory.Exists(destinationPath))
.Union(export.RuntimeAssets); {
Directory.CreateDirectory(destinationPath);
}
foreach (var asset in assets)
{
File.Copy(asset.ResolvedPath, Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath)), overwrite: true);
}
} }
public static void CopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath) public static void StructuredCopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath)
{ {
if (!Directory.Exists(destinationPath)) if (!Directory.Exists(destinationPath))
{ {

View file

@ -138,7 +138,7 @@ namespace Microsoft.DotNet.Tools.Publish
PublishFiles(export.RuntimeAssemblies, outputPath, nativeSubdirectories: false); PublishFiles(export.RuntimeAssemblies, outputPath, nativeSubdirectories: false);
PublishFiles(export.NativeLibraries, outputPath, nativeSubdirectories); PublishFiles(export.NativeLibraries, outputPath, nativeSubdirectories);
export.RuntimeAssets.CopyTo(outputPath); export.RuntimeAssets.StructuredCopyTo(outputPath);
if (options.PreserveCompilationContext.GetValueOrDefault()) if (options.PreserveCompilationContext.GetValueOrDefault())
{ {