Skip to content

Commit

Permalink
Build support for s390x: installers and packages (#53950)
Browse files Browse the repository at this point in the history
* Introduce "PrimaryRuntimeFlavor" concept, set to Mono for s390x

* Enable installers, packages, and archives when building the
  PrimaryRuntimeFlavor, even when this is Mono instead of CoreCLR

* Update default subsets in eng/Subsets.props to take
  PrimaryRuntimeFlavor into account

* Skip packaging singlefilehost when not available (due to building
  with the Mono runtime flavor)

* Only build the IL tools packages in coreclr-packages.proj
  when building with the Mono runtime flavor
  • Loading branch information
uweigand authored Jul 24, 2021
1 parent 4ee01db commit c2bd3ca
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 20 deletions.
28 changes: 19 additions & 9 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,24 @@
<_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+</_subset>
</PropertyGroup>

<!-- Determine the primary runtime flavor. This is usually CoreCLR, except on
platforms (like s390x) where only Mono is supported. The primary runtime
flavor is used to decide when to build the hosts and installers. -->
<PropertyGroup>
<PrimaryRuntimeFlavor>CoreCLR</PrimaryRuntimeFlavor>
<PrimaryRuntimeFlavor Condition="'$(TargetArchitecture)' == 's390x'">Mono</PrimaryRuntimeFlavor>
</PropertyGroup>

<PropertyGroup>
<RuntimeFlavor Condition="'$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">$(PrimaryRuntimeFlavor)</RuntimeFlavor>
</PropertyGroup>

<PropertyGroup>
<DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages</DefaultCoreClrSubsets>
<!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. -->
<DefaultCoreClrSubsets Condition="'$(PrimaryRuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets>

<DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
<DefaultMonoSubsets Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(MonoAOTLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
Expand All @@ -58,8 +68,8 @@

<DefaultHostSubsets>host.native+host.tools</DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(DotNetBuildFromSource)' != 'true'">$(DefaultHostSubsets)+host.pkg+host.tests</DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' == 'Mono'"></DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' == 'Mono' and '$(TargetsMobile)' != 'true'">host.native</DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'"></DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'">host.native</DefaultHostSubsets>

<DefaultPacksSubsets>packs.product</DefaultPacksSubsets>
<DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets>
Expand Down Expand Up @@ -225,7 +235,7 @@

<ItemGroup Condition="$(_subset.Contains('+clr.packages+')) and '$(PgoInstrument)' != 'true'">
<ProjectToBuild Include="$(CoreClrProjectRoot).nuget\coreclr-packages.proj" Pack="true" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo-pack.proj" Pack="true" BuildInParallel="false" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo-pack.proj" Pack="true" BuildInParallel="false" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(RuntimeFlavor)' != 'Mono'"/>
</ItemGroup>

<!-- Mono sets -->
Expand Down Expand Up @@ -317,16 +327,16 @@
</ItemGroup>
<ItemGroup Condition="'$(PgoInstrument)' != 'true'">
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" />
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" />
</ItemGroup>
<ItemGroup>
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
<ProjectToBuild Include="@(SharedFrameworkProjectToBuild)" Category="packs" />
</ItemGroup>
</When>
Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/.nuget/coreclr-packages.proj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
<ProjectReference Include="dotnet-ilverify\dotnet-ilverify.pkgproj" />
</ItemGroup>

<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(DotNetBuildFromSource)' != 'true'">
<ProjectReference Include="ILCompiler.Reflection.ReadyToRun.Experimental\ILCompiler.Reflection.ReadyToRun.Experimental.pkgproj" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
<ProjectReference Include="Microsoft.NETCore.TestHost\Microsoft.NETCore.TestHost.proj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.proj" />
<ProjectReference Include="Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.proj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

<ItemGroup>
<NativeBinary Include="$(DotNetHostBinDir)/apphost$(ExeSuffix)" />
<NativeBinary Include="$(DotNetHostBinDir)/singlefilehost$(ExeSuffix)" />
<NativeBinary Include="$(DotNetHostBinDir)/$(LibPrefix)nethost$(LibSuffix)" />
<NativeBinary Include="$(DotNetHostBinDir)/$(LibPrefix)nethost$(StaticLibSuffix)" />
<NativeBinary Include="$(DotNetHostBinDir)/coreclr_delegates.h" />
<NativeBinary Include="$(DotNetHostBinDir)/hostfxr.h" />
<NativeBinary Include="$(DotNetHostBinDir)/nethost.h" />
</ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'">
<NativeBinary Include="$(DotNetHostBinDir)/singlefilehost$(ExeSuffix)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'windows'">
<NativeBinary Include="$(DotNetHostBinDir)/comhost.dll" />
<NativeBinary Include="$(DotNetHostBinDir)/ijwhost.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<Target Name="ReturnProductVersion" Returns="$(Version)" />

<ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'">
<ItemGroup Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'">
<PackageReference Condition="'$(SkipInstallersPackageReference)' != 'true'" Include="Microsoft.DotNet.Build.Tasks.Installers" Version="$(MicrosoftDotNetBuildTasksInstallersVersion)" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Archives" Version="$(MicrosoftDotNetBuildTasksArchivesVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Sdk Name="Microsoft.DotNet.SharedFramework.Sdk" />

<PropertyGroup>
<SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</SkipBuild>
<SkipBuild Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">true</SkipBuild>
<PlatformPackageType>AppHostPack</PlatformPackageType>
<UseTemplatedPlatformManifest>true</UseTemplatedPlatformManifest>
<ArchiveName>dotnet-apphost-pack</ArchiveName>
Expand All @@ -21,13 +21,15 @@

<ItemGroup>
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/apphost$(ExeSuffix)" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/singlefilehost$(ExeSuffix)" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)nethost$(LibSuffix)" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)nethost$(StaticLibSuffix)" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/nethost.h" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/hostfxr.h" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/coreclr_delegates.h" />
</ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'">
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/singlefilehost$(ExeSuffix)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'windows'">
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/comhost.dll" />
<NativeRuntimeAsset Include="$(DotNetHostBinDir)/ijwhost.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<MacOSPackageDescription>The .NET Shared Framework</MacOSPackageDescription>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono' and '$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">
<RuntimeSpecificFrameworkSuffix>Mono</RuntimeSpecificFrameworkSuffix>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoEnableLLVM)' == 'true' and '$(RuntimeFlavor)' == 'Mono' and '$(TargetsMobile)' != 'true' and '$(TargetsBrowser)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name, used to generate the bundle upgrade code. Must stay the same to allow bundles in a given
product band to upgrade in place.
-->
<SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</SkipBuild>
<SkipBuild Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">true</SkipBuild>
<IsShipping Condition="'$(PgoInstrument)' == 'true'">false</IsShipping>
<BundleInstallerUpgradeCodeSeed>.NET Core Shared Framework Bundle Installer</BundleInstallerUpgradeCodeSeed>
<BundleThemeDirectory>$(MSBuildProjectDirectory)</BundleThemeDirectory>
Expand Down
2 changes: 1 addition & 1 deletion src/installer/pkg/sfx/installers/dotnet-host.proj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</SkipBuild>
<SkipBuild Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">true</SkipBuild>
<GenerateInstallers>true</GenerateInstallers>
<InstallerName>dotnet-host</InstallerName>
<InstallerName Condition="'$(TargetOS)' == 'OSX'">dotnet-host-internal</InstallerName>
Expand Down
2 changes: 1 addition & 1 deletion src/installer/pkg/sfx/installers/dotnet-hostfxr.proj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</SkipBuild>
<SkipBuild Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'">true</SkipBuild>
<GenerateInstallers>true</GenerateInstallers>
<ArchiveName>dotnet-hostfxr-internal</ArchiveName>
<InstallerName>dotnet-hostfxr</InstallerName>
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/pkg/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!-- Packages opt-in to automatic RID-specific builds by placing a *.RID.props next to their project
that defines the OfficialBuildRID item: all RIDs targeted by the package -->
<Import Project="$(MSBuildProjectDirectory)\*.rids.props" Condition="'$(BuildingAnOfficialBuildLeg)' != 'true' or '$(RuntimeFlavor)' != 'Mono'"/>
<Import Project="$(MSBuildProjectDirectory)\*.rids.props" Condition="'$(BuildingAnOfficialBuildLeg)' != 'true' or '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'"/>

<!-- create the "BuildRID" item which is the set of all supported RIDs, with metadata.
We'll add a RID for the current platform even if it isn't in the officially supported set -->
Expand Down

0 comments on commit c2bd3ca

Please sign in to comment.