Skip to content

Conversation

alejandrorosas
Copy link

Modify version extraction logic to capture the last version number after '-' or ';'.

Description

Bug fixing

This change updates the method for parsing the version number for Android platform tools.

The previous method used shell parameter expansion (${item##*[-;]}) to get the string segment after the last - or ;. This approach failed for tool names with extensions, such as platforms;android-33-ext4, where it would incorrectly extract ext4 instead of the actual version, 33.

For example current full list of tools_array is:

tools_array=('platforms;android-10' 'platforms;android-11' 'platforms;android-12' 'platforms;android-13' 'platforms;android-14' 'platforms;android-15' 'platforms;android-16' 'platforms;android-17' 'platforms;android-18' 'platforms;android-19' 'platforms;android-20' 'platforms;android-21' 'platforms;android-22' 'platforms;android-23' 'platforms;android-24' 'platforms;android-25' 'platforms;android-26' 'platforms;android-27' 'platforms;android-28' 'platforms;android-29' 'platforms;android-30' 'platforms;android-31' 'platforms;android-32' 'platforms;android-33' 'platforms;android-33-ext4' 'platforms;android-33-ext5' 'platforms;android-34' 'platforms;android-34-ext10' 'platforms;android-34-ext11' 'platforms;android-34-ext12' 'platforms;android-34-ext8' 'platforms;android-35' 'platforms;android-35-ext14' 'platforms;android-35-ext15' 'platforms;android-36' 'platforms;android-36-ext18' 'platforms;android-7' 'platforms;android-8' 'platforms;android-9')

Related issue:

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

Modify version extraction logic to capture the last version number after '-' or ';'.
@Copilot Copilot AI review requested due to automatic review settings August 30, 2025 12:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the version extraction logic in the Android SDK installation script to handle platform tools with extensions correctly. The previous shell parameter expansion method incorrectly extracted extension suffixes instead of version numbers for tools like platforms;android-33-ext4.

  • Updates version extraction to use regex pattern matching instead of shell parameter expansion
  • Ensures correct version identification for Android platform tools with extension suffixes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@erik-bershel
Copy link
Contributor

erik-bershel commented Aug 30, 2025

We do not encounter the problem described. 🤷‍♂️

For example: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#android

@alejandrorosas
Copy link
Author

Hi @erik-bershel, thanks for taking a look.

The issue is visible in the latest ubuntu-24.04 image. The configuration sets the minimum Android platform version to 34 (here).

However, the build report summary show that packages for version 33 are still being installed, specifically platforms;android-33-ext4 and platforms;android-33-ext5.

image

This happens because the old parsing logic (${item##*[-;]}) incorrectly extracts ext4 as the version number from platforms;android-33-ext4.

My PR fixes this by ensuring only the correct numeric version (33) is extracted, so the comparison works as intended.

@erik-bershel erik-bershel reopened this Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants