mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[macOS] Switch android tools installation to use cmdline-tools' sdkmanager (#3686)
* Switch android installation to use cmdline-tools * Switch android-toolsets and xamarin-android-ndk to use new sdkmanager * Remove cmdline-tools installation from toolset as it's installed * Remove redundant steps with warning prevention * Remove hardcoded licenses as they are accepted during the installation * Add tests to check that both sdkmanagers are available * Simplify Get-AndroidInstalledPackages function to use list_installed * Change regex pattern to output the group * Currently the function returns 4. instead of 4.0, this change fixes it
This commit is contained in:
@@ -13,21 +13,13 @@ function Get-AndroidSDKRoot {
|
||||
|
||||
function Get-AndroidSDKManagerPath {
|
||||
$androidSDKDir = Get-AndroidSDKRoot
|
||||
return Join-Path $androidSDKDir "tools" "bin" "sdkmanager"
|
||||
return Join-Path $androidSDKDir "cmdline-tools" "latest" "bin" "sdkmanager"
|
||||
}
|
||||
|
||||
function Get-AndroidInstalledPackages {
|
||||
$androidSDKManagerPath = Get-AndroidSDKManagerPath
|
||||
$androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list --include_obsolete"
|
||||
$androidInstalledPackages = @()
|
||||
foreach($packageInfo in $androidSDKManagerList) {
|
||||
if($packageInfo -Match "Available Packages:") {
|
||||
break
|
||||
}
|
||||
|
||||
$androidInstalledPackages += $packageInfo
|
||||
}
|
||||
return $androidInstalledPackages
|
||||
$androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list_installed"
|
||||
return $androidSDKManagerList
|
||||
}
|
||||
|
||||
function Get-AndroidPackages {
|
||||
@@ -42,7 +34,7 @@ function Build-AndroidTable {
|
||||
return @(
|
||||
@{
|
||||
"Package" = "Android Command Line Tools"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Command-line Tools"
|
||||
"Version" = Get-AndroidCommandLineToolsVersion
|
||||
},
|
||||
@{
|
||||
"Package" = "Android Emulator"
|
||||
@@ -143,6 +135,13 @@ function Get-AndroidPlatformVersions {
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidCommandLineToolsVersion {
|
||||
$commandLineTools = Get-AndroidSDKManagerPath
|
||||
(& $commandLineTools --version | Out-String).Trim() -match "(?<version>^(\d+\.){1,}\d+$)" | Out-Null
|
||||
$commandLineToolsVersion = $Matches.Version
|
||||
return $commandLineToolsVersion
|
||||
}
|
||||
|
||||
function Get-AndroidBuildToolVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
|
||||
Reference in New Issue
Block a user