aports/community/dotnet6-build/runtime_76068-use-generated-runtimejson-when-building-sharedframework.patch

84 lines
4.8 KiB
Diff

From c9f12d2718f68b94e63bbdece29bee61c643e497 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Fri, 23 Sep 2022 14:49:55 +0200
Subject: [PATCH 1/6] Use generated runtime.json when building shared framework
packages.
---
src/runtime/Directory.Build.props | 1 -
src/runtime/eng/liveBuilds.targets | 4 +++-
.../src/Microsoft.NETCore.Platforms.csproj | 6 +++---
src/runtime/src/libraries/pretest.proj | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/runtime/Directory.Build.props b/src/runtime/Directory.Build.props
index c815af204..790ee76a3 100644
--- a/src/runtime/Directory.Build.props
+++ b/src/runtime/Directory.Build.props
@@ -253,7 +253,6 @@
<PackageProjectUrl>https://dot.net</PackageProjectUrl>
<Owners>microsoft,dotnetframework</Owners>
<IncludeSymbols>true</IncludeSymbols>
- <RuntimeIdGraphDefinitionFile>$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</RuntimeIdGraphDefinitionFile>
<LicenseFile>$(MSBuildThisFileDirectory)LICENSE.TXT</LicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
diff --git a/src/runtime/eng/liveBuilds.targets b/src/runtime/eng/liveBuilds.targets
index d62f4bcd4..0834d63b1 100644
--- a/src/runtime/eng/liveBuilds.targets
+++ b/src/runtime/eng/liveBuilds.targets
@@ -193,6 +193,8 @@
</Target>
<PropertyGroup>
- <BundledRuntimeIdentifierGraphFile>$(RuntimeIdGraphDefinitionFile)</BundledRuntimeIdentifierGraphFile>
+ <!-- Keep in sync with outputs defined in Microsoft.NETCore.Platforms.csproj. -->
+ <BundledRuntimeIdentifierGraphFile>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Microsoft.NETCore.Platforms', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
+ <BundledRuntimeIdentifierGraphFile Condition="!Exists('$(BundledRuntimeIdentifierGraphFile)')">$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
</PropertyGroup>
</Project>
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
index 262b0aae1..637bc8261 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
@@ -41,7 +41,7 @@
<ItemGroup>
<Content Condition="'$(AdditionalRuntimeIdentifiers)' == ''" Include="runtime.json" PackagePath="/" />
- <Content Condition="'$(AdditionalRuntimeIdentifiers)' != ''" Include="$(IntermediateOutputPath)runtime.json" PackagePath="/" />
+ <Content Condition="'$(AdditionalRuntimeIdentifiers)' != ''" Include="$(BaseOutputPath)runtime.json" PackagePath="/" />
<Content Include="$(PlaceholderFile)" PackagePath="lib/netstandard1.0" />
</ItemGroup>
@@ -50,12 +50,12 @@
<PackageReference Include="NuGet.ProjectModel" Version="$(NugetProjectModelVersion)" />
</ItemGroup>
- <Target Name="GenerateRuntimeJson" Condition="'$(AdditionalRuntimeIdentifiers)' != ''" BeforeTargets="GenerateNuspec">
+ <Target Name="GenerateRuntimeJson" AfterTargets="Build" Condition="'$(AdditionalRuntimeIdentifiers)' != ''">
<MakeDir Directories="$(IntermediateOutputPath)" />
<GenerateRuntimeGraph RuntimeGroups="@(RuntimeGroupWithQualifiers)"
AdditionalRuntimeIdentifiers="$(AdditionalRuntimeIdentifiers)"
AdditionalRuntimeIdentifierParent="$(AdditionalRuntimeIdentifierParent)"
- RuntimeJson="$(IntermediateOutputPath)runtime.json"
+ RuntimeJson="$(BaseOutputPath)runtime.json"
UpdateRuntimeFiles="True" />
</Target>
diff --git a/src/runtime/src/libraries/pretest.proj b/src/runtime/src/libraries/pretest.proj
index fc2fee13d..ee9473523 100644
--- a/src/runtime/src/libraries/pretest.proj
+++ b/src/runtime/src/libraries/pretest.proj
@@ -92,7 +92,7 @@
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<!-- Shared framework deps file generation. Produces a test shared-framework deps file. -->
<GenerateTestSharedFrameworkDepsFile SharedFrameworkDirectory="$(NetCoreAppCurrentTestHostSharedFrameworkPath)"
- RuntimeGraphFiles="$(RuntimeIdGraphDefinitionFile)"
+ RuntimeGraphFiles="$(BundledRuntimeIdentifierGraphFile)"
TargetRuntimeIdentifier="$(PackageRID)" />
</Target>
--
2.38.0