Skip to content

Commit

Permalink
[build] delete platform-31 folder on test jobs
Browse files Browse the repository at this point in the history
Context: dotnet#6089

We currently have lots of test failures due to the warning:

    warning XA1008: The TargetFrameworkVersion (Android API level 30) is lower than the targetSdkVersion (31). Please increase the `$(TargetFrameworkVersion)` or decrease the `android:targetSdkVersion` in the `AndroidManifest.xml` so that the API levels match.

Looking at `Properties\AndroidManifest.xml`, Xamarin.ProjectTools
generated:

    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />

This appears to be due to the `GetMaxInstalledPlatform()` method:

https://github.com/xamarin/xamarin-android/blob/1b71da0cd3a44861b006ac41c77a24eedf066281/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/AndroidSdkResolver.cs#L121-L138

I think what happened is:

* dotnet#6089 is opened, platform-31 gets installed on many of the CI
  machines.
* Future PRs install `platform-31` side-by-side `platform-S`.

And so we ended up with test failures...

To fix this for now, manually delete the `sdk/platform-31` folder on
test jobs.
  • Loading branch information
jonathanpeppers committed Jul 19, 2021
1 parent 1b71da0 commit 7d54432
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build-tools/automation/yaml-templates/setup-test-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ steps:
parameters:
provisionExtraArgs: ${{ parameters.provisionExtraArgs }}

# NOTE: temporarily delete platform-31

- script: rm -rfv "$HOME/Library/Android/sdk/platform-31"
displayName: delete API 31
condition: and(succeeded(), eq(variables['agent.os'], 'Darwin'))

- script: if exist "%USERPROFILE%\android-toolchain\sdk\platform-31" rmdir /s /q "%USERPROFILE%\android-toolchain\sdk\platform-31"
displayName: delete API 31
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))

- script: |
echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/${{ parameters.jdkTestFolder }}"
echo "##vso[task.setvariable variable=DOTNET_TOOL_PATH]$HOME/Library/Android/dotnet/dotnet"
Expand Down

0 comments on commit 7d54432

Please sign in to comment.