This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added System to get missing Android SDKs for AppVeyor
- Loading branch information
1 parent
56d9951
commit e4e7571
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters