Skip to content

Commit

Permalink
Allow building Mono Cross AOT compilers in the VMR (#109776)
Browse files Browse the repository at this point in the history
Introduce DotNetBuildMonoCrossAOT property to simplify the logic.
Also cleanup the similar logic for DotNetBuildRuntimeNativeAOTRuntimePack.

Contributes to dotnet/source-build#3902
  • Loading branch information
akoeplinger authored Nov 13, 2024
1 parent 25307d8 commit 15b3ca6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 80 deletions.
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@
<WasmCommonTargetsPath>$([MSBuild]::NormalizeDirectory($(WasmProjectRoot), 'build'))</WasmCommonTargetsPath>
</PropertyGroup>

<PropertyGroup Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">
<BuildNativeAOTRuntimePack>true</BuildNativeAOTRuntimePack>
<SkipLibrariesNativeRuntimePackages>true</SkipLibrariesNativeRuntimePackages>
</PropertyGroup>

<PropertyGroup Condition="'$(DotNetBuildMonoCrossAOT)' == 'true'">
<BuildMonoAOTCrossCompilerOnly>true</BuildMonoAOTCrossCompilerOnly>
<MonoCrossAOTTargetOS>android+browser+wasi</MonoCrossAOTTargetOS>
<MonoCrossAOTTargetOS Condition="'$(TargetOS)' == 'osx'">$(MonoCrossAOTTargetOS)+tvos+ios+maccatalyst</MonoCrossAOTTargetOS>
</PropertyGroup>

<PropertyGroup Label="CalculatePortableBuild">
<PortableBuild Condition="'$(PortableBuild)' == '' and '$(DotNetBuildSourceOnly)' == 'true'">false</PortableBuild>
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
Expand Down
3 changes: 2 additions & 1 deletion eng/DotNetBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) /p:BaseOS=$(BaseOS)</InnerBuildArgs>
<!-- Pass through special build modes controlled by properties -->
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(InnerBuildArgs) /p:WasmEnableThreads=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)s clr.nativeaotlibs+clr.nativeaotruntime+libs+packs /p:BuildNativeAOTRuntimePack=true /p:SkipLibrariesNativeRuntimePackages=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' != ''">$(InnerBuildArgs) /p:DotNetBuildRuntimeNativeAOTRuntimePack=$(DotNetBuildRuntimeNativeAOTRuntimePack)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildMonoEnableLLVM)' != ''">$(InnerBuildArgs) /p:MonoEnableLLVM=$(DotNetBuildMonoEnableLLVM)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildMonoAOTEnableLLVM)' != ''">$(InnerBuildArgs) /p:MonoAOTEnableLLVM=$(DotNetBuildMonoAOTEnableLLVM)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildMonoBundleLLVMOptimizer)' != ''">$(InnerBuildArgs) /p:MonoBundleLLVMOptimizer=$(DotNetBuildMonoBundleLLVMOptimizer)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildMonoCrossAOT)' != ''">$(InnerBuildArgs) /p:DotNetBuildMonoCrossAOT=$(DotNetBuildMonoCrossAOT)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(PgoInstrument)' == 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)pgoinstrument</InnerBuildArgs>

<!-- This prop needs to be passed to the inner build manually as the BaseInnerSourceBuildCommand gets overridden above -->
Expand Down
2 changes: 2 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<DefaultSubsets Condition="'$(TargetsLinuxBionic)' == 'true'">mono+libs+host+packs</DefaultSubsets>
<!-- In source build, mono is only supported as primary runtime flavor. On Windows mono is supported for x86/x64 only. -->
<DefaultSubsets Condition="('$(DotNetBuildSourceOnly)' == 'true' and '$(PrimaryRuntimeFlavor)' != 'Mono') or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' != 'x86' and '$(TargetArchitecture)' != 'x64')">clr+libs+tools+host+packs</DefaultSubsets>
<DefaultSubsets Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">clr.nativeaotlibs+clr.nativeaotruntime+libs+packs</DefaultSubsets>
<DefaultSubsets Condition="'$(DotNetBuildMonoCrossAOT)' == 'true'">mono+packs</DefaultSubsets>
</PropertyGroup>

<PropertyGroup>
Expand Down
41 changes: 2 additions & 39 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ extends:
- windows_arm64
jobParameters:
templatePath: 'templates-official'
buildArgs: -s clr.nativeaotlibs+clr.nativeaotruntime+libs+packs -c $(_BuildConfig) /p:BuildNativeAOTRuntimePack=true /p:SkipLibrariesNativeRuntimePackages=true
buildArgs: -c $(_BuildConfig) /p:DotNetBuildRuntimeNativeAOTRuntimePack=true
nameSuffix: NativeAOT
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
Expand Down Expand Up @@ -406,50 +406,13 @@ extends:
- linux_musl_x64
- linux_arm64
- linux_musl_arm64
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: MonoRuntimePacks

- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
runtimeFlavor: mono
buildConfig: release
platforms:
- windows_arm64
- windows_x64
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: MonoRuntimePacks

- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
runtimeFlavor: mono
buildConfig: release
platforms:
- osx_x64
- osx_arm64
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:BuildMonoAOTCrossCompilerOnly=true
buildArgs: -c $(_BuildConfig) /p:DotNetBuildMonoCrossAOT=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
isOfficialBuild: ${{ variables.isOfficialBuild }}
Expand Down
42 changes: 2 additions & 40 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ extends:
#
# Build Mono release AOT cross-compilers
# Only when mono changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
Expand All @@ -1190,51 +1191,12 @@ extends:
- linux_musl_x64
- linux_arm64
- linux_musl_arm64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
runtimeFlavor: mono
buildConfig: release
platforms:
- windows_arm64
- windows_x64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isRollingBuild'], true))
#
# Build Mono release AOT cross-compilers
# Only when mono changed
#

- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
runtimeFlavor: mono
buildConfig: release
platforms:
- osx_x64
- osx_arm64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:BuildMonoAOTCrossCompilerOnly=true
buildArgs: -c $(_BuildConfig) /p:DotNetBuildMonoCrossAOT=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
condition: >-
Expand Down

0 comments on commit 15b3ca6

Please sign in to comment.