mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Windows] Install latest Android cmdline-tools (#5619)
* Install latest Android cmdline-tools * Use Get-ToolsetContent * Fix variable typo * replace variable * Fix Windows 2016
This commit is contained in:
committed by
GitHub
parent
47e8783e7e
commit
f4e9588993
@@ -3,8 +3,24 @@
|
||||
## Desc: Install and update Android SDK and tools
|
||||
################################################################################
|
||||
|
||||
# install command-line tools
|
||||
$cmdlineToolsUrl = "https://dl.google.com/android/repository/commandlinetools-win-7302050_latest.zip"
|
||||
# get packages to install from the toolset
|
||||
$androidToolset = (Get-ToolsetContent).android
|
||||
|
||||
# install latest command-line tools
|
||||
$cmdlineToolsVersion = $androidToolset."cmdline-tools"
|
||||
if ($cmdlineToolsVersion -eq "latest") {
|
||||
$googlePkgs = Invoke-RestMethod "https://dl.google.com/android/repository/repository2-1.xml"
|
||||
$cmdlineToolsVersion = $googlePkgs.SelectSingleNode(
|
||||
"//remotePackage[@path='cmdline-tools;latest']/archives/archive/complete/url[starts-with(text(), 'commandlinetools-win-')]"
|
||||
).'#text'
|
||||
|
||||
if (-not $cmdlineToolsVersion) {
|
||||
Write-Host "Failed to parse latest command-line tools version"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$cmdlineToolsUrl = "https://dl.google.com/android/repository/${cmdlineToolsVersion}"
|
||||
$cmdlineToolsArchPath = Start-DownloadWithRetry -Url $cmdlineToolsUrl -Name "cmdline-tools.zip"
|
||||
$sdkInstallRoot = "C:\Program Files (x86)\Android\android-sdk"
|
||||
$sdkRoot = "C:\Android\android-sdk"
|
||||
@@ -50,9 +66,6 @@ Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
|
||||
-AndroidSDKRootPath $sdkRoot `
|
||||
-AndroidPackages "platform-tools"
|
||||
|
||||
# get packages to install from the toolset
|
||||
$androidToolset = (Get-ToolsetContent).android
|
||||
|
||||
# get packages info
|
||||
$androidPackages = Get-AndroidPackages -AndroidSDKManagerPath $sdkManager
|
||||
|
||||
|
||||
Reference in New Issue
Block a user