mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[Ubuntu] Switch android tools installation to use sdkmanager from command-line tools (#3650)
* Switch android tools installation to cmdline-tools * Replace deprecated sdkmanger from sdk-tools to the one from cmdline tools * Remove patcherv4 from toolsets as it's included in m2repository extras * Add tests to make sure both sdkmanagers exist * Return cmdline-tools to software readme * Get-AndroidInstalledPackages function now use list_installed param * Create a function to get sdkmanager version = cmdline tools version * Get rid of hardcoded path to ANDROID_HOME * Add reloadEtcEnvironment call to installation script * Use env variable ANDROID_HOME in tests * Modify software report to output any version * 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:
@@ -11,21 +11,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 --include_obsolete"
|
||||
return $androidSDKManagerList
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +26,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"
|
||||
@@ -123,6 +115,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