Skip to content

[xaprepare] Combine 'AndroidTestDependencies' and 'EmulatorTestDependencies' scenarios. #8006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ stages:
installLegacyDotNet: false
restoreNUnitConsole: false
updateMono: false

- template: yaml-templates/run-xaprepare.yaml
parameters:
displayName: install emulator
arguments: --s=EmulatorTestDependencies --android-sdk-platforms="$(DefaultTestSdkPlatforms)"
xaprepareScenario: EmulatorTestDependencies

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parameters:
androidSdkPlatforms: $(DefaultTestSdkPlatforms)
repositoryAlias: 'self'
commit: ''
xaprepareScenario: AndroidTestDependencies # Use 'EmulatorTestDependencies' for agents that need the emulator installed

steps:

Expand Down Expand Up @@ -69,7 +70,7 @@ steps:

- template: run-xaprepare.yaml
parameters:
arguments: --s=AndroidTestDependencies --android-sdk-platforms="${{ parameters.androidSdkPlatforms }}"
arguments: --s=${{ parameters.xaprepareScenario }} --android-sdk-platforms="${{ parameters.androidSdkPlatforms }}"
xaSourcePath: ${{ parameters.xaSourcePath }}

- ${{ if eq(parameters.restoreNUnitConsole, true) }}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ stages:
xaSourcePath: ${{ parameters.xaSourcePath }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}

- template: run-xaprepare.yaml
parameters:
displayName: install emulator
arguments: --s=EmulatorTestDependencies --android-sdk-platforms="$(DefaultTestSdkPlatforms)"
xaprepareScenario: EmulatorTestDependencies

- task: DownloadPipelineArtifact@2
inputs:
Expand Down Expand Up @@ -96,17 +92,13 @@ stages:
xaSourcePath: ${{ parameters.xaSourcePath }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
xaprepareScenario: EmulatorTestDependencies

- template: run-xaprepare.yaml
parameters:
displayName: install required brew tools and prepare java.interop
arguments: --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes

- template: run-xaprepare.yaml
parameters:
displayName: install emulator
arguments: --s=EmulatorTestDependencies --android-sdk-platforms="$(androidSdkPlatforms)"

- script: echo "##vso[task.setvariable variable=Java8SdkDirectory]$JAVA_HOME_8_X64"
displayName: set Java8SdkDirectory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ namespace Xamarin.Android.Prepare
[Scenario (isDefault: false)]
partial class Scenario_AndroidTestDependencies : ScenarioNoStandardEndSteps
{
protected virtual AndroidToolchainComponentType AndroidSdkNdkType => AndroidToolchainComponentType.CoreDependency;

public Scenario_AndroidTestDependencies ()
: base ("AndroidTestDependencies", "Install Android SDK, OpenJDK and .NET preview test dependencies.")
{}

protected Scenario_AndroidTestDependencies (string name, string description)
: base (name, description)
{}

protected override void AddSteps (Context context)
{
Steps.Add (new Step_InstallDotNetPreview ());
Steps.Add (new Step_InstallAdoptOpenJDK8 ());
Steps.Add (new Step_InstallMicrosoftOpenJDK11 ());
Steps.Add (new Step_Android_SDK_NDK (AndroidToolchainComponentType.CoreDependency));
Steps.Add (new Step_Android_SDK_NDK (AndroidSdkNdkType));

// disable installation of missing programs...
context.SetCondition (KnownConditions.AllowProgramInstallation, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@
namespace Xamarin.Android.Prepare
{
[Scenario (isDefault: false)]
partial class Scenario_EmulatorTestDependencies : ScenarioNoStandardEndSteps
partial class Scenario_EmulatorTestDependencies : Scenario_AndroidTestDependencies
{
protected override AndroidToolchainComponentType AndroidSdkNdkType => AndroidToolchainComponentType.CoreDependency | AndroidToolchainComponentType.EmulatorDependency;

public Scenario_EmulatorTestDependencies ()
: base ("EmulatorTestDependencies", "Install Android SDK emulator dependencies.")
: base ("EmulatorTestDependencies", "Install Android SDK (with emulator), OpenJDK, and .NET preview test dependencies.")
{}

protected override void AddSteps (Context context)
{
Steps.Add (new Step_Android_SDK_NDK (AndroidToolchainComponentType.EmulatorDependency));

// disable installation of missing programs...
context.SetCondition (KnownConditions.AllowProgramInstallation, false);

// ...but do not signal an error when any are missing
context.SetCondition (KnownConditions.IgnoreMissingPrograms, true);
}
}
}