Skip to content
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
[build] delete platform-31 folder on test jobs
Context: #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:

* #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 20, 2021
commit 86ff4d0369a005bee06763206bd21723f422b21a
4 changes: 4 additions & 0 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ stages:

- template: yaml-templates\clean.yaml

- template: yaml-templates\delete-platform-31.yaml

- script: |
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder)
displayName: set JI_JAVA_HOME
Expand Down Expand Up @@ -291,6 +293,8 @@ stages:

- template: yaml-templates\clean.yaml

- template: yaml-templates\delete-platform-31.yaml

- script: |
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder)
displayName: set JI_JAVA_HOME
Expand Down
10 changes: 10 additions & 0 deletions build-tools/automation/yaml-templates/delete-platform-31.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# NOTE: temporary workaround to delete platform-31
steps:

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

- script: if exist "%USERPROFILE%\android-toolchain\sdk\platforms\android-31" rmdir /s /q "%USERPROFILE%\android-toolchain\sdk\platforms\android-31"
displayName: delete API 31
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ steps:
parameters:
provisionExtraArgs: ${{ parameters.provisionExtraArgs }}

- template: delete-platform-31.yaml

- 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