ci: transfer the accepted workstation Android SDK license
This commit is contained in:
1 parent
824f0a07e2
commit
004d4622c4
2 files changed
+9
-4
No files matched your search
@@ -26,10 +26,13 @@ Move-Item -LiteralPath $source -Destination $destination
|
||||
$env:ANDROID_HOME = $sdkRoot
|
||||
$env:ANDROID_SDK_ROOT = $sdkRoot
|
||||
$manager = Join-Path $destination 'bin\sdkmanager.bat'
|
||||
$answers = ('y' + [Environment]::NewLine) * 100
|
||||
$answers | & $manager "--sdk_root=$sdkRoot" --licenses | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Android SDK license setup failed' }
|
||||
$answers | & $manager "--sdk_root=$sdkRoot" 'platform-tools' 'platforms;android-37.0' 'build-tools;37.0.0'
|
||||
# Transfer the already accepted workstation license, as documented by Google:
|
||||
# https://developer.android.com/studio/intro/update#download-with-gradle
|
||||
# The self-hosted runner does not reliably forward stdin to sdkmanager prompts.
|
||||
$licenses = Join-Path $sdkRoot 'licenses'
|
||||
New-Item -ItemType Directory -Path $licenses -Force | Out-Null
|
||||
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'android-licenses\android-sdk-license') -Destination $licenses
|
||||
& $manager "--sdk_root=$sdkRoot" 'platform-tools' 'platforms;android-37.0' 'build-tools;37.0.0'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Android SDK installation failed' }
|
||||
foreach ($required in @('platforms\android-37.0\android.jar', 'build-tools\37.0.0\aapt2.exe', 'licenses\android-sdk-license')) {
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $sdkRoot $required))) {
|
||||
|
||||
Reference in new issue
Block a user