Merge pull request #1318 from dotnet/pakrym/paths3
Fix build for full clr
This commit is contained in:
commit
98b37fdd5e
3 changed files with 37 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
@ -79,10 +80,15 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
|||
|
||||
private static void CopyAllDependencies(string outputPath, LibraryExporter exporter)
|
||||
{
|
||||
exporter
|
||||
.GetAllExports()
|
||||
.SelectMany(e => e.RuntimeAssets())
|
||||
var libraryExports = exporter.GetAllExports();
|
||||
|
||||
libraryExports
|
||||
.SelectMany(e => e.RuntimeAssemblies)
|
||||
.CopyTo(outputPath);
|
||||
|
||||
libraryExports
|
||||
.SelectMany(RuntimeAssets)
|
||||
.StructuredCopyTo(outputPath);
|
||||
}
|
||||
|
||||
private static void WriteDepsFileAndCopyProjectDependencies(
|
||||
|
@ -94,11 +100,24 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
|||
.GetDependencies(LibraryType.Package)
|
||||
.WriteDepsTo(Path.Combine(outputPath, projectFileName + FileNameSuffixes.Deps));
|
||||
|
||||
exporter
|
||||
.GetAllExports()
|
||||
var projectExports = exporter.GetAllExports()
|
||||
.Where(e => e.Library.Identity.Type == LibraryType.Project)
|
||||
.SelectMany(e => e.RuntimeAssets())
|
||||
.ToArray();
|
||||
|
||||
projectExports
|
||||
.SelectMany(e => e.RuntimeAssemblies)
|
||||
.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)
|
||||
|
|
|
@ -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)
|
||||
.Union(export.RuntimeAssets);
|
||||
if (!Directory.Exists(destinationPath))
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
|
|
@ -138,7 +138,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
|
||||
PublishFiles(export.RuntimeAssemblies, outputPath, nativeSubdirectories: false);
|
||||
PublishFiles(export.NativeLibraries, outputPath, nativeSubdirectories);
|
||||
export.RuntimeAssets.CopyTo(outputPath);
|
||||
export.RuntimeAssets.StructuredCopyTo(outputPath);
|
||||
|
||||
if (options.PreserveCompilationContext.GetValueOrDefault())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue