Skip to content

Commit

Permalink
Add build configuration to generate runtime packs for iOS (#34050)
Browse files Browse the repository at this point in the history
This adds support for generating Microsoft.NETCore.App.Runtime packs for ios-x64, ios-arm, and ios-arm64.
  • Loading branch information
steveisok authored Apr 2, 2020
1 parent 6a27404 commit 61d1e78
Show file tree
Hide file tree
Showing 25 changed files with 162 additions and 62 deletions.
7 changes: 5 additions & 2 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@

<PropertyGroup>
<DefaultSubsetCategories>libraries-installer-coreclr-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">libraries-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS'">libraries-installer-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'Android'">libraries-mono</DefaultSubsetCategories>
<DefaultInstallerSubsets>corehost-managed-depproj-pkgproj-bundle-installers-test</DefaultInstallerSubsets>
<DefaultInstallerSubsets Condition="'$(TargetOS)' == 'iOS'">depproj-pkgproj</DefaultInstallerSubsets>
<!-- TODO: Split into multiple sets. -->
<DefaultLibrariesSubsets>all</DefaultLibrariesSubsets>
<DefaultCoreClrSubsets>runtime-linuxdac-corelib-nativecorelib-tools-packages</DefaultCoreClrSubsets>
Expand Down Expand Up @@ -218,7 +220,8 @@
</ItemGroup>

<ItemGroup Condition="$(_subsetCategory.Contains('installer')) and $(_subset.Contains('-depproj-'))">
<DepprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\**\*.depproj" SignPhase="R2RBinaries" BuildInParallel="false" />
<DepprojProjectToBuild Condition="'$(RuntimeFlavor)' == 'CoreCLR'" Include="$(InstallerProjectRoot)pkg\projects\**\*.depproj" SignPhase="R2RBinaries" BuildInParallel="false" />
<DepprojProjectToBuild Condition="'$(RuntimeFlavor)' == 'Mono'" Include="$(InstallerProjectRoot)pkg\projects\**\*.depproj" SignPhase="Binaries" BuildInParallel="false" />
<ProjectToBuild Include="@(DepprojProjectToBuild)" />
</ItemGroup>

Expand Down
48 changes: 27 additions & 21 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@
<CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName>
</PropertyGroup>

<Target Name="ResolveCoreCLRFilesFromLocalBuild">
<Error Condition="!Exists('$(CoreCLRArtifactsPath)')" Text="The CoreCLR artifacts path does not exist '$(CoreCLRArtifactsPath)'. The CoreCLR subset category must be built before building this project." />
<Target Name="ResolveRuntimeFilesFromLocalBuild">
<Error Condition="!Exists('$(CoreCLRArtifactsPath)') and '$(RuntimeFlavor)' == 'CoreCLR'" Text="The CoreCLR artifacts path does not exist '$(CoreCLRArtifactsPath)'. The CoreCLR subset category must be built before building this project." />
<Error Condition="!Exists('$(MonoArtifactsPath)') and '$(RuntimeFlavor)' == 'Mono'" Text="The Mono artifacts path does not exist '$(MonoArtifactsPath)'. The Mono subset category must be built before building this project." />

<PropertyGroup>
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
<CoreCLRArtifactsPath>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)'))</CoreCLRArtifactsPath>
<!--
Even though CoreCLRSharedFrameworkDir is statically initialized, set it again in case the
Expand All @@ -91,26 +92,30 @@
<CoreCLRCrossTargetComponentDir
Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir>
</PropertyGroup>
<ItemGroup>
<CoreCLRFiles Include="$(CoreCLRSharedFrameworkDir)*.*" />
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)'))</MonoArtifactsPath>
</PropertyGroup>

<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
<RuntimeFiles Include="$(CoreCLRSharedFrameworkDir)*.*" />
<CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include="$(CoreCLRCrossTargetComponentDir)*.*" IsNative="true" />
<CoreCLRFiles Include="$(CoreCLRArtifactsPath)Redist/**/*.dll" />
<CoreCLRFiles>
<RuntimeFiles Include="$(CoreCLRArtifactsPath)Redist/**/*.dll" />
<RuntimeFiles>
<IsNative>true</IsNative>
</CoreCLRFiles>
</RuntimeFiles>
<_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll"
Condition="Exists('$(CoreCLRArtifactsPath)System.Private.CoreLib.dll')" />
<_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll"
Condition="Exists('$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll') and '@(_systemPrivateCoreLib)' == ''" />
<CoreCLRFiles Include="@(_systemPrivateCoreLib)" />
<CoreCLRFiles
<RuntimeFiles Include="@(_systemPrivateCoreLib)" />
<RuntimeFiles
Include="
$(CoreCLRSharedFrameworkDir)PDB/*.pdb;
$(CoreCLRSharedFrameworkDir)PDB/*.dbg;
$(CoreCLRSharedFrameworkDir)PDB/*.dwarf" />
<CoreCLRFiles
<RuntimeFiles
Include="$(CoreCLRArtifactsPath)PDB/System.Private.CoreLib.pdb;" />
<CoreCLRFiles Condition="Exists('$(CoreCLRArtifactsPath)PDB/System.Private.CoreLib.ni.pdb')"
<RuntimeFiles Condition="Exists('$(CoreCLRArtifactsPath)PDB/System.Private.CoreLib.ni.pdb')"
Include="$(CoreCLRArtifactsPath)PDB/System.Private.CoreLib.ni.pdb" />
<CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''"
Include="
Expand All @@ -122,18 +127,19 @@
<TargetPath>runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath>
</CoreCLRCrossTargetFiles>
</ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<RuntimeFiles Include="$(MonoArtifactsPath)\*.*" />
<RuntimeFiles>
<IsNative>true</IsNative>
</RuntimeFiles>

<Error Condition="'@(CoreCLRFiles)' == ''" Text="The CoreCLR subset category must be built before building this project." />
</Target>

<Target Name="ResolveMonoFilesFromLocalBuild">
<Error Condition="!Exists('$(MonoArtifactsPath)')" Text="The Mono artifacts path does not exist '$(MonoArtifactsPath)'. The Mono subset category must be built before building this project." />

<ItemGroup>
<MonoFiles Include="$(MonoArtifactsPath)\*.*" />
<MonoCrossFiles Condition="'$(TargetOS)' == 'iOS'"
Include="$(MonoArtifactsPath)\cross\*.*" />
<MonoIncludeFiles Condition="'$(TargetOS)' == 'iOS'"
Include="$(MonoArtifactsPath)\include\**\*.*" />
</ItemGroup>

<Error Condition="'@(MonoFiles)' == ''" Text="The Mono subset category must be built before building this project." />
<Error Condition="'@(RuntimeFiles)' == ''" Text="The $(RuntimeFlavor) subset category must be built before building this project." />
</Target>

<Target Name="EnsureLocalArtifactsExist">
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ jobs:
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
osGroup: iOS
archType: arm
platform: iOS_x64
platform: iOS_arm
jobParameters:
runtimeFlavor: mono
stagedBuild: ${{ parameters.stagedBuild }}
Expand All @@ -335,7 +335,7 @@ jobs:
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
osGroup: iOS
archType: arm64
platform: iOS_x64
platform: iOS_arm64
jobParameters:
runtimeFlavor: mono
stagedBuild: ${{ parameters.stagedBuild }}
Expand Down
22 changes: 18 additions & 4 deletions eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ jobs:
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if eq(parameters.osGroup, 'iOS') }}:

- name: CommonMSBuildArgs
value: >-
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/installer.sh --restore --build --ci --test
-configuration $(_BuildConfig)
-os ${{ parameters.osGroup }}
-arch ${{ parameters.archType }}
/p:StripSymbols=true
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if eq(parameters.osGroup, 'Linux') }}:

# Preserve the NuGet authentication env vars into the Docker container.
Expand Down Expand Up @@ -170,9 +188,6 @@ jobs:
- name: _PortableBuild
value: ${{ eq(parameters.osSubgroup, '') }}

- name: _DisableCrossgen
value: false

- ${{ if and(eq(parameters.osSubgroup, '_musl'), eq(parameters.osGroup, 'Linux')) }}:
# Set output RID manually: musl isn't properly detected. Make sure to also convert linux to
# lowercase for RID format. (Detection normally converts, but we're preventing it.)
Expand All @@ -185,7 +200,6 @@ jobs:
value: >-
--restore --build --ci --test
/p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
/p:DisableCrossgen=$(_DisableCrossgen)
/p:PortableBuild=$(_PortableBuild)
/p:SkipTests=$(SkipTests)
$(LiveOverridePathArgs)
Expand Down
17 changes: 17 additions & 0 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ stages:
- Windows_NT_arm
- Windows_NT_arm64

#
# Installer Build for platforms using Mono
#
- template: /eng/pipelines/installer/installer-matrix.yml
parameters:
jobParameters:
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: Release
isOfficialBuild: ${{ variables.isOfficialBuild }}
useOfficialAllConfigurations: false
buildFullPlatformManifest: false
runtimeFlavor: mono
platforms:
- iOS_arm
- iOS_arm64
- iOS_x64

- ${{ if eq(variables.isOfficialBuild, true) }}:
- template: /eng/pipelines/official/stages/publish.yml
parameters:
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,18 @@ jobs:
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}

- template: /eng/pipelines/installer/installer-matrix.yml
parameters:
buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
runtimeFlavor: mono
platforms:
- iOS_x64
- iOS_arm
- iOS_arm64
jobParameters:
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}

#
# Libraries Test Build
# Only when CoreCLR, Mono or Libraries is changed
Expand Down
11 changes: 5 additions & 6 deletions eng/referenceFromRuntime.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@

<Target Name="GetFilesFromRuntime" Returns="@(RuntimeFiles)" DependsOnTargets="GetFilesFromCoreClr;GetFilesFromMono">
<ItemGroup>
<RuntimeFiles Include="@(CoreCLRFiles)" Condition="'$(RuntimeFlavor)' != 'Mono'" />
<RuntimeFiles Include="@(MonoFiles)" Condition="'$(RuntimeFlavor)' == 'Mono'" />
<RuntimeFiles Include="@(RuntimeFiles)" />
</ItemGroup>
</Target>

Expand All @@ -44,13 +43,13 @@
-->
<Target Name="GetFilesFromCoreCLR"
Condition="'$(RuntimeFlavor)' != 'Mono'"
Returns="@(CoreCLRFiles)"
DependsOnTargets="ResolveCoreCLRFilesFromLocalBuild" />
Returns="@(RuntimeFiles)"
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild" />

<Target Name="GetFilesFromMono"
Condition="'$(RuntimeFlavor)' == 'Mono'"
Returns="@(MonoFiles)"
DependsOnTargets="ResolveMonoFilesFromLocalBuild" />
Returns="@(RuntimeFiles)"
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild" />

<Target Name="FilterReferenceFromRuntime"
AfterTargets="ResolveProjectReferences"
Expand Down
13 changes: 11 additions & 2 deletions src/installer/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<OutputRid Condition="'$(TargetOS)' == 'OSX'">osx-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'Linux'">linux-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(TargetArchitecture)</OutputRid>
<OutputRid Condition="'$(TargetOS)' == 'iOS'">ios-$(TargetArchitecture)</OutputRid>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -127,6 +128,7 @@

<PropertyGroup>
<DisableCrossgen>false</DisableCrossgen>
<DisableCrossgen Condition="'$(RuntimeFlavor)' == 'Mono'">true</DisableCrossgen>
<!-- Disable cross-gen on FreeBSD for now. This can be revisited when we have full support. -->
<DisableCrossgen Condition="'$(TargetOS)'=='FreeBSD'">true</DisableCrossgen>
<OutputVersionBadge>$(AssetOutputPath)sharedfx_$(OutputRid)_$(Configuration)_version_badge.svg</OutputVersionBadge>
Expand Down Expand Up @@ -162,6 +164,7 @@
<PropertyGroup>
<TargetsWindows>false</TargetsWindows>
<TargetsOSX>false</TargetsOSX>
<TargetsiOS>false</TargetsiOS>
<TargetsLinux>false</TargetsLinux>
<TargetsUnix>false</TargetsUnix>
<TargetsUbuntu>false</TargetsUbuntu>
Expand All @@ -186,6 +189,12 @@
<TargetsUnix>true</TargetsUnix>
</PropertyGroup>
</When>
<When Condition="$(OutputRid.StartsWith('ios'))">
<PropertyGroup>
<TargetsiOS>true</TargetsiOS>
<TargetsUnix>true</TargetsUnix>
</PropertyGroup>
</When>
<When Condition="$(OutputRid.StartsWith('debian'))">
<PropertyGroup>
<TargetsDebian>true</TargetsDebian>
Expand Down Expand Up @@ -319,7 +328,7 @@
<LibPrefix Condition="'$(TargetOS)' != 'Windows_NT'">lib</LibPrefix>
<LibSuffix>.so</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'Windows_NT'">.dll</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'OSX'">.dylib</LibSuffix>
<LibSuffix Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'">.dylib</LibSuffix>
<StaticLibPrefix>lib</StaticLibPrefix>
<StaticLibSuffix>.a</StaticLibSuffix>
<StaticLibSuffix Condition="'$(TargetOS)' == 'Windows_NT'">.lib</StaticLibSuffix>
Expand All @@ -329,7 +338,7 @@
<CrossGenSymbolExtension>.map</CrossGenSymbolExtension>
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'Windows_NT'">.ni.pdb</CrossGenSymbolExtension>
<!-- OSX doesn't have crossgen symbols, yet -->
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'OSX'"></CrossGenSymbolExtension>
<CrossGenSymbolExtension Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'"></CrossGenSymbolExtension>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions src/installer/pkg/packaging/osx/package.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(InstallerTasksAssemblyPath)"/>

<Target Name="InitPkg"
Condition="'$(TargetOS)' == 'OSX'">
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'">
<MakeDir Condition="!Exists('$(PackagesIntermediateDir)')"
Directories="$(PackagesIntermediateDir)" />
</Target>

<Target Name="GeneratePkgs"
Condition="'$(TargetOS)' == 'OSX'"
Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'"
DependsOnTargets="GetInstallerBrandingNames;InitPkg">
<ItemGroup>
<OSXPackages Include="sharedframework">
Expand Down
12 changes: 12 additions & 0 deletions src/installer/pkg/projects/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
<StableVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' != 'true'">$(Version)</StableVersion>
</PropertyGroup>

<!--
For mobile targets, we do not need the host, so allow depproj's to opt
out and skip building.
-->
<Target Name="MobileSkipBuildProps"
Condition="'$(SkipBuildOnRuntimePackOnlyOS)' == 'true' and '$(TargetOS)' == 'iOS'"
BeforeTargets="GetSkipBuildProps">
<PropertyGroup>
<SkipBuild>true</SkipBuild>
</PropertyGroup>
</Target>

<!--
For any Dependency items with a VersionProp, set it to the property by that name given by the
version generation target. For any with a VersionFromProject, query the ProductVersion from that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionProp>AppHostVersion</VersionProp>
<SkipBuildOnRuntimePackOnlyOS>true</SkipBuildOnRuntimePackOnlyOS>
</PropertyGroup>

<Import Project="$(MSBuildProjectName).props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import
Condition="'$(PackageTargetRuntime)' != ''"
Condition="'$(PackageTargetRuntime)' != '' and Exists('$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildThisFile)')"
Project="$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildThisFile)" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<InstallerName>dotnet-host</InstallerName>
<GenerateSharedFrameworkPart>true</GenerateSharedFrameworkPart>
<SkipBuildOnRuntimePackOnlyOS>true</SkipBuildOnRuntimePackOnlyOS>
</PropertyGroup>

<Target Name="SetupHostSpecificWixBuild"
Expand Down Expand Up @@ -47,6 +48,8 @@
</ItemGroup>
</Target>

<Import Condition="'$(PackageTargetRuntime)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildProjectName).props" />
<Import
Condition="'$(PackageTargetRuntime)' != '' and Exists('$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildProjectName).props')"
Project="$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildProjectName).props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<VersionProp>HostPolicyVersion</VersionProp>
<SkipBuildOnRuntimePackOnlyOS>true</SkipBuildOnRuntimePackOnlyOS>
</PropertyGroup>

<ItemGroup>
<Dependency Include="Microsoft.NETCore.DotNetHostResolver" VersionProp="HostResolverVersion" />
</ItemGroup>

<Import Project="$(MSBuildProjectName).props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import
Condition="'$(PackageTargetRuntime)' != ''"
Condition="'$(PackageTargetRuntime)' != '' and Exists('$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildThisFile)')"
Project="$(MSBuildThisFileDirectory)runtime.$(TargetOS).$(MSBuildThisFile)" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<InstallerName>dotnet-hostfxr</InstallerName>
<GenerateSharedFrameworkPart>true</GenerateSharedFrameworkPart>
<SkipBuildOnRuntimePackOnlyOS>true</SkipBuildOnRuntimePackOnlyOS>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 61d1e78

Please sign in to comment.