update android sdks on appveyor

This commit is contained in:
Kyle Spearrin 2018-09-04 07:58:09 -04:00
parent e62ff2fe36
commit 3e0097c22c
2 changed files with 29 additions and 0 deletions

View File

@ -155,6 +155,7 @@
<ItemGroup>
<None Include="8bit.keystore.enc" />
<GoogleServicesJson Include="google-services.json" />
<None Include="update-android.ps1" />
<None Include="ci-build-apks.ps1" />
<None Include="google-services.json.enc" />
<None Include="Resources\AboutResources.txt" />

View File

@ -0,0 +1,28 @@
$AndroidToolPath = "${env:ProgramFiles(x86)}\Android\android-sdk\tools\android"
#$AndroidToolPath = "$env:localappdata\Android\android-sdk\tools\android"
Function Get-AndroidSDKs() {
$output = & $AndroidToolPath list sdk --all
$sdks = $output |% {
if ($_ -match '(?<index>\d+)- (?<sdk>.+), revision (?<revision>[\d\.]+)') {
$sdk = New-Object PSObject
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Index -Value $Matches.index
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Name -Value $Matches.sdk
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Revision -Value $Matches.revision
$sdk
}
}
$sdks
}
Function Install-AndroidSDK() {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, Position=0)]
[PSObject[]]$sdks
)
$sdkIndexes = $sdks |% { $_.Index }
$sdkIndexArgument = [string]::Join(',', $sdkIndexes)
Echo 'y' | & $AndroidToolPath update sdk -u -a -t $sdkIndexArgument
}
$sdks = Get-AndroidSDKs |? { $_.name -like 'sdk platform*API 28*' }
Install-AndroidSDK -sdks $sdks
dir "${env:ProgramFiles(x86)}\Android\android-sdk\platforms"