-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Enable compiling with crossgen2 #31778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
34ea78a
04fbd5c
deb3c7d
6f32925
6348300
4232e63
687b77d
2c399f8
4be922e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
|
||
<!-- Optimize the framework using the crossgen tool --> | ||
<CrossgenOutput Condition=" '$(CrossgenOutput)' == '' AND '$(Configuration)' != 'Debug' ">true</CrossgenOutput> | ||
<UseCrossgen2>true</UseCrossgen2> | ||
|
||
<!-- Produce crossgen profiling symbols (.ni.pdb or .map files). --> | ||
<GenerateCrossgenProfilingSymbols>true</GenerateCrossgenProfilingSymbols> | ||
|
@@ -100,6 +101,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
<!-- Crossgen executable name --> | ||
<CrossgenToolFileName>crossgen</CrossgenToolFileName> | ||
<CrossgenToolFileName Condition=" '$(TargetOsName)' == 'win' ">$(CrossgenToolFileName).exe</CrossgenToolFileName> | ||
<Crossgen2ToolFileName>crossgen2</Crossgen2ToolFileName> | ||
<Crossgen2ToolFileName Condition=" '$(TargetOsName)' == 'win' ">$(Crossgen2ToolFileName).exe</Crossgen2ToolFileName> | ||
<!-- Default crossgen executable relative path --> | ||
<CrossgenToolPackagePath>$(CrossgenToolFileName)</CrossgenToolPackagePath> | ||
<!-- Disambiguated RID-specific crossgen executable relative path --> | ||
|
@@ -108,6 +111,11 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
<!-- E.g. "PkgMicrosoft_NETCore_App_Runtime_win-x64" (set in obj/Microsoft.AspNetCore.App.Runtime.csproj.nuget.g.props). --> | ||
<RuntimePackageRootVariableName>PkgMicrosoft_NETCore_App_Runtime_$(RuntimeIdentifier)</RuntimePackageRootVariableName> | ||
|
||
<BuildOsName>$(TargetOsName)</BuildOsName> | ||
<!-- linux-musl-arm and linux-musl-arm64 are built on an Ubuntu container with cross compilation tools. linux-musl-x64 is built in an alpine container --> | ||
<BuildOsName Condition="'$(TargetOsName)' == 'linux-musl' and '$(TargetArchitecture)'!='x64'">linux</BuildOsName> | ||
<Crossgen2PackageRootVariableName>PkgMicrosoft_NETCore_App_Crossgen2_$(BuildOsName)-$(BuildArchitecture)</Crossgen2PackageRootVariableName> | ||
|
||
<AssetTargetFallback>$(AssetTargetFallback);native,Version=0.0</AssetTargetFallback> | ||
|
||
<NativePlatform>$(TargetArchitecture)</NativePlatform> | ||
|
@@ -125,6 +133,11 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
PrivateAssets="All" | ||
GeneratePathProperty="true" /> | ||
|
||
<Reference Include="Microsoft.NETCore.App.Crossgen2.$(BuildOsName)-$(BuildArchitecture)" | ||
ExcludeAssets="All" | ||
PrivateAssets="All" | ||
GeneratePathProperty="true" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any possibility of removing the need for workarounds (hacks) like https://github.com/dotnet/aspnetcore/pull/31778/files#diff-eb8fd31a7971d712606a187ea074d0bd5d6ea85aae5a707107fd998216986ea5R117, https://github.com/dotnet/aspnetcore/pull/31778/files#diff-eb8fd31a7971d712606a187ea074d0bd5d6ea85aae5a707107fd998216986ea5R365-R368, and related bits in the future❔ |
||
|
||
<ProjectReference Condition=" '$(BuildIisNativeProjects)' == 'true' AND $(BuildNative) " | ||
Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj"> | ||
<SetPlatform>Platform=$(NativePlatform)</SetPlatform> | ||
|
@@ -349,10 +362,16 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
<RuntimePackageRootMapping> | ||
<RuntimePackageRoot>$(%(Identity))</RuntimePackageRoot> | ||
</RuntimePackageRootMapping> | ||
<Crossgen2PackageRootMapping Include="$(Crossgen2PackageRootVariableName)" /> | ||
<Crossgen2PackageRootMapping> | ||
<Crossgen2PackageRoot>$(%(Identity))</Crossgen2PackageRoot> | ||
</Crossgen2PackageRootMapping> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<RuntimePackageRoot>@(RuntimePackageRootMapping->'%(RuntimePackageRoot)')</RuntimePackageRoot> | ||
<RuntimePackageRoot>$([MSBuild]::EnsureTrailingSlash('$(RuntimePackageRoot)'))</RuntimePackageRoot> | ||
<Crossgen2PackageRoot>@(Crossgen2PackageRootMapping->'%(Crossgen2PackageRoot)')</Crossgen2PackageRoot> | ||
<Crossgen2PackageRoot>$([MSBuild]::EnsureTrailingSlash('$(Crossgen2PackageRoot)'))</Crossgen2PackageRoot> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
|
@@ -375,10 +394,18 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
|
||
<ReferenceCopyLocalPaths Remove="@(IntermediateCrossgenAssembly)" /> | ||
<ReferenceCopyLocalPaths Include="@(IntermediateCrossgenAssembly->'$(TargetDir)%(FileName)%(Extension)')" /> | ||
|
||
<_DistinctPlatformAssemblyPaths Include="@(_PlatformAssemblyPaths->Distinct())"/> | ||
<_DistinctPlatformAssemblyPaths> | ||
<CommandLineOption>-r:%(Identity)*.dll</CommandLineOption> | ||
</_DistinctPlatformAssemblyPaths> | ||
|
||
<Crossgen2PlatformAssemblyPaths Include="@(_DistinctPlatformAssemblyPaths->'%(CommandLineOption)')" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<CrossgenToolPath>$([System.IO.Path]::Combine('$(RuntimePackageRoot)', 'tools', '$(CrossgenToolPackagePath)'))</CrossgenToolPath> | ||
<CrossgenToolPath Condition="'$(UseCrossgen2)' != 'true'" >$([System.IO.Path]::Combine('$(RuntimePackageRoot)', 'tools', '$(CrossgenToolPackagePath)'))</CrossgenToolPath> | ||
<CrossgenToolPath Condition="'$(UseCrossgen2)' == 'true'" >$([System.IO.Path]::Combine('$(Crossgen2PackageRoot)', 'tools', '$(Crossgen2ToolFileName)'))</CrossgenToolPath> | ||
<CrossgenSymbolsTargetDir>$(TargetDir)</CrossgenSymbolsTargetDir> | ||
<CrossgenPlatformAssemblyPaths>@(_PlatformAssemblyPaths->Distinct(), '$(PathSeparator)')</CrossgenPlatformAssemblyPaths> | ||
|
||
|
@@ -392,15 +419,21 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
File="$(CrossgenToolDir)PlatformAssembliesPaths.rsp" | ||
Overwrite="true" /> | ||
|
||
<WriteLinesToFile | ||
Lines="@(Crossgen2PlatformAssemblyPaths)" | ||
File="$(CrossgenToolDir)PlatformAssembliesPathsCrossgen2.rsp" | ||
Overwrite="true" /> | ||
|
||
<ItemGroup> | ||
<RuntimePackageFiles Include="$(RuntimePackageRoot)runtimes\**\*" /> | ||
</ItemGroup> | ||
|
||
<Error Text="Could not find crossgen $(CrossgenToolPath)" Condition=" ! Exists($(CrossgenToolPath))" /> | ||
|
||
<!-- Create tool directory with crossgen executable and runtime assemblies --> | ||
<Copy SourceFiles="@(RuntimePackageFiles);$(CrossgenToolPath)" DestinationFolder="$(CrossGenToolDir)"/> | ||
<Exec Command="chmod +x "$(CrossGenToolDir)$(CrossgenToolFileName)"" Condition="'$(OS)' != 'Windows_NT'" /> | ||
<Copy SourceFiles="@(RuntimePackageFiles)" DestinationFolder="$(CrossGenToolDir)"/> | ||
<Copy Condition="'$(UseCrossgen2)' != 'true'" SourceFiles="$(CrossgenToolPath)" DestinationFolder="$(CrossGenToolDir)"/> | ||
<Exec Command="chmod +x "$(CrossGenToolDir)$(CrossgenToolFileName)"" Condition="'$(OS)' != 'Windows_NT' and '$(UseCrossgen2)' != 'true'" /> | ||
</Target> | ||
|
||
<Target Name="_BatchCrossGenAssemblies" | ||
|
@@ -413,18 +446,35 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
Condition="'$(CrossCompileDirectory)' == ''">$(RuntimePackageRoot)runtimes\$(RuntimeIdentifier)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath> | ||
<CoreCLRJitPath | ||
Condition="'$(CrossCompileDirectory)' != ''">$(RuntimePackageRoot)runtimes\$(CrossCompileDirectory)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath> | ||
|
||
<Crossgen2TargetOs>$(TargetOsName)</Crossgen2TargetOs> | ||
<Crossgen2TargetOs Condition="'$(TargetOsName)' == 'win'">windows</Crossgen2TargetOs> | ||
<Crossgen2TargetOs Condition="'$(TargetOsName)' == 'linux-musl'">linux</Crossgen2TargetOs> | ||
<Crossgen2Args>--targetarch:$(TargetArchitecture)</Crossgen2Args> | ||
<Crossgen2Args>$(Crossgen2Args) --targetos:$(Crossgen2TargetOs)</Crossgen2Args> | ||
<Crossgen2Args>$(Crossgen2Args) -O</Crossgen2Args> | ||
<Crossgen2Args>$(Crossgen2Args) @"$(CrossgenToolDir)PlatformAssembliesPathsCrossgen2.rsp"</Crossgen2Args> | ||
<Crossgen2Args Condition="Exists('$(RuntimePackageRoot)tools\StandardOptimizationData.mibc')">$(Crossgen2Args) "-m:$(RuntimePackageRoot)tools\StandardOptimizationData.mibc"</Crossgen2Args> | ||
dougbu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Crossgen2Args Condition="'$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(TargetOsName)' == 'win'">$(Crossgen2Args) --pdb --pdb-path:"$(CrossgenSymbolsTargetDir)"</Crossgen2Args> | ||
<Crossgen2Args Condition="'$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(TargetOsName)' != 'win'">$(Crossgen2Args) --perfmap --perfmap-path:"$(CrossgenSymbolsTargetDir)"</Crossgen2Args> | ||
</PropertyGroup> | ||
|
||
<Exec Command=""$(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in "%(IntermediateCrossgenAssembly.Identity)" -out "$(TargetDir)%(FileName)%(Extension)" -jitpath "$(CoreCLRJitPath)" "@$(CrossgenToolDir)PlatformAssembliesPaths.rsp"" | ||
<Exec Condition="'$(UseCrossgen2)' != 'true'" | ||
Command=""$(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in "%(IntermediateCrossgenAssembly.Identity)" -out "$(TargetDir)%(FileName)%(Extension)" -jitpath "$(CoreCLRJitPath)" "@$(CrossgenToolDir)PlatformAssembliesPaths.rsp"" | ||
EnvironmentVariables="COMPlus_PartialNGen=0" | ||
IgnoreStandardErrorWarningFormat="true" | ||
StandardOutputImportance="High" /> | ||
|
||
<Exec Condition=" '$(GenerateCrossgenProfilingSymbols)' == 'true' " | ||
<Exec Condition=" '$(GenerateCrossgenProfilingSymbols)' == 'true' and '$(UseCrossgen2)' != 'true'" | ||
Command=""$(CrossgenToolDir)$(CrossgenToolFileName)" -nologo -readytorun -in "$(TargetDir)%(IntermediateCrossgenAssembly.FileName)%(Extension)" -Create$(CrossGenSymbolsType) "$(CrossgenSymbolsTargetDir)" "@$(CrossgenToolDir)PlatformAssembliesPaths.rsp"" | ||
EnvironmentVariables="COMPlus_PartialNGen=0" | ||
IgnoreStandardErrorWarningFormat="true" | ||
StandardOutputImportance="High" /> | ||
|
||
<Exec Condition="'$(UseCrossgen2)' == 'true'" | ||
Command=""$(CrossgenToolPath)" $(Crossgen2Args) -o:"$(TargetDir)%(FileName)%(Extension)" "%(IntermediateCrossgenAssembly.Identity)"" | ||
IgnoreStandardErrorWarningFormat="true" | ||
StandardOutputImportance="High" /> | ||
</Target> | ||
|
||
<!-- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a particularly interesting change given we expect failures in the quarantined runs. Suggest instead removing
/p:CrossgenOutput=false
from the 'Tests: Helix x64' job's build steps in ci.yml. If thecrossgen2
'd assemblies are platform-specific with the command arguments you're currently using, I'd expect to see a lot of failures on Linux and macOS work items (ProjectTemplates.Test in particular) submitted from that job without the property setting.