update android using sdkmanager

This commit is contained in:
Kyle Spearrin 2018-09-05 17:01:28 -04:00
parent a8e98cfa78
commit ac82d6bc6b
2 changed files with 9 additions and 32 deletions

View File

@ -5,10 +5,10 @@ on_finish:
install:
- choco install cloc --no-progress
- "cloc --vcs git --exclude-dir Resources,store,test,UWP,Properties --include-lang C#,JavaScript,TypeScript,PowerShell"
# - appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
# - appveyor DownloadFile https://aka.ms/vs/15/release/vs_community.exe
# - vs_community.exe update --wait --quiet --norestart --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
# - ps: .\src\Android\update-android.ps1
- appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
- appveyor DownloadFile https://aka.ms/vs/15/release/vs_community.exe
- vs_community.exe update --wait --quiet --norestart --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
- ps: .\src\Android\update-android.ps1
before_build:
- nuget restore
- IF DEFINED keystore_dec_secret nuget install secure-file -ExcludeVersion

View File

@ -1,28 +1,5 @@
$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"
cd "${env:ProgramFiles(x86)}\Android\android-sdk\tools\bin"
.\sdkmanager --list
Echo 'y' | .\sdkmanager "platforms;android-28" "build-tools;28.0.2"
Echo 'y' | .\sdkmanager --update
dir "${env:ProgramFiles(x86)}\Android\android-sdk\platforms"