Skip to content

Commit fb651ae

Browse files
committed
Add NativeAOT runtime pack build for iOS/tvOS/Catalyst
Contributes to #81024
1 parent 926062a commit fb651ae

File tree

7 files changed

+78
-16
lines changed

7 files changed

+78
-16
lines changed

eng/Subsets.props

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,24 +481,28 @@
481481

482482
<Choose>
483483
<When Condition="$(_subset.Contains('+packs.product+'))">
484-
<ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'">
484+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(RuntimeFlavor)' != 'Mono'">
485485
<SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.Composite.sfxproj" />
486486
<SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Composite.Bundle.bundleproj" />
487487
</ItemGroup>
488488
<ItemGroup Condition="'$(PgoInstrument)' != 'true'">
489489
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" />
490+
</ItemGroup>
491+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true'">
490492
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" />
491493
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
492494
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
493495
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
494496
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" />
495497
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\archives\dotnet-nethost.proj" />
496498
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" />
499+
</ItemGroup>
500+
<ItemGroup>
497501
<ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)\pkg\projects\nativeaot-packages.proj" Category="packs" />
498502
</ItemGroup>
499503
<ItemGroup>
500504
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" />
501-
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
505+
<SharedFrameworkProjectToBuild Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
502506
<ProjectToBuild Include="@(SharedFrameworkProjectToBuild)" Category="packs" />
503507
</ItemGroup>
504508
</When>

eng/liveBuilds.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@
7777
<MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)'))</MonoArtifactsPath>
7878
</PropertyGroup>
7979

80-
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
80+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' == 'true'">
81+
<_nativeAotRuntimeFiles Include="$(CoreCLRAotSdkDir)*" />
82+
<RuntimeFiles Include="@(_nativeAotRuntimeFiles)" Condition="'%(Extension)' != '.xml'">
83+
<IsNative>true</IsNative>
84+
</RuntimeFiles>
85+
</ItemGroup>
86+
87+
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(BuildNativeAOTRuntimePack)' != 'true'">
8188
<RuntimeFiles Include="$(CoreCLRSharedFrameworkDir)*.*" />
8289
<RuntimeFiles Condition="'$(PgoInstrument)' == 'true'" Include="$(CoreCLRSharedFrameworkDir)PGD/*" />
8390
<CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include="$(CoreCLRCrossTargetComponentDir)*.*" IsNative="true" />

eng/pipelines/runtime-official.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,31 @@ extends:
9797
- windows_x64
9898
- windows_arm
9999
- windows_arm64
100+
101+
#
102+
# Build NativeAOT runtime packs
103+
#
104+
- template: /eng/pipelines/common/platform-matrix.yml
105+
parameters:
106+
jobTemplate: /eng/pipelines/common/global-build-job.yml
107+
buildConfig: release
108+
platforms:
109+
- maccatalyst_x64
110+
- maccatalyst_arm64
111+
- tvossimulator_x64
112+
- tvossimulator_arm64
113+
- tvos_arm64
114+
- iossimulator_x64
115+
- iossimulator_arm64
116+
- ios_arm64
117+
jobParameters:
118+
buildArgs: -s clr.nativeaotlibs+clr.nativeaotruntime+libs+packs -c $(_BuildConfig) /p:BuildNativeAOTRuntimePack=true
119+
nameSuffix: AllSubsets_NativeAOT
120+
isOfficialBuild: ${{ variables.isOfficialBuild }}
121+
extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
122+
extraStepsParameters:
123+
name: NativeAOTRuntimePacks
124+
100125
#
101126
# Build Mono runtime packs
102127
#

src/coreclr/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ endif()
126126
#----------------------------------------------------
127127
# Build the test watchdog alongside the CLR
128128
#----------------------------------------------------
129-
add_subdirectory("${CLR_SRC_NATIVE_DIR}/watchdog" test-watchdog)
129+
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
130+
add_subdirectory("${CLR_SRC_NATIVE_DIR}/watchdog" test-watchdog)
131+
endif()
130132

131133
# Add this subdir. We install the headers for the jit.
132134
add_subdirectory(pal/prebuilt/inc)

src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/Microsoft.DotNet.ILCompiler.pkgproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<ItemGroup>
2828
<File Include="$(CoreCLRBuildIntegrationDir)*" TargetPath="build" />
2929
<File Include="$(CoreCLRILCompilerDir)netstandard\*" TargetPath="tools/netstandard" />
30-
<File Include="sdk\Sdk.props" TargetPath="Sdk" />
30+
<File Include="sdk\Sdk.props" TargetPath="sdk" />
3131
</ItemGroup>
3232
</Target>
3333

src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,20 @@
174174
<PlatformManifestFileEntry Include="Microsoft.DiaSymReader.Native.amd64.dll" IsNative="true" FallbackFileVersion="$(MicrosoftDiaSymReaderNativeFileVersion)" />
175175
<PlatformManifestFileEntry Include="Microsoft.DiaSymReader.Native.arm.dll" IsNative="true" FallbackFileVersion="$(MicrosoftDiaSymReaderNativeFileVersion)" />
176176
<PlatformManifestFileEntry Include="Microsoft.DiaSymReader.Native.arm64.dll" IsNative="true" FallbackFileVersion="$(MicrosoftDiaSymReaderNativeFileVersion)" />
177+
<!-- NativeAOT specific files -->
178+
<PlatformManifestFileEntry Include="libbootstrapper.a" IsNative="true" />
179+
<PlatformManifestFileEntry Include="libbootstrapperdll.a" IsNative="true" />
180+
<PlatformManifestFileEntry Include="libeventpipe-disabled.a" IsNative="true" />
181+
<PlatformManifestFileEntry Include="libeventpipe-enabled.a" IsNative="true" />
182+
<PlatformManifestFileEntry Include="libnumasupportdynamic.a" IsNative="true" />
183+
<PlatformManifestFileEntry Include="libnumasupportstatic.a" IsNative="true" />
184+
<PlatformManifestFileEntry Include="libRuntime.ServerGC.a" IsNative="true" />
185+
<PlatformManifestFileEntry Include="libRuntime.WorkstationGC.a" IsNative="true" />
186+
<PlatformManifestFileEntry Include="libstdc++compat.a" IsNative="true" />
187+
<PlatformManifestFileEntry Include="System.Private.DisabledReflection.dll" />
188+
<PlatformManifestFileEntry Include="System.Private.Reflection.Execution.dll" />
189+
<PlatformManifestFileEntry Include="System.Private.StackTraceMetadata.dll" />
190+
<PlatformManifestFileEntry Include="System.Private.TypeLoader.dll" />
177191
<!-- Mono-specific files -->
178192
<PlatformManifestFileEntry Include="monosgen-2.0.lib" IsNative="true" />
179193
<PlatformManifestFileEntry Include="libmonosgen-2.0.a" IsNative="true" />

src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
AddRuntimeFilesToPackage;
66
AddFrameworkFilesToPackage
77
</GetSharedFrameworkFilesForReadyToRunDependsOn>
8-
<PublishReadyToRun Condition="'$(RuntimeFlavor)' != 'Mono'">true</PublishReadyToRun>
9-
<PublishReadyToRun Condition="'$(RuntimeFlavor)' == 'Mono'">false</PublishReadyToRun>
8+
<PublishReadyToRun Condition="'$(RuntimeFlavor)' != 'Mono' and '$(BuildNativeAOTRuntimePack)' != 'true'">true</PublishReadyToRun>
9+
<PublishReadyToRun Condition="'$(RuntimeFlavor)' == 'Mono' or '$(BuildNativeAOTRuntimePack)' == 'true'">false</PublishReadyToRun>
1010
<!-- Disable crossgen on NetBSD, illumos and Solaris for now. This can be revisited when we have full support. -->
1111
<PublishReadyToRun Condition="'$(TargetOS)' == 'netbsd' or '$(TargetOS)' == 'illumos' or '$(TargetOS)' == 'solaris'">false</PublishReadyToRun>
1212
<!-- Disable crossgen on FreeBSD when cross building from Linux. -->
@@ -17,6 +17,9 @@
1717
<MacOSPackageDescription>The .NET Shared Framework</MacOSPackageDescription>
1818
</PropertyGroup>
1919

20+
<PropertyGroup Condition="'$(BuildNativeAOTRuntimePack)' == 'true'">
21+
<RuntimeSpecificFrameworkSuffix>NativeAOT</RuntimeSpecificFrameworkSuffix>
22+
</PropertyGroup>
2023
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono' and '$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">
2124
<RuntimeSpecificFrameworkSuffix>Mono</RuntimeSpecificFrameworkSuffix>
2225
</PropertyGroup>
@@ -38,7 +41,7 @@
3841
We add the entries here to ensure that we don't fail the validation that every file included in the runtime pack is in the platform manifest
3942
without adding the entries to the manifest in the ref pack.
4043
-->
41-
<ItemGroup>
44+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true'">
4245
<PlatformManifestFileEntry Include="hostpolicy.dll" IsNative="true" />
4346
<PlatformManifestFileEntry Include="libhostpolicy.so" IsNative="true" />
4447
<PlatformManifestFileEntry Include="libhostpolicy.dylib" IsNative="true" />
@@ -47,14 +50,18 @@
4750
<PlatformManifestFileEntry Include="libhostfxr.dylib" IsNative="true" />
4851
</ItemGroup>
4952

53+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' == 'true'">
54+
<IgnoredDuplicateType Include="Internal.Runtime.CompilerHelpers.LibraryInitializer" />
55+
</ItemGroup>
56+
5057
<Target Name="AddLinuxPackageInformation" BeforeTargets="GetDebInstallerJsonProperties;GetRpmInstallerJsonProperties">
5158
<ItemGroup>
5259
<LinuxPackageDependency Include="dotnet-hostfxr-$(MajorVersion).$(MinorVersion);dotnet-runtime-deps-$(MajorVersion).$(MinorVersion)" Version="$(InstallerPackageVersion)" />
5360
</ItemGroup>
5461
</Target>
5562

56-
<!-- Mobile uses a different hosting model, so we don't include the .NET host components. -->
57-
<ItemGroup Condition="'$(TargetsMobile)' != 'true'">
63+
<!-- Mobile and NativeAOT use a different hosting model, so we don't include the .NET host components. -->
64+
<ItemGroup Condition="'$(TargetsMobile)' != 'true' and '$(BuildNativeAOTRuntimePack)' != 'true'">
5865
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)hostpolicy$(LibSuffix)" />
5966
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)hostfxr$(LibSuffix)" PackOnly="true" />
6067
</ItemGroup>
@@ -64,7 +71,8 @@
6471
<RuntimeFiles Condition="'%(RuntimeFiles.IsNative)' == 'true'">
6572
<TargetPath>runtimes/$(RuntimeIdentifier)/native</TargetPath>
6673
</RuntimeFiles>
67-
74+
</ItemGroup>
75+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true'">
6876
<RuntimeFiles Condition="'%(FileName)' == 'crossgen'">
6977
<TargetPath>tools</TargetPath>
7078
</RuntimeFiles>
@@ -87,7 +95,7 @@
8795
<TargetPath>runtimes/$(RuntimeIdentifier)/native/Mono.debug.framework/%(RecursiveDir)</TargetPath>
8896
</RuntimeFiles>
8997

90-
<RuntimeFiles Condition="'$(RuntimeFlavor)' == 'mono'"
98+
<RuntimeFiles Condition="'$(RuntimeFlavor)' == 'Mono'"
9199
Include="$(MonoArtifactsPath)\build\**\*.*"
92100
ExcludeFromDataFiles="true">
93101
<TargetPath>runtimes/$(RuntimeIdentifier)/build/%(RecursiveDir)</TargetPath>
@@ -110,6 +118,8 @@
110118
Condition="Exists('$(CoreCLRArtifactsPath)StandardOptimizationData.mibc')">
111119
<TargetPath>tools</TargetPath>
112120
</CoreCLROptimizationFiles>
121+
</ItemGroup>
122+
<ItemGroup>
113123
<ReferenceCopyLocalPaths Include="@(RuntimeFiles);@(CoreCLRCrossTargetFiles);@(CoreCLROptimizationFiles)" />
114124
</ItemGroup>
115125
</Target>
@@ -123,7 +133,7 @@
123133
</ItemGroup>
124134
</Target>
125135

126-
<PropertyGroup Condition="'$(TargetOS)' == 'windows'">
136+
<PropertyGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(TargetOS)' == 'windows'">
127137
<!-- DiaSymReader for the host architecture, which is used for [cross-]compilation -->
128138
<_diaSymArch>$(_hostArch)</_diaSymArch>
129139
<_diaSymReaderPath>$(PkgMicrosoft_DiaSymReader_Native)/runtimes/win/native/Microsoft.DiaSymReader.Native.$(_diaSymArch).dll</_diaSymReaderPath>
@@ -134,7 +144,7 @@
134144
<_diaSymReaderTargetArchPath>$(PkgMicrosoft_DiaSymReader_Native)/runtimes/win/native/Microsoft.DiaSymReader.Native.$(_diaSymTargetArch).dll</_diaSymReaderTargetArchPath>
135145
</PropertyGroup>
136146

137-
<ItemGroup Condition="'$(TargetOS)' == 'windows'">
147+
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(TargetOS)' == 'windows'">
138148
<NativeRuntimeAsset Include="$(_diaSymReaderTargetArchPath)" />
139149
<NativeRuntimeAsset Include="$(_diaSymReaderPath)" Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">
140150
<TargetPath>runtimes/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath>
@@ -160,10 +170,10 @@
160170
</ItemGroup>
161171
</Target>
162172

163-
<Import Project="$(Crossgen2SdkOverridePropsPath)" Condition="'$(Crossgen2SdkOverridePropsPath)' != ''" />
173+
<Import Project="$(Crossgen2SdkOverridePropsPath)" Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(Crossgen2SdkOverridePropsPath)' != ''" />
164174
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
165175
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.SharedFramework.Sdk" />
166-
<Import Project="$(Crossgen2SdkOverrideTargetsPath)" Condition="'$(Crossgen2SdkOverrideTargetsPath)' != ''" />
176+
<Import Project="$(Crossgen2SdkOverrideTargetsPath)" Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(Crossgen2SdkOverrideTargetsPath)' != ''" />
167177
<PropertyGroup>
168178
<PublishReadyToRunComposite Condition="$(ForcePublishReadyToRunComposite) == 'true'">true</PublishReadyToRunComposite>
169179
</PropertyGroup>

0 commit comments

Comments
 (0)