[windows] implement Android SDK cmdtools checksum (#8357)

This commit is contained in:
ilia-shipitsin
2023-10-05 09:31:22 +02:00
committed by GitHub
parent 31a055838e
commit 2e47a88733
3 changed files with 13 additions and 1 deletions

View File

@@ -1,14 +1,22 @@
################################################################################
## File: Install-AndroidSDK.ps1
## Desc: Install and update Android SDK and tools
## Supply chain security: checksum validation
################################################################################
# get packages to install from the toolset
$androidToolset = (Get-ToolsetContent).android
# Newer version(s) require Java 11 by default
# See https://github.com/actions/runner-images/issues/6960
$cmdlineToolsUrl = "https://dl.google.com/android/repository/commandlinetools-win-9123335_latest.zip"
$cmdlineToolsUrl = $androidToolset.commandline_tools_url
$cmdlineToolsArchPath = Start-DownloadWithRetry -Url $cmdlineToolsUrl -Name "cmdline-tools.zip"
#region Supply chain security
$localFileHash = (Get-FileHash -Path $cmdlineToolsArchPath -Algorithm SHA256).Hash
Use-ChecksumComparison -LocalFileHash $localFileHash -DistributorFileHash $androidToolset.hash
#endregion
$sdkInstallRoot = "C:\Program Files (x86)\Android\android-sdk"
$sdkRoot = "C:\Android\android-sdk"
Extract-7Zip -Path $cmdlineToolsArchPath -DestinationPath "${sdkInstallRoot}\cmdline-tools"