Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Added System to get missing Android SDKs for AppVeyor
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamABradley committed Dec 4, 2017
1 parent 56d9951 commit e4e7571
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
39 changes: 39 additions & 0 deletions _build/GetAndroidDepencies.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
$AndroidToolPath = "${env:ProgramFiles(x86)}\Android\android-sdk\tools\android.bat"

if (!(Test-Path $AndroidToolPath)) {
$AndroidToolPath = "$env:localappdata\Android\android-sdk\tools\android.bat"
}

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)
Write-Output "Installing additional Android SDKs..."
$sdks | Format-Table Name

# Suppress the output to STDOUT
$null = Echo 'y' | & $AndroidToolPath update sdk -u -a -t $sdkIndexArgument
}

$sdk26 = Get-AndroidSDKs |? { $_.name -like 'sdk platform*API 26*' -or $_.name -like 'google apis*api 26' }

Install-AndroidSDK -sdks $sdk26
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ skip_commits:
init:
- ps: git config --global core.autocrlf true

before_build:
- ps: .\_build\GetAndroidDepencies.ps1

build_script:
- ps: .\_build\build.ps1

Expand Down

0 comments on commit e4e7571

Please sign in to comment.