Fix runtime targeting pack (#11582)

This commit is contained in:
Justin Kotalik 2019-06-26 13:09:08 -07:00 committed by GitHub
parent dab27e7867
commit 785cd9abb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -23,6 +23,10 @@ namespace RepoTasks
[Required] [Required]
public string TargetFile { get; set; } public string TargetFile { get; set; }
public string ManagedRoot { get; set; } = "";
public string NativeRoot { get; set; } = "";
/// <summary> /// <summary>
/// Extra attributes to place on the root node. /// Extra attributes to place on the root node.
/// ///
@ -46,7 +50,6 @@ namespace RepoTasks
{ {
Item = item, Item = item,
Filename = Path.GetFileName(item.ItemSpec), Filename = Path.GetFileName(item.ItemSpec),
TargetPath = item.GetMetadata("TargetPath"),
AssemblyName = FileUtilities.GetAssemblyName(item.ItemSpec), AssemblyName = FileUtilities.GetAssemblyName(item.ItemSpec),
FileVersion = FileUtilities.GetFileVersion(item.ItemSpec), FileVersion = FileUtilities.GetFileVersion(item.ItemSpec),
IsNative = item.GetMetadata("IsNativeImage") == "true", IsNative = item.GetMetadata("IsNativeImage") == "true",
@ -55,15 +58,14 @@ namespace RepoTasks
.Where(f => .Where(f =>
!f.IsSymbolFile && !f.IsSymbolFile &&
(f.Filename.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || f.IsNative)) (f.Filename.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || f.IsNative))
.OrderBy(f => f.TargetPath, StringComparer.Ordinal) .OrderBy(f => f.Filename, StringComparer.Ordinal))
.ThenBy(f => f.Filename, StringComparer.Ordinal))
{ {
var element = new XElement( var element = new XElement(
"File", "File",
new XAttribute("Type", f.IsNative ? "Native" : "Managed"), new XAttribute("Type", f.IsNative ? "Native" : "Managed"),
new XAttribute( new XAttribute(
"Path", "Path",
Path.Combine(f.TargetPath, f.Filename).Replace('\\', '/'))); Path.Combine(f.IsNative ? NativeRoot : ManagedRoot, f.Filename).Replace('\\', '/')));
if (f.AssemblyName != null) if (f.AssemblyName != null)
{ {

View File

@ -25,6 +25,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
<!-- NuGet appends target framework to this value. Example: runtimes/win-x64/lib/netcoreapp3.0/ --> <!-- NuGet appends target framework to this value. Example: runtimes/win-x64/lib/netcoreapp3.0/ -->
<BuildOutputTargetFolder>runtimes/$(RuntimeIdentifier)/lib/</BuildOutputTargetFolder> <BuildOutputTargetFolder>runtimes/$(RuntimeIdentifier)/lib/</BuildOutputTargetFolder>
<!-- We still need the native path to these assets though for the RuntimeList.xml manifest -->
<ManagedAssetsPackagePath>$(BuildOutputTargetFolder)$(DefaultNetCoreTargetFramework)</ManagedAssetsPackagePath>
<!-- Target framework is not append to this because native assets to not have a target framework. --> <!-- Target framework is not append to this because native assets to not have a target framework. -->
<NativeAssetsPackagePath>runtimes/$(RuntimeIdentifier)/native/</NativeAssetsPackagePath> <NativeAssetsPackagePath>runtimes/$(RuntimeIdentifier)/native/</NativeAssetsPackagePath>
@ -457,6 +459,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
<RepoTasks.CreateFrameworkListFile <RepoTasks.CreateFrameworkListFile
Files="@(SharedFxContent)" Files="@(SharedFxContent)"
TargetFile="$(FrameworkListOutputPath)" TargetFile="$(FrameworkListOutputPath)"
ManagedRoot="$(ManagedAssetsPackagePath)"
NativeRoot="$(NativeAssetsPackagePath)"
RootAttributes="@(FrameworkListRootAttributes)" /> RootAttributes="@(FrameworkListRootAttributes)" />
<ItemGroup> <ItemGroup>