Skip to content

Commit 1a2beea

Browse files
pjcollinsjonpryor
authored andcommitted
[ci] Check APK sizes on Azure Pipelines (#4133)
Future-Followup: #4169 The `RecordApkSizes` target was overlooked in the initial split up and porting efforts for our `.apk` tests (fd8336c). `RecordApkSizes` calculates the sizes of or test `.apk` files and compares them against a baseline. This change ensures that we will report a failure in our Azure Pipelines build if any project's `.apk` size drifts too far from the baseline. In order for the `.apk` size comparisons to continue to "make sense" -- in that many of the sizes in `TestResult-Xamarin.Forms_Tests-values-Release.csv` are for AOT builds, while fd8336c didn't build those projects with AOT enabled, resulting in incomparable results -- we need to ensure that we're building the appropriate build config, by setting `$(AotAssemblies)`=True. This fixes a build-time failure: error MSB4018: The "ProcessApkSizes" task failed unexpectedly. [/Users/runner/runners/2.164.3/work/1/s/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj] error MSB4018: System.Collections.Generic.KeyNotFoundException: The given key 'apk-Release-Profiled' was not present in the dictionary. [/Users/runner/runners/2.164.3/work/1/s/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj] Finally, update `TestResult-Xamarin.Forms_Tests-values-Release.csv` to contain values which won't cause the build to fail. Unfortunately these sizes are larger, and we're not entirely sure why [^0]. Issue #4169 is tracking that investigation. [^0]: We have a *guess*: dotnet/java-interop@3b24a2c added `[MethodImpl (MethodImplOptions.AggressiveInlining)]` to multiple methods, which *presumably* increases AOT output. This might well be an acceptable size increase.
1 parent 7acc857 commit 1a2beea

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,12 @@ stages:
487487
- template: yaml-templates/apk-instrumentation.yaml
488488
parameters:
489489
configuration: $(ApkTestConfiguration)
490-
testName: Mono.Android_Tests-Profiled
490+
testName: Mono.Android_Tests-Profiled-Aot
491491
project: src/Mono.Android/Test/Mono.Android-Tests.csproj
492-
testResultsFiles: TestResult-Mono.Android_Tests-$(ApkTestConfiguration)-Profiled.xml
493-
extraBuildArgs: /p:AndroidEnableProfiledAot=true
492+
testResultsFiles: TestResult-Mono.Android_Tests-$(ApkTestConfiguration)-Profiled-Aot.xml
493+
extraBuildArgs: /p:AotAssemblies=True /p:AndroidEnableProfiledAot=true
494494
artifactName: Mono.Android_Tests-Signed.apk
495-
artifactFolder: Profiled
495+
artifactFolder: Profiled-Aot
496496

497497
- template: yaml-templates/apk-instrumentation.yaml
498498
parameters:
@@ -565,12 +565,12 @@ stages:
565565
- template: yaml-templates/apk-instrumentation.yaml
566566
parameters:
567567
configuration: $(ApkTestConfiguration)
568-
testName: Xamarin.Android.Locale_Tests-Profiled
568+
testName: Xamarin.Android.Locale_Tests-Profiled-Aot
569569
project: tests/locales/Xamarin.Android.Locale-Tests/Xamarin.Android.Locale-Tests.csproj
570-
testResultsFiles: TestResult-Xamarin.Android.Locale_Tests-$(ApkTestConfiguration)-Profiled.xml
571-
extraBuildArgs: /p:AndroidEnableProfiledAot=true
570+
testResultsFiles: TestResult-Xamarin.Android.Locale_Tests-$(ApkTestConfiguration)-Profiled-Aot.xml
571+
extraBuildArgs: /p:AotAssemblies=True /p:AndroidEnableProfiledAot=true
572572
artifactName: Xamarin.Android.Locale_Tests-Signed.apk
573-
artifactFolder: Profiled
573+
artifactFolder: Profiled-Aot
574574

575575
- template: yaml-templates/apk-instrumentation.yaml
576576
parameters:
@@ -579,7 +579,7 @@ stages:
579579
project: tests/EmbeddedDSOs/EmbeddedDSO/EmbeddedDSO.csproj
580580
testResultsFiles: TestResult-Xamarin.Android.EmbeddedDSO_Test.nunit-$(ApkTestConfiguration).xml
581581
artifactName: Xamarin.Android.EmbeddedDSO_Test-Signed.apk
582-
artifactFolder: Profiled
582+
artifactFolder: Default
583583

584584
- template: yaml-templates/apk-instrumentation.yaml
585585
parameters:
@@ -601,11 +601,11 @@ stages:
601601
- template: yaml-templates/apk-instrumentation.yaml
602602
parameters:
603603
configuration: $(ApkTestConfiguration)
604-
testName: Xamarin.Forms-Performance-Integration-Profiled
604+
testName: Xamarin.Forms-Performance-Integration-Profiled-Aot
605605
project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj
606-
extraBuildArgs: /p:AndroidEnableProfiledAot=true
606+
extraBuildArgs: /p:AotAssemblies=True /p:AndroidEnableProfiledAot=true
607607
artifactName: Xamarin.Forms_Performance_Integration-Signed.apk
608-
artifactFolder: Profiled
608+
artifactFolder: Profiled-Aot
609609

610610
- template: yaml-templates/apk-instrumentation.yaml
611611
parameters:

build-tools/automation/yaml-templates/apk-instrumentation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ steps:
1717
solution: ${{ parameters.project }}
1818
configuration: ${{ parameters.configuration }}
1919
msbuildArguments: >
20-
/t:AcquireAndroidTarget,SignAndroidPackage,DeployTest${{ parameters.packageType }}s,RunTestApks,UndeployTestApks,RenameApkTestCases,ReportComponentFailures
20+
/t:AcquireAndroidTarget,SignAndroidPackage,DeployTest${{ parameters.packageType }}s,RecordApkSizes,RunTestApks,UndeployTestApks,RenameApkTestCases,ReportComponentFailures
2121
/bl:$(System.DefaultWorkingDirectory)/bin/Test${{ parameters.configuration }}/run${{ parameters.testName }}.binlog
2222
${{ parameters.extraBuildArgs }}
2323
condition: ${{ parameters.condition }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
apk-Release,Java.Interop.dll-Release,Mono.Android.dll-Release,mscorlib.dll-Release,monosgen-armeabi-v7a-Release,apk-Release-Aot,Java.Interop.dll-Release-Aot,Mono.Android.dll-Release-Aot,mscorlib.dll-Release-Aot,monosgen-armeabi-v7a-Release-Aot,Java.Interop.dll.so-Release-Aot,mscorlib.dll.so-Release-Aot,Mono.Android.dll.so-Release-Aot,apk-Release-Profiled-Aot,Java.Interop.dll-Release-Profiled-Aot,Mono.Android.dll-Release-Profiled-Aot,mscorlib.dll-Release-Profiled-Aot,monosgen-armeabi-v7a-Release-Profiled-Aot,Mono.Android.dll.so-Release-Profiled-Aot,Java.Interop.dll.so-Release-Profiled-Aot,mscorlib.dll.so-Release-Profiled-Aot,apk-Release-Bundle,monosgen-armeabi-v7a-Release-Bundle
2-
21069561,162816,2226688,2113024,3843248,46788671,162816,2226688,2113024,3843248,831180,8460084,9131876,25268287,162816,2226688,2113024,3843248,759148,285668,2053044,15935912,3843248
2+
21069561,162816,2226688,2113024,3843248,47058467,164352,2228224,2103808,3844692,872920,8410108,9426332,25268287,162816,2226688,2113024,3843248,759148,285668,2053044,15935912,3843248

0 commit comments

Comments
 (0)