mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Switch android tools installation to use cmdline-tools' sdkmanager (#3682)
* Switch android installation to use cmdline-tools * Rename update-android sdk to install-android sdk as for the other OSs * Remove cmdline-tools installation from toolset as it's installed * Regenerate licenses for the new sdkmanager * Add tests to check that both sdkmanagers are available * Simplify Get-AndroidInstalledPackages function to use list_installed * Resolve nitpicks from @AlenaSviridenko * Add extra lines to separate comments from the code * Remove extra line after $androidNDKs * Modify software report to output any version number * 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:
@@ -16,21 +16,13 @@ function Get-AndroidSDKRoot {
|
||||
}
|
||||
|
||||
function Get-AndroidSDKManagerPath {
|
||||
return Join-Path $env:ANDROID_HOME "tools\bin\sdkmanager.bat"
|
||||
return Join-Path $env:ANDROID_HOME "cmdline-tools\latest\bin\sdkmanager.bat"
|
||||
}
|
||||
|
||||
function Get-AndroidInstalledPackages {
|
||||
$androidSDKManagerPath = Get-AndroidSDKManagerPath
|
||||
$androidSDKManagerList = & $androidSDKManagerPath --list --include_obsolete
|
||||
$androidInstalledPackages = @()
|
||||
foreach($packageInfo in $androidSDKManagerList) {
|
||||
if($packageInfo -Match "Available Packages:") {
|
||||
break
|
||||
}
|
||||
|
||||
$androidInstalledPackages += $packageInfo
|
||||
}
|
||||
return $androidInstalledPackages
|
||||
$androidSDKManagerList = & $androidSDKManagerPath --list_installed
|
||||
return $androidSDKManagerList
|
||||
}
|
||||
|
||||
function Build-AndroidTable {
|
||||
@@ -38,7 +30,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"
|
||||
@@ -127,6 +119,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