Skip to content

Commit

Permalink
Migrate start-emulator to dotnet.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst committed Feb 28, 2023
1 parent df28d8e commit b83a680
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ stages:
--outfile="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/${{ parameters.target_framework }}/MSBuildDeviceIntegration.runsettings"
displayName: Slice unit tests
- task: MSBuild@1
displayName: start emulator
inputs:
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:AcquireAndroidTarget /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/start-emulator.binlog
- template: start-emulator.yaml

- template: run-nunit-tests.yaml
parameters:
Expand Down Expand Up @@ -121,12 +116,13 @@ stages:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- task: MSBuild@1
displayName: install and launch emulator
inputs:
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:InstallAvdImage;AcquireAndroidTarget /p:TestDeviceName=$(deviceName) /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType) /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/install-emulator-$(avdApiLevel).binlog
- template: start-emulator.yaml
parameters:
installImage: true
installDeviceName: $(deviceName)
installAvdApiLevel: $(avdApiLevel)
installAvdAbi: $(avdAbi)
installAvdType: $(avdType)

- template: run-nunit-tests.yaml
parameters:
Expand Down
18 changes: 18 additions & 0 deletions build-tools/automation/yaml-templates/start-emulator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameters:
installImage: false # 'true' to create a new specific AVD image emulator, if 'true', other 'install*' parameters must be provided
installDeviceName: # Device name to install, like 'wear_square'
installAvdApiLevel: # Device API level to install, like '30'
installAvdAbi: # Device ABI to install, like 'x86'
installAvdType: # Device AVD to install, like 'android-wear'

steps:
# This uses our in-tree 'dotnet' because the system one may not have the 'android' workload installed.
- template: run-dotnet-preview.yaml
parameters:
displayName: Start emulator
continueOnError: false
project: tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj
${{ if eq(parameters.installImage, true) }}:
arguments: -c $(XA.Build.Configuration) -t:InstallAvdImage;AcquireAndroidTarget -p:TestDeviceName=${{ parameters.installDeviceName }} -p:TestAvdApiLevel=${{ parameters.installAvdApiLevel }} -p:TestAvdAbi=${{ parameters.installAvdAbi }} -p:TestAvdType=${{ parameters.installAvdType }} -bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/install-emulator-${{ parameters.installAvdApiLevel }}.binlog
${{ else }}:
arguments: -c $(XA.Build.Configuration) -t:AcquireAndroidTarget -bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/start-emulator.binlog

0 comments on commit b83a680

Please sign in to comment.