diff --git a/src/SourceBuild/content/repo-projects/aspnetcore.proj b/src/SourceBuild/content/repo-projects/aspnetcore.proj index 23b97ea1b3b4..b233630a252a 100644 --- a/src/SourceBuild/content/repo-projects/aspnetcore.proj +++ b/src/SourceBuild/content/repo-projects/aspnetcore.proj @@ -33,8 +33,6 @@ $(BuildArgs) $(FlagParameterPrefix)no-build-repo-tasks - - $(BuildArgs) /p:CrossgenOutput=false diff --git a/src/SourceBuild/patches/aspnetcore/0001-Use-host-live-crossgen2.patch b/src/SourceBuild/patches/aspnetcore/0001-Use-host-live-crossgen2.patch new file mode 100644 index 000000000000..d20e7fa9a1bd --- /dev/null +++ b/src/SourceBuild/patches/aspnetcore/0001-Use-host-live-crossgen2.patch @@ -0,0 +1,75 @@ +From d37bcaf1cc55f4dd34ddad48ad726fc413c1a25b Mon Sep 17 00:00:00 2001 +From: Jeremy Koritzinsky +Date: Fri, 13 Dec 2024 13:33:17 -0800 +Subject: [PATCH] In VMR builds, a host-SDK crossgen will always be + available. + +Backport: https://github.com/dotnet/aspnetcore/pull/59551 +--- +diff --git a/eng/targets/Sfx.Common.targets b/eng/targets/Sfx.Common.targets +index 5ff818b44f..f97b379391 100644 +--- a/eng/targets/Sfx.Common.targets ++++ b/eng/targets/Sfx.Common.targets +@@ -36,4 +36,13 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ $(NuGetPackageRoot)microsoft.netcore.platforms/$(MicrosoftNETCorePlatformsVersion)/PortableRuntimeIdentifierGraph.json ++ + +diff --git a/eng/tools/GenerateFiles/Directory.Build.targets.in b/eng/tools/GenerateFiles/Directory.Build.targets.in +index 88f09a8c89..4d56e7e3f1 100644 +--- a/eng/tools/GenerateFiles/Directory.Build.targets.in ++++ b/eng/tools/GenerateFiles/Directory.Build.targets.in +@@ -80,7 +80,8 @@ + ${MicrosoftNETCoreAppRuntimeVersion} +- $(TargetRuntimeIdentifier) ++ ++ %(RuntimePackRuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier);$(TargetRuntimeIdentifier) + + + +@@ -108,7 +109,7 @@ + + ${MicrosoftNETCoreAppRuntimeVersion} +- $(TargetRuntimeIdentifier) ++ %(Crossgen2RuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier);$(TargetRuntimeIdentifier) + + + +diff --git a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj +index 68d2861437..7d75aa7f8c 100644 +--- a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj ++++ b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj +@@ -15,8 +15,6 @@ + LatestPatch + + false +- +- false + true + + false +diff --git a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj +index d3160de441..533c6840f9 100644 +--- a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj ++++ b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj +@@ -15,8 +15,6 @@ + LatestPatch + + false +- +- false + true + + false diff --git a/src/SourceBuild/patches/runtime/0001-add-new-crossgen2-build-variant.patch b/src/SourceBuild/patches/runtime/0001-add-new-crossgen2-build-variant.patch new file mode 100644 index 000000000000..62651713c2d4 --- /dev/null +++ b/src/SourceBuild/patches/runtime/0001-add-new-crossgen2-build-variant.patch @@ -0,0 +1,538 @@ +From 25efc5179a47fcdb3551167ecd56b6af950abdc9 Mon Sep 17 00:00:00 2001 +From: Jeremy Koritzinsky +Date: Tue, 10 Dec 2024 13:40:42 -0800 +Subject: [PATCH] Add a new crossgen2 build variant for a published + crossgen2 targetting the host OS + +Backport: https://github.com/dotnet/runtime/pull/110676 +--- +diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props +index 86f8ce3b0ff..d4ace3ebb7c 100644 +--- a/eng/DotNetBuild.props ++++ b/eng/DotNetBuild.props +@@ -107,6 +107,9 @@ + + + $(InnerBuildArgs) /p:NetCoreAppToolCurrentVersion=$(NetCoreAppToolCurrentVersion) ++ ++ ++ $(InnerBuildArgs) /p:ShortStack=true + + + +diff --git a/eng/Signing.props b/eng/Signing.props +index c1ff2d8ba47..83d46fd57a7 100644 +--- a/eng/Signing.props ++++ b/eng/Signing.props +@@ -1,6 +1,6 @@ + + +- false ++ false + + + +@@ -27,10 +27,10 @@ + + + +- + +@@ -45,20 +45,37 @@ + + + ++ ++ ++ ++ + + +- +- +- %(FullPath).sha512 +- ++ ++ ++ ++ ++ ++ ++ %(FullPath).sha512 ++ ++ ++ ++ ++ ++ %(FullPath).sha512 ++ ++ ++ + + + ++ ++ + + + +diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj +index 714c1efafd5..ed54fc3cf11 100644 +--- a/src/coreclr/crossgen-corelib.proj ++++ b/src/coreclr/crossgen-corelib.proj +@@ -1,7 +1,7 @@ + + + +- ++ + + + +@@ -92,21 +92,13 @@ + + + +- +- +- +- %(Crossgen2.RootDir)/%(Crossgen2.Directory) +- +- +- +- +- ++ + + + + + +@@ -117,7 +109,7 @@ + Text="Generating native image of System.Private.CoreLib for $(OSPlatformConfig). Logging to $(CrossGenCoreLibLog)" /> + + +- $(DotNetCli) @(Crossgen2) ++ @(Crossgen2Files->Metadata('OutputPath')->WithMetadataValue('Filename','crossgen2')->WithMetadataValue('Extension','$(ExeSuffix)')) + $(CrossGenDllCmd) -o:$(CoreLibOutputPath) + $(CrossGenDllCmd) -r:$([MSBuild]::NormalizePath('$(BinDir)', 'IL', '*.dll')) + $(CrossGenDllCmd) --targetarch:$(TargetArchitecture) +diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_inbuild.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_inbuild.csproj +index bf997aa8ebb..5e19365fad1 100644 +--- a/src/coreclr/tools/aot/crossgen2/crossgen2_inbuild.csproj ++++ b/src/coreclr/tools/aot/crossgen2/crossgen2_inbuild.csproj +@@ -1,9 +1,20 @@ +- ++ + + $(BuildArchitecture) +- $(RuntimeBinDir)/$(BuildArchitecture)/crossgen2/ +- $(NetCoreAppToolCurrent) +- false ++ <_IsPublishing>true ++ $(NETCoreSdkRuntimeIdentifier) ++ $(RuntimeBinDir)$(BuildArchitecture)/crossgen2/ ++ true ++ true ++ ++ true ++ true ++ true ++ true ++ false + + + +diff --git a/src/installer/pkg/Directory.Build.props b/src/installer/pkg/Directory.Build.props +deleted file mode 100644 +index f5171867636..00000000000 +--- a/src/installer/pkg/Directory.Build.props ++++ /dev/null +@@ -1,21 +0,0 @@ +- +- +- +- +- $(TargetArchitecture) +- +- +- +- $(Platform) +- x64 +- +- $(MSBuildThisFileDirectory)packageIndex.json +- +- +- true +- +- +- +- +- +- +diff --git a/src/installer/pkg/Directory.Build.targets b/src/installer/pkg/Directory.Build.targets +deleted file mode 100644 +index 9a502b2705e..00000000000 +--- a/src/installer/pkg/Directory.Build.targets ++++ /dev/null +@@ -1,19 +0,0 @@ +- +- +- +- +- +- +- +- +- +diff --git a/src/installer/pkg/projects/Directory.Build.props b/src/installer/pkg/projects/Directory.Build.props +index a07b360efc0..08e5bde54a5 100644 +--- a/src/installer/pkg/projects/Directory.Build.props ++++ b/src/installer/pkg/projects/Directory.Build.props +@@ -2,6 +2,19 @@ + + + ++ ++ $(MSBuildThisFileDirectory)packageIndex.json ++ ++ ++ true ++ ++ ++ ++ ++ ++ ++ ++ $(TargetArchitecture) + AnyCPU + + true +diff --git a/src/installer/pkg/packageIndex.json b/src/installer/pkg/projects/packageIndex.json +similarity index 100% +rename from src/installer/pkg/packageIndex.json +rename to src/installer/pkg/projects/packageIndex.json +diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.Host.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.Host.sfxproj +new file mode 100644 +index 00000000000..6f7c19cda2d +--- /dev/null ++++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.Host.sfxproj +@@ -0,0 +1,11 @@ ++ ++ ++ ++ ++ $(RepoRoot)src/coreclr/tools/aot/crossgen2/crossgen2_inbuild.csproj ++ $(NETCoreSdkRuntimeIdentifier) ++ false ++ ++ ++ ++ +diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.props +new file mode 100644 +index 00000000000..a400c42adf2 +--- /dev/null ++++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.props +@@ -0,0 +1,53 @@ ++ ++ ++ ++ true ++ ToolPack ++ $(SharedFrameworkName).Crossgen2 ++ $(SharedFrameworkName).$(RuntimeIdentifier) ++ dotnet-crossgen2 ++ crossgen2 ++ false ++ true ++ ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ <_CrossgenPublishFiles Include="@(_RawCrossgenPublishFiles->'%(OutputPath)')" ++ KeepMetadata="REMOVE_ALL" /> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <_Crossgen2SymbolFilesToPackage Include="@(_CrossgenPublishFiles)" Condition="'%(Extension)' == '.pdb'" /> ++ ++ <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> ++ <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> ++ <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> ++ ++ <_SymbolFilesToPackage Include="@(_Crossgen2SymbolFilesToPackage)" TargetPath="tools/" /> ++ ++ ++ +diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +index c9d40b79d38..97e6737c777 100644 +--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj ++++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +@@ -1,51 +1,15 @@ +- +- +- ++ ++ + + +- +- true +- ToolPack +- $(SharedFrameworkName).Crossgen2 +- $(SharedFrameworkName).$(RuntimeIdentifier) +- dotnet-crossgen2 +- crossgen2 +- false +- tools/ +- true +- +- false ++ $(RepoRoot)src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj + + + + + + +- +- +- +- +- +- +- <_CrossgenPublishFiles Include="@(_RawCrossgenPublishFiles->'%(OutputPath)')" +- KeepMetadata="REMOVE_ALL" /> +- +- +- +- +- +- +- +- +- ++ + + +@@ -54,41 +18,4 @@ + + + +- +- +- unix +- win +- $(TargetOSComponent)-$(TargetArchitecture) +- +- +- +- +- <_Crossgen2SymbolFilesToPackage Include="@(_CrossgenPublishFiles)" Condition="'%(Extension)' == '.pdb'" /> +- +- <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> +- <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> +- <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> +- +- <_SymbolFilesToPackage Include="@(_Crossgen2SymbolFilesToPackage)" TargetPath="tools/" /> +- +- +- +- +- +- +- +- +- +- +- +- <_PackagedFilesToPublish Include="@(_FilesToPackage)" Condition="'%(_FilesToPackage.PackOnly)' != 'true'" /> +- +- +- +- +- +- + +diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/ReadyToRun.targets b/src/installer/pkg/sfx/Microsoft.NETCore.App/ReadyToRun.targets +index 09730ed2265..1e27f828c5b 100644 +--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/ReadyToRun.targets ++++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/ReadyToRun.targets +@@ -2,16 +2,14 @@ + + + 1 +- $([MSBuild]::NormalizePath('$(Crossgen2InBuildDir)', 'crossgen2.dll')) +- $(DotNetTool) ++ $([MSBuild]::NormalizePath('$(Crossgen2InBuildDir)', 'crossgen2$(ExeSuffix)')) + + + + + + +- +\ No newline at end of file ++ +diff --git a/src/installer/pkg/sfx/installers/dotnet-host.proj b/src/installer/pkg/sfx/installers/dotnet-host.proj +index 1d4b96ab335..26374305866 100644 +--- a/src/installer/pkg/sfx/installers/dotnet-host.proj ++++ b/src/installer/pkg/sfx/installers/dotnet-host.proj +@@ -20,7 +20,7 @@ + osx_scripts/host + The .NET Shared Host. + +- dotnet-host $(MajorVersion).$(MinorVersion) $(Platform) ++ dotnet-host $(MajorVersion).$(MinorVersion) $(TargetArchitecture) + + + +diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj +index 84e378bd855..580023b627f 100644 +--- a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj ++++ b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj +@@ -22,8 +22,19 @@ + + + ++ ++ ++ ++ ++ $(OutputRID.Split('-')[0]) ++ $(AdditionalRuntimeIdentifierParent.Split('-')[0]) ++ $(AdditionalRuntimeIdentifierParent) ++ ++ ++ + +- ++ ++ + + + +diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/UpdateRuntimeIdentifierGraph.cs b/src/libraries/Microsoft.NETCore.Platforms/src/UpdateRuntimeIdentifierGraph.cs +index 867da09df9b..182e724f4f9 100644 +--- a/src/libraries/Microsoft.NETCore.Platforms/src/UpdateRuntimeIdentifierGraph.cs ++++ b/src/libraries/Microsoft.NETCore.Platforms/src/UpdateRuntimeIdentifierGraph.cs +@@ -1,6 +1,7 @@ + // Licensed to the .NET Foundation under one or more agreements. + // The .NET Foundation licenses this file to you under the MIT license. + ++using System; + using System.IO; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; +@@ -40,7 +41,7 @@ public override bool Execute() + continue; + } + +- string[] importedRids = rid.GetMetadata("Imports").Split(';'); ++ string[] importedRids = rid.GetMetadata("Imports").Split([';'], StringSplitOptions.RemoveEmptyEntries); + runtimes.Add(rid.ItemSpec, new JObject(new JProperty("#import", new JArray(importedRids)))); + } + diff --git a/src/SourceBuild/patches/windowsdesktop/0001-use-live-crossgen2.patch b/src/SourceBuild/patches/windowsdesktop/0001-use-live-crossgen2.patch new file mode 100644 index 000000000000..6c3b53e28e60 --- /dev/null +++ b/src/SourceBuild/patches/windowsdesktop/0001-use-live-crossgen2.patch @@ -0,0 +1,74 @@ +From 1ef690888a7668a6c25ea3f0647ca06108e64d6b Mon Sep 17 00:00:00 2001 +From: Jeremy Koritzinsky +Date: Fri, 13 Dec 2024 13:40:47 -0800 +Subject: [PATCH 1/2] Use the live crossgen2 corresponding to the runtime we're + building against. + +Backport: https://github.com/dotnet/windowsdesktop/pull/4815 + +--- + src/windowsdesktop/src/sfx/Directory.Build.targets | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/windowsdesktop/src/sfx/Directory.Build.targets b/src/windowsdesktop/src/sfx/Directory.Build.targets +index ca14567ba..721779d78 100644 +--- a/src/windowsdesktop/src/sfx/Directory.Build.targets ++++ b/src/windowsdesktop/src/sfx/Directory.Build.targets +@@ -5,13 +5,19 @@ + + ++ + + + + ++ + + + + +From aa7933c4e56dae574cc2314d59561e32f9c12ebe Mon Sep 17 00:00:00 2001 +From: Jeremy Koritzinsky +Date: Fri, 13 Dec 2024 14:14:34 -0800 +Subject: [PATCH 2/2] Change style to enable referencing custom metadata + +--- + .../src/sfx/Directory.Build.targets | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/windowsdesktop/src/sfx/Directory.Build.targets b/src/windowsdesktop/src/sfx/Directory.Build.targets +index 721779d78..7da1ca224 100644 +--- a/src/windowsdesktop/src/sfx/Directory.Build.targets ++++ b/src/windowsdesktop/src/sfx/Directory.Build.targets +@@ -4,15 +4,15 @@ + + + ++ Update="Microsoft.NETCore.App"> ++ $(MicrosoftNETCoreAppRefVersion) ++ $(MicrosoftNETCoreAppRefVersion) ++ $(MicrosoftNETCoreAppRefVersion) ++ + ++ Update="Microsoft.NETCore.App.Crossgen2"> ++ $(MicrosoftNETCoreAppRefVersion) ++ + + +