Skip to content

Commit

Permalink
Maui Android Size on Disk Integration (#60425)
Browse files Browse the repository at this point in the history
Added main Maui build pipeline yml file with target and prop files to properly build Maui for Android with the latest runtime bits, updated the perf.yml file to run the Maui build steps, and piped the Android app artifact through the same line as the AndroidScenario so the perf size on disk tests are run.
  • Loading branch information
LoopedBard3 authored Oct 19, 2021
1 parent 881ee50 commit ed91cea
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 1 deletion.
50 changes: 49 additions & 1 deletion eng/pipelines/coreclr/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
platforms:
- Linux_x64

# run mono android scenarios
# run mono and maui android scenarios
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml
Expand Down Expand Up @@ -484,3 +484,51 @@ jobs:
additionalSetupParameters: '--latestdotnet'
logicalmachine: 'perftiger'

# build maui workload packs
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: release
runtimeFlavor: mono
platforms:
- Android_x86
- Android_arm64
jobParameters:
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
nameSuffix: Maui_Packs_Mono
isOfficialBuild: false
extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
extraStepsParameters:
name: MonoRuntimePacks
# Eventual platforms to add
# - MacCatalyst_x64
# - MacCatalyst_arm64
# - iOS_arm
# - iOS_arm64
# - OSX_x64
# - OSX_arm64

# build maui app
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: release
runtimeFlavor: mono
platforms:
- iOS_arm64
jobParameters:
dependsOn:
- Build_Android_arm64_release_Maui_Packs_Mono
- Build_Android_x86_release_Maui_Packs_Mono
buildArgs: -s mono -c $(_BuildConfig)
nameSuffix: MACiOSAndroidMaui
isOfficialBuild: false
extraStepsTemplate: /eng/pipelines/coreclr/templates/build-perf-maui-apps.yml
extraStepsParameters:
rootFolder: '$(Build.SourcesDirectory)/artifacts/'
includeRootFolder: true
displayName: MAC, iOS, and Android Maui Artifacts
artifactName: MACiOSAndroidMauiArm
archiveExtension: '.tar.gz'
archiveType: tar
tarCompression: gz
131 changes: 131 additions & 0 deletions eng/pipelines/coreclr/templates/build-perf-maui-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
parameters:
osGroup: ''
osSubgroup: ''
archType: ''
buildConfig: ''
runtimeFlavor: ''
helixQueues: ''
targetRid: ''
nameSuffix: ''
platform: ''
shouldContinueOnError: ''
rootFolder: ''
includeRootFolder: ''
displayName: ''
artifactName: ''
archiveExtension: ''
archiveType: ''
tarCompression: ''


steps:
- task: DownloadPipelineArtifact@2
displayName: Download runtime packages
inputs:
artifact: 'IntermediateArtifacts'
path: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks
patterns: |
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.android-!(*.symbols).nupkg
# Other artifacts to include once they are being built
# IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.ios-*.nupkg
# IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.iossimulator-*.nupkg
# IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.maccatalyst-*.nupkg

- task: CopyFiles@2
displayName: Flatten packages
inputs:
sourceFolder: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks
contents: '*/Shipping/*.nupkg'
cleanTargetFolder: false
targetFolder: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks
flattenFolders: true

- script: |
for file in *.nupkg
do
mv -v "$file" "${file%.nupkg}.zip"
done
displayName: Change nupkgs to zips
workingDirectory: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks
# #Unzip the nuget packages to make the actual runtimes accessible
- task: ExtractFiles@1
displayName: Extract android-arm64 runtime
inputs:
archiveFilePatterns: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.android-arm64.*.zip
destinationFolder: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.android-arm64
overwriteExistingFiles: true
cleanDestinationFolder: false
- task: ExtractFiles@1
displayName: Extract android-x86 runtime
inputs:
archiveFilePatterns: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.android-x86.*.zip
destinationFolder: $(Build.SourcesDirectory)/MauiTesting/ArtifactPacks/Microsoft.NETCore.App.Runtime.Mono.android-x86
overwriteExistingFiles: true
cleanDestinationFolder: false

- script: |
curl -o ./rollback.json 'maui.blob.core.windows.net/metadata/rollbacks/main.json'
./dotnet.sh workload update --from-rollback-file ./rollback.json
./dotnet.sh workload install maui --skip-manifest-update
displayName: Install MAUI workload
workingDirectory: $(Build.SourcesDirectory)
- script: |
./dotnet.sh new maui -n MauiTesting
cd MauiTesting
cp $(Build.SourcesDirectory)/src/maui/MauiScenario.props ./Directory.Build.props
cp $(Build.SourcesDirectory)/src/maui/MauiScenario.targets ./Directory.Build.targets
displayName: Setup MAUI Project
workingDirectory: $(Build.SourcesDirectory)
- script: |
chmod -R a+r .
../dotnet.sh publish -bl:MauiAndroid.binlog -f net6.0-android -c Release
mv ./bin/Release/net6.0-android/com.companyname.MauiTesting-Signed.apk ./MauiAndroidDefault.apk
displayName: Build MAUI Android
workingDirectory: $(Build.SourcesDirectory)/MauiTesting
- task: PublishBuildArtifacts@1
displayName: 'Publish MauiAndroid binlog'
inputs:
pathtoPublish: $(Build.SourcesDirectory)/MauiTesting/MauiAndroid.binlog
artifactName: ${{ parameters.artifactName }}

- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/MauiTesting/MauiAndroidDefault.apk
includeRootFolder: true
displayName: Maui Android App
artifactName: MauiAndroidApp
archiveExtension: '.tar.gz'
archiveType: tar
tarCompression: gz

- script: rm -r -f ./bin
workingDirectory: $(Build.SourcesDirectory)/MauiTesting
displayName: Clean bin directory
condition: succeededOrFailed()

- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
helixQueues: ${{ parameters.helixQueues }}
targetRid: ${{ parameters.targetRid }}
nameSuffix: ${{ parameters.nameSuffix }}
platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
rootFolder: ${{ parameters.rootFolder }}
includeRootFolder: ${{ parameters.includeRootFolder }}
displayName: ${{ parameters.displayName }}
artifactName: ${{ parameters.artifactName }}
archiveExtension: ${{ parameters.archiveExtension }}
archiveType: ${{ parameters.archiveType }}
tarCompression: ${{ parameters.tarCompression }}

9 changes: 9 additions & 0 deletions eng/pipelines/coreclr/templates/perf-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
- ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.codeGenType) }}
- ${{ if eq(parameters.runtimeType, 'AndroidMono')}}:
- ${{ 'build_Android_arm64_release_AndroidMono' }}
- ${{ 'Build_iOS_arm64_release_MACiOSAndroidMaui' }}
- ${{ if eq(parameters.runtimeType, 'iOSMono')}}:
- ${{ 'build_iOS_arm64_release_iOSMono' }}

Expand Down Expand Up @@ -157,6 +158,14 @@ jobs:
artifactFileName: 'AndroidMonoarm64.tar.gz'
artifactName: 'AndroidMonoarm64'
displayName: 'Mono Android runtime'
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: $(Build.SourcesDirectory)
cleanUnpackFolder: false
artifactFileName: 'MauiAndroidApp.tar.gz'
artifactName: 'MauiAndroidApp'
displayName: 'Maui Android App'


# Download iOSMono tests
- ${{ if eq(parameters.runtimeType, 'iOSMono') }}:
Expand Down
12 changes: 12 additions & 0 deletions eng/testing/performance/android_scenarios.proj
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,17 @@
<Command>$(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
<PostCommands>$(Python) post.py</PostCommands>
</HelixWorkItem>
<HelixWorkItem Include="SOD - Maui Android APK Size">
<PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
<PreCommands>cd $(ScenarioDirectory)mauiandroid;copy %HELIX_CORRELATION_PAYLOAD%\MauiAndroidDefault.apk .; $(Python) pre.py</PreCommands>
<Command>$(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
<PostCommands>$(Python) post.py</PostCommands>
</HelixWorkItem>
<HelixWorkItem Include="SOD - Maui Android Extracted Size">
<PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
<PreCommands>cd $(ScenarioDirectory)mauiandroid;copy %HELIX_CORRELATION_PAYLOAD%\MauiAndroidDefault.apk .; $(Python) pre.py --unzip</PreCommands>
<Command>$(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
<PostCommands>$(Python) post.py</PostCommands>
</HelixWorkItem>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions eng/testing/performance/performance-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ if ($AndroidMono) {
mkdir $WorkItemDirectory
}
Copy-Item -path "$SourceDirectory\artifacts\bin\AndroidSampleApp\arm64\Release\android-arm64\publish\apk\bin\HelloAndroid.apk" $PayloadDirectory
Copy-Item -path "$SourceDirectory\MauiAndroidDefault.apk" $PayloadDirectory
$SetupArguments = $SetupArguments -replace $Architecture, 'arm64'
}

Expand Down
3 changes: 3 additions & 0 deletions src/maui/MauiScenario.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<!-- Only here so that the default Directory.Build.props will not be used. -->
</Project>
19 changes: 19 additions & 0 deletions src/maui/MauiScenario.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project>
<Target Name="PrintRuntimePackLocation" AfterTargets="UpdateTargetingAndRuntimePack">
<Message Text="Used runtime pack: %(ResolvedRuntimePack.PackageDirectory)" Importance="high" />
</Target>

<!-- Use local targeting pack for NetCoreAppCurrent. -->
<Target Name="UpdateTargetingAndRuntimePack"
AfterTargets="ResolveFrameworkReferences">
<PropertyGroup>
<MicrosoftNetCoreAppRuntimePackDir>./ArtifactPacks</MicrosoftNetCoreAppRuntimePackDir>
</PropertyGroup>
<ItemGroup>
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.android-arm64"
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'android-arm64'" />
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)/Microsoft.NETCore.App.Runtime.Mono.android-x86"
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App' and '%(ResolvedRuntimePack.RuntimeIdentifier)' == 'android-x86'" />
</ItemGroup>
</Target>
</Project>

0 comments on commit ed91cea

Please sign in to comment.