diff options
Diffstat (limited to 'coin/provisioning/common/windows/android.ps1')
-rw-r--r-- | coin/provisioning/common/windows/android.ps1 | 104 |
1 files changed, 49 insertions, 55 deletions
diff --git a/coin/provisioning/common/windows/android.ps1 b/coin/provisioning/common/windows/android.ps1 index 2cf18cdc..b594238c 100644 --- a/coin/provisioning/common/windows/android.ps1 +++ b/coin/provisioning/common/windows/android.ps1 @@ -1,35 +1,5 @@ -############################################################################ -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only . "$PSScriptRoot\helpers.ps1" @@ -40,23 +10,27 @@ # That's why we need to use Andoid-21 API version in Qt 5.9. # NDK -$ndkVersion = "r20" -$ndkCachedUrl = "\\ci-files01-hki.intra.qt.io\provisioning\android\android-ndk-$ndkVersion-windows-x86_64.zip" -$ndkOfficialUrl = "https://dl.google.com/android/repository/android-ndk-$ndkVersion-windows-x86_64.zip" -$ndkChecksum = "36e1dc77fad08ad2498fb94b13ad8caf26bbd9df" -$ndkFolder = "c:\Utils\Android\android-ndk-$ndkVersion" -$ndkZip = "c:\Windows\Temp\android_ndk_$ndkVersion.zip" +$ndkVersionLatest = "r26b" +$ndkVersionDefault = $ndkVersionLatest +$ndkChecksumLatest = "17453c61a59e848cffb8634f2c7b322417f1732e" +$ndkChecksumDefault = $ndkChecksumLatest +$ndkCachedUrlLatest = "\\ci-files01-hki.ci.qt.io\provisioning\android\android-ndk-$ndkVersionLatest-windows.zip" +$ndkOfficialUrlLatest = "https://dl.google.com/android/repository/android-ndk-$ndkVersionLatest-windows.zip" +$ndkCachedUrlDefault = "\\ci-files01-hki.ci.qt.io\provisioning\android\android-ndk-$ndkVersionDefault-windows.zip" +$ndkOfficialUrlDefault = "https://dl.google.com/android/repository/android-ndk-$ndkVersionDefault-windows.zip" +$ndkZip = "C:\Windows\Temp\android_ndk.zip" # SDK -$toolsVersion = "26.1.1" -$toolsFile = "sdk-tools-windows-4333796.zip" +$toolsVersion = "2.1" +$toolsFile = "commandlinetools-win-6609375_latest.zip" $sdkApi = "ANDROID_API_VERSION" -$sdkApiLevel = "android-28" -$sdkBuildToolsVersion = "28.0.3" -$toolsCachedUrl= "\\ci-files01-hki.intra.qt.io\provisioning\android\$toolsFile" +$sdkApiLevel = "android-34" +$sdkBuildToolsVersion = "34.0.0" +$toolsCachedUrl= "\\ci-files01-hki.ci.qt.io\provisioning\android\$toolsFile" $toolsOfficialUrl = "https://dl.google.com/android/repository/$toolsFile" -$toolsChecksum = "aa298b5346ee0d63940d13609fe6bec621384510" -$toolsFolder = "c:\Utils\Android\tools" +$toolsChecksum = "e2e19c2ff584efa87ef0cfdd1987f92881323208" +$cmdFolder = "c:\Utils\Android\cmdline-tools" + $sdkZip = "c:\Windows\Temp\$toolsFile" function Install($1, $2, $3, $4) { @@ -64,19 +38,39 @@ function Install($1, $2, $3, $4) { $zip = $2 $checksum = $3 $offcialUrl = $4 + $tempExtractDir = "C:\Windows\Temp\android_extract" Download $offcialUrl $cacheUrl $zip Verify-Checksum $zip "$checksum" - Extract-7Zip $zip C:\Utils\Android + Extract-7Zip $zip $tempExtractDir + $baseDirectory = (Get-ChildItem $tempExtractDir -Attributes D | Select-Object -First 1).Name + Move-Item -Path ($tempExtractDir + "\" + $baseDirectory) -Destination "C:\Utils\Android\$baseDirectory" -Force + Remove $zip + + return "C:\Utils\Android\$baseDirectory" } -Write-Host "Installing Android NDK $nkdVersion" -Install $ndkCachedUrl $ndkZip $ndkChecksum $ndkOfficialUrl -Set-EnvironmentVariable "ANDROID_NDK_HOME" $ndkFolder -Set-EnvironmentVariable "ANDROID_NDK_ROOT" $ndkFolder +New-Item -ItemType Directory -Path C:\Utils\Android\ +New-Item -ItemType Directory -Path C:\Windows\Temp\android_extract +Write-Host "Installing Android NDK $ndkVersionDefault" +$ndkFolderDefault = Install $ndkCachedUrlDefault $ndkZip $ndkChecksumDefault $ndkOfficialUrlDefault +Set-EnvironmentVariable "ANDROID_NDK_ROOT_DEFAULT" $ndkFolderDefault +# To be used by vcpkg +Set-EnvironmentVariable "ANDROID_NDK_HOME" $ndkFolderDefault +$env:ANDROID_NDK_HOME = "$ndkFolderDefault" + +if ($ndkVersionDefault -eq $ndkVersionLatest) { + Write-Host "Android Latest version is the same than Default. NDK installation done." +} else { + Write-Host "Installing Android NDK $nkdVersionLatest" + $ndkFolderLatest = Install $ndkCachedUrlLatest $ndkZip $ndkChecksumLatest $ndkOfficialUrlLatest + Set-EnvironmentVariable "ANDROID_NDK_ROOT_LATEST" $ndkFolderLatest +} -Install $toolsCachedUrl $sdkZip $toolsChecksum $sdkOfficialUrl -Set-EnvironmentVariable "ANDROID_SDK_HOME" C:\Utils\Android +$toolsFolder = Install $toolsCachedUrl $sdkZip $toolsChecksum $toolsOfficialUrl +New-Item -ItemType directory -Path $cmdFolder +Move-Item -Path $toolsFolder -Destination $cmdFolder\ +Set-EnvironmentVariable "ANDROID_SDK_ROOT" "C:\Utils\Android" Set-EnvironmentVariable "ANDROID_API_VERSION" $sdkApiLevel if (IsProxyEnabled) { @@ -98,8 +92,8 @@ Out-File -FilePath C:\Utils\Android\licenses\android-sdk-license -Encoding utf8 # Attempt to catch all errors of sdkmanager.bat, even when hidden behind a pipeline. $ErrorActionPreference = "Stop" -cd $toolsFolder\bin\ -$sdkmanager_args += "platforms;$sdkApiLevel", "platform-tools", "build-tools;$sdkBuildToolsVersion" +cd $cmdFolder\tools\bin\ +$sdkmanager_args += "platforms;$sdkApiLevel", "platform-tools", "build-tools;$sdkBuildToolsVersion", "--sdk_root=C:\Utils\Android" $command = 'for($i=0;$i -lt 6;$i++) { $response += "y`n"}; $response | .\sdkmanager.bat @sdkmanager_args | Out-Null' Invoke-Expression $command $command = 'for($i=0;$i -lt 6;$i++) { $response += "y`n"}; $response | .\sdkmanager.bat --licenses' @@ -109,4 +103,4 @@ cmd /c "dir C:\Utils\android" Write-Output "Android SDK tools= $toolsVersion" >> ~/versions.txt Write-Output "Android SDK Build Tools = $sdkBuildToolsVersion" >> ~/versions.txt Write-Output "Android SDK Api Level = $sdkApiLevel" >> ~/versions.txt -Write-Output "Android NDK = $ndkVersion" >> ~/versions.txt +Write-Output "Android NDK = $ndkVersionDefault" >> ~/versions.txt |