ayaports/community/dotnet6-build/build_14816-non-portable-build.patch

208 lines
10 KiB
Diff

From 3008f7ef29e0a5593f6f0afbdc9343f573f1a375 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:04:07 -0500
Subject: [PATCH 1/3] Eliminate runtime portable build (backport dotnet#14549)
---
.../tarball/content/Directory.Build.props | 8 --
.../tarball/content/repos/aspnetcore.proj | 1 +
.../tarball/content/repos/installer.proj | 2 +-
.../tarball/content/repos/known-good.proj | 1 -
.../content/repos/runtime-portable.proj | 47 -----------
.../content/repos/runtime.common.props | 43 ----------
.../content/repos/runtime.common.targets | 46 -----------
.../tarball/content/repos/runtime.proj | 82 ++++++++++++++++++-
.../source-build-reference-packages.proj | 4 +-
src/redist/targets/Crossgen.targets | 2 +-
src/redist/targets/GenerateLayout.targets | 3 +
11 files changed, 88 insertions(+), 151 deletions(-)
delete mode 100644 repos/runtime-portable.proj
delete mode 100644 repos/runtime.common.props
delete mode 100644 repos/runtime.common.targets
diff --git a/Directory.Build.props b/Directory.Build.props
index 61cc6ff67..2e2d7e8bc 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,14 +22,6 @@
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<UseStableVersions Condition="'$(UseStableVersions)' == ''">false</UseStableVersions>
-
- <!-- new supported portable/nonportable options. These control whether to build portable runtime
- or portable SDK. The PortableBuild flag is only set in runtime-portable.proj and should
- no longer be passed in. -->
- <BuildPortableRuntime Condition="'$(BuildPortableRuntime)' == ''">false</BuildPortableRuntime>
- <BuildPortableSdk Condition="'$(BuildPortableSdk)' == ''">false</BuildPortableSdk>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == '' AND '$(PortableRuntime)' != 'true'">true</UseSystemLibraries>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == ''">false</UseSystemLibraries>
</PropertyGroup>
<!-- This repo's projects are entirely infrastructure and do not ship. -->
diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index 480f3c713..52243024a 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -9,6 +9,7 @@
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(TargetRid)</BuildCommandArgs>
<!-- Update to 1.0.0 version of reference assemblies which are built in SBRP instead of the preview.2 version
included by Arcade -->
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</BuildCommandArgs>
diff --git a/repos/installer.proj.orig b/repos/installer.proj
index 0df0c8f7c03..95d47c94152 100644
--- a/repos/installer.proj.orig
+++ b/repos/installer.proj
@@ -30,7 +30,7 @@
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
- <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=$(PortableRid)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=$(TargetRid)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
diff --git a/repos/known-good.proj b/repos/known-good.proj
index eab516290..12d9943da 100644
--- a/repos/known-good.proj
+++ b/repos/known-good.proj
@@ -44,7 +44,6 @@
<!-- Tier 2 -->
<RepositoryReference Include="linker" />
<RepositoryReference Include="msbuild" />
- <RepositoryReference Include="runtime-portable" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="templating" />
diff --git a/repos/runtime.proj b/repos/runtime.proj
index f3ed143f8..efd8b66fa 100644
--- a/repos/runtime.proj
+++ b/repos/runtime.proj
@@ -1,18 +1,53 @@
<Project>
- <Import Project="runtime.common.props"/>
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
+ <!-- Build arguments -->
<PropertyGroup>
+ <LogVerbosityOptOut>true</LogVerbosityOptOut>
+
+ <CleanCommand>$(ProjectDirectory)/clean$(ShellExtension)</CleanCommand>
+
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-x64</OverrideTargetRid>
+ <_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
+
+ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</BaseOS>
+
<BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TargetRid=$(OverrideTargetRid)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:RuntimeOS=$(RuntimeOS)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:BaseOS=$(BaseOS)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:SourceBuildNonPortable=true</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
</PropertyGroup>
+ <!-- Output / source-build flags -->
+ <PropertyGroup>
+ <GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
+ <NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
+ <OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
+ <DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
+ </PropertyGroup>
+
+ <!-- SDK Overrides -->
+ <ItemGroup>
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeCoreFxTestingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadePackagingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeTargetFrameworkSdkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSharedFrameworkSdkOverride)" />
+ </ItemGroup>
+
+ <!-- Environment Variables -->
+ <ItemGroup>
+ <EnvironmentVariables Include="BuildInParallel=false" />
+ </ItemGroup>
+
<!-- Repository References -->
<ItemGroup>
<RepositoryReference Include="arcade" />
@@ -20,8 +55,49 @@
<RepositoryReference Include="linker" />
<RepositoryReference Include="source-build" />
<RepositoryReference Include="roslyn" />
- <RepositoryReference Include="runtime-portable" />
</ItemGroup>
- <Import Project="runtime.common.targets" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddRidToRuntimeJson" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="PublishCoreSetupBinaries" />
+
+ <Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
+ <ItemGroup>
+ <PackagesOutputList Include="$(ShippingPackagesOutput)" />
+ <PackagesOutputList Include="$(NonShippingPackagesOutput)" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="UpdateRuntimeGraph"
+ BeforeTargets="Build"
+ Condition="'$(_IsBootstrapping)' == 'true'">
+ <PropertyGroup>
+ <RuntimeJsonFile>$(ProjectDirectory)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeJsonFile>
+ </PropertyGroup>
+
+ <Message Importance="High" Text="Adding rid, $(TargetRid), to $(RuntimeJsonFile)" />
+ <AddRidToRuntimeJson RuntimeJson="$(RuntimeJsonFile)"
+ Rid="$(TargetRid)-$(Platform)" />
+ </Target>
+
+ <Target Name="CopyBinariesToBinFolder"
+ AfterTargets="ExtractIntermediatePackages"
+ Inputs="$(MSBuildProjectFullPath)"
+ Outputs="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete">
+ <ItemGroup>
+ <_builtRuntimePackages Include="$(SourceBuiltAssetsDir)*.symbols.nupkg" />
+ <_builtRuntimePackages>
+ <TransformedFileName>$([System.String]::Copy('%(FileName)').Replace('symbols', 'nupkg'))</TransformedFileName>
+ </_builtRuntimePackages>
+ <BinariesToCopy Include="$(SourceBuiltAssetsDir)*.*" Exclude="$(SourceBuiltAssetsDir)*.nupkg;$(SourceBuiltAssetsDir)*.requires_nupkg_signing" />
+ <BinariesToCopy Include="@(_builtRuntimePackages->'$(SourceBuiltPackagesPath)%(TransformedFileName)')" />
+ </ItemGroup>
+
+ <Copy SourceFiles="@(BinariesToCopy)"
+ DestinationFolder="$(OutputPath)runtime"
+ Condition="'@(BinariesToCopy)'!=''" />
+
+ <WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete" Overwrite="true" />
+ </Target>
+
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
diff --git a/repos/source-build-reference-packages.proj b/repos/source-build-reference-packages.proj
index 69ab564a2..9545b50e4 100644
--- a/repos/source-build-reference-packages.proj
+++ b/repos/source-build-reference-packages.proj
@@ -2,7 +2,9 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
- <BuildCommand>$(StandardSourceBuildCommand) $(StandardSourceBuildArgs)</BuildCommand>
+ <BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetCoreIlasmPackageRuntimeId=$(NETCoreSdkRuntimeIdentifier)</BuildCommandArgs>
+ <BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
--
2.38.2