-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Publish crossgen as AOT if supported by the target platform #65948
Changes from 20 commits
1c237a9
b3435c2
800b2d3
2509e2f
6a1c6ff
bdc0042
b4b7721
593dc27
449fbf4
c3b6fba
e210695
69ae018
a52f4ca
3fe8a1d
4c3f31a
07c2f6c
f2f45e6
35fa89a
5a8df96
497836e
9897beb
acb5fd5
9290f87
94c4545
349dccc
6333ee4
a8e28d0
4445b93
ff7c339
b897d68
1e111f5
8553fee
d8eeb9e
f682eae
202eee4
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 |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
<CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsWindows)' == 'true'">x86</CoreCLRCrossTargetComponentDirName> | ||
<CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> | ||
<CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'armel' and '$(BuildArchitecture)' != 'armel' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> | ||
<SingleFileHostSourcePath>$(CoreCLRArtifactsPath)/corehost/singlefilehost$(ExeSuffix)</SingleFileHostSourcePath> | ||
agocke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</PropertyGroup> | ||
|
||
<Target Name="ResolveRuntimeFilesFromLocalBuild"> | ||
|
@@ -223,4 +224,18 @@ | |
<PropertyGroup> | ||
<BundledRuntimeIdentifierGraphFile>$(RuntimeIdGraphDefinitionFile)</BundledRuntimeIdentifierGraphFile> | ||
</PropertyGroup> | ||
|
||
<Target Name="RewriteRuntimePackDir" | ||
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'm not thrilled with this approach -- I think we should move to a mechanism to have a "well-known" runtime pack that can be used and preferred over all others. This might require new SDK functionality, I'm not sure. Also, I'll have to update crossgen to build for net7.0 in that case. Not a big deal since we have a public preview out, but it's an interesting problem for net8.0, where we will have a net8.0 runtime pack, but no bootstrap SDK that would contain 8.0. 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. @jkoritzinsky would appreciate your feedback on this in particular 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. Honestly, this approach (re-pointing to the live runtime pack for the current RID) looks fine to me. Personally, I'd prefer that we require consuming projects to manually hook this target, especially since it's only used in once place. When we start work on .NET 8, this should still be handleable without much issue as our work to update framework references . Maybe we should refactor this into another |
||
Condition="'$(RunningPublish)' == 'true'" | ||
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild" | ||
BeforeTargets="ResolveRuntimePackAssets"> | ||
<ItemGroup> | ||
<!-- Remove AspNetCore runtime pack since we don't build it locally --> | ||
<ResolvedRuntimePack Remove="Microsoft.AspNetCore.App.Runtime.$(RuntimeIdentifier)" /> | ||
|
||
<ResolvedRuntimePack Update="Microsoft.NETCore.App.Runtime.$(RuntimeIdentifier)"> | ||
<PackageDirectory>$(MicrosoftNetCoreAppRuntimePackDir)</PackageDirectory> | ||
</ResolvedRuntimePack> | ||
</ItemGroup> | ||
</Target> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,10 @@ | |
<IsNativeAotProject Condition="$(MSBuildProjectDirectory.Contains('nativeaot'))">true</IsNativeAotProject> | ||
<BaseIntermediateOutputPath Condition="'$(IsNativeAotProject)' != 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'coreclr', '$(MSBuildProjectName)'))</BaseIntermediateOutputPath> | ||
<BaseIntermediateOutputPath Condition="'$(IsNativeAotProject)' == 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'coreclr', 'nativeaot', '$(MSBuildProjectName)'))</BaseIntermediateOutputPath> | ||
<IntermediateOutputPath Condition="'$(PlatformName)' == 'AnyCPU'">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath> | ||
<IntermediateOutputPath Condition="'$(PlatformName)' != 'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath> | ||
<IntermediateOutputPath Condition="'$(PlatformName)' == 'AnyCPU'">$(BaseIntermediateOutputPath)$(RuntimeConfiguration)\</IntermediateOutputPath> | ||
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. Why was this change needed? We don't appear to be using 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 think this is because we're now building crossgen from the packaging project, which doesn't necessarily set the same variables as the coreclr partition. I think this is more robust, although it may not be complete. Hopefully any problems should be easy to trace down, though, as the files will simply not appear in the right directories. 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. It looks like the CoreCLR partition expects someone already made it so that Configuration is populated from RuntimeConfiguration. Would it be more in line with the project file expectations to set Configuration=$(RuntimeConfiguration) as an AdditionalProperty in Microsoft.NETCore.App.Crossgen2.sfxproj? 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. Changed it, although I'm not sure this is robust going forward. I think it would make more sense for each partition to set the appropriate properties it needs to build, so it can be referenced transparently from anywhere, rather than have it set from the outside. Probably a broader change though. 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.
Yep, we would also have to make sure it keeps working when opening/building the CoreCLR projects with VS ( |
||
<IntermediateOutputPath Condition="'$(PlatformName)' != 'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(RuntimeConfiguration)\</IntermediateOutputPath> | ||
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir> | ||
<RuntimeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)'))</RuntimeBinDir> | ||
<RuntimeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)'))</RuntimeBinDir> | ||
|
||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<SignAssembly Condition="'$(UsingMicrosoftNETSdk)' != 'true'">false</SignAssembly> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project> | ||
|
||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<PropertyGroup> | ||
<OutputPath>$(RuntimeBinDir)/crossgen2</OutputPath> | ||
<!-- The default value for macOS is false --> | ||
<UseAppHost>true</UseAppHost> | ||
<AppHostRuntimeIdentifier>$(Crossgen2PackageRID)</AppHostRuntimeIdentifier> | ||
<OutputPath>$(RuntimeBinDir)crossgen2</OutputPath> | ||
<!-- Trimming is not currently working, but set the appropriate feature flags for NativeAOT --> | ||
<PublishTrimmed Condition="'$(NativeAotSupported)' == 'true'">true</PublishTrimmed> | ||
<RuntimeIdentifiers Condition="'$(RunningPublish)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers> | ||
</PropertyGroup> | ||
|
||
<Import Project="crossgen2.props" /> | ||
|
||
<PropertyGroup Condition="'$(NativeAotSupported)' != 'true'"> | ||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<!-- Disable crossgen on NetBSD, illumos and Solaris for now. This can be revisited when we have full support. --> | ||
<PublishReadyToRun Condition="'$(TargetOS)'=='NetBSD' Or '$(TargetOS)'=='illumos' Or '$(TargetOS)'=='Solaris'">false</PublishReadyToRun> | ||
<!-- Disable crossgen on FreeBSD when cross building from Linux. --> | ||
<PublishReadyToRun Condition="'$(TargetOS)'=='FreeBSD' and '$(CrossBuild)'=='true'">false</PublishReadyToRun> | ||
<PublishReadyToRunComposite>true</PublishReadyToRunComposite> | ||
</PropertyGroup> | ||
|
||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<PropertyGroup Condition="'$(NativeAotSupported)' == 'true'"> | ||
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> | ||
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> | ||
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">clang-9</CppCompilerAndLinker> | ||
<SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> | ||
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> | ||
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath> | ||
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</IlcFrameworkPath> | ||
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath> | ||
<TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
|
||
<!-- Forced by ILLink targets; we should fix the SDK --> | ||
<SelfContained Condition="'$(RunningPublish)' == 'true'">true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(R2ROverridePath)" Condition="'$(R2ROverridePath)' != ''" /> | ||
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets" | ||
Condition="'$(NativeAotSupported)' == 'true' and '$(RunningPublish)' == 'true'" /> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,16 +68,17 @@ | |
<TargetSpec>$(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries)</TargetSpec> | ||
|
||
<JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName> | ||
<CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == ''">$(RuntimeBinDir)$(CrossHostArch)</CoreCLRArtifactsPath> | ||
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. Nit: could you add the same comment as in ILCompiler.props? ( |
||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(JitInterfaceLibraryName)" | ||
<Content Include="$(CoreCLRArtifactsPath)/$(JitInterfaceLibraryName)" | ||
CopyToOutputDirectory="PreserveNewest" | ||
CopyToPublishDirectory="PreserveNewest" | ||
Link="%(FileName)%(Extension)" | ||
/> | ||
|
||
<Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" | ||
<Content Include="$(CoreCLRArtifactsPath)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" | ||
CopyToOutputDirectory="PreserveNewest" | ||
CopyToPublishDirectory="PreserveNewest" | ||
Link="%(FileName)%(Extension)" | ||
|
@@ -104,7 +105,9 @@ | |
<DiaSymReaderTargetArch>$(TargetArchitectureForSharedLibraries)</DiaSymReaderTargetArch> | ||
<DiaSymReaderTargetArch Condition="'$(DiaSymReaderTargetArch)' == 'x64'">amd64</DiaSymReaderTargetArch> | ||
<DiaSymReaderTargetArchFileName>Microsoft.DiaSymReader.Native.$(DiaSymReaderTargetArch).dll</DiaSymReaderTargetArchFileName> | ||
<DiaSymReaderTargetArchPath>$(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> | ||
<DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' != ''">$(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> | ||
<!-- When publishing we won't have the NuGet packages, so use the copy from the build artifacts directory. --> | ||
<DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' == ''">$(CoreCLRArtifactsPath)crossgen2/$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetOS)' == 'windows'"> | ||
|
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 is necessary because the RuntimeList.xml file is only created when running the libs.pretest subset.
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.
Why was the DotNetBuildFromSource condition added initially? Is removing it going to break source build?
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.
I tested it and couldn't find a problem. Not sure if there's any other testing I should be doing.
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.
DotNetBuildFromSource
skips this because it doesn't need a layout as it doesn't run tests. Shouldn't we get the xml manifests from the installer partition instead of relying on the test layouts?