forked from SagepathSReinhardt/PCLCrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall-Dependencies.ps1
39 lines (32 loc) · 1.34 KB
/
Install-Dependencies.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}
$sdks = Get-AndroidSDKs |? { $_.name -like 'sdk platform*API 10*' -or $_.name -like 'google apis*api 10' }
Install-AndroidSDK -sdks $sdks