[ubuntu, macOS] Fix tools version extraction in Install Android SDK scripts (#12911)

This commit is contained in:
Alejandro Rosas
2025-10-23 22:31:30 +03:00
committed by GitHub
parent b1d8e89820
commit dcc9bb6dbf
2 changed files with 5 additions and 5 deletions

View File

@@ -12,9 +12,9 @@ add_filtered_installation_components() {
local tools_array=("$@") local tools_array=("$@")
for item in ${tools_array[@]}; do for item in ${tools_array[@]}; do
# take the last argument after splitting string by ';'' and '-'' # Take the last version number that appears after the last '-' or ';'
version=$(echo "${item##*[-;]}") item_version=$(echo "$item" | grep -oE '[-;][0-9.]+' | grep -oE '[0-9.]+')
if [[ "$(printf "${minimum_version}\n${version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then
components+=($item) components+=($item)
fi fi
done done

View File

@@ -15,8 +15,8 @@ add_filtered_installation_components() {
local tools_array=("$@") local tools_array=("$@")
for item in ${tools_array[@]}; do for item in ${tools_array[@]}; do
# Take the last argument after splitting string by ';'' and '-'' # Take the last version number that appears after the last '-' or ';'
item_version=$(echo "${item##*[-;]}") item_version=$(echo "$item" | grep -oE '[-;][0-9.]+' | grep -oE '[0-9.]+')
# Semver 'comparison'. Add item to components array, if item's version is greater than or equal to minimum version # Semver 'comparison'. Add item to components array, if item's version is greater than or equal to minimum version
if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then