mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Rework Android NDKs installation (#2555)
* Rework Android NDKs * Minor fix * Fix variable name * Minor fixes * Reword Android env vars table * Remove Android env vars table from doc file * Rework to use only major ndk versions in toolset * Fix ndk paths * Fix win2016 toolset * Refactor * Minor fix * Fix ndk tests
This commit is contained in:
committed by
GitHub
parent
212431cc79
commit
fa88926270
@@ -75,12 +75,36 @@ Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
|
||||
-AndroidSDKRootPath $sdkRoot `
|
||||
-AndroidPackages $androidToolset.additional_tools
|
||||
|
||||
# NDKs
|
||||
$ndkLTSMajorVersion = $androidToolset.ndk.lts
|
||||
$ndkLatestMajorVersion = $androidToolset.ndk.latest
|
||||
|
||||
$ndkLTSPackageName = Get-AndroidPackagesByName -AndroidPackages $androidPackages `
|
||||
-PrefixPackageName "ndk;$ndkLTSMajorVersion" `
|
||||
| Sort-Object -Unique `
|
||||
| Select-Object -Last 1
|
||||
|
||||
$ndkLatestPackageName = Get-AndroidPackagesByName -AndroidPackages $androidPackages `
|
||||
-PrefixPackageName "ndk;$ndkLatestMajorVersion" `
|
||||
| Sort-Object -Unique `
|
||||
| Select-Object -Last 1
|
||||
|
||||
$androidNDKs = @($ndkLTSPackageName, $ndkLatestPackageName)
|
||||
|
||||
|
||||
Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
|
||||
-AndroidSDKRootPath $sdkRoot `
|
||||
-AndroidPackages $androidNDKs
|
||||
|
||||
$ndkLTSVersion = $ndkLTSPackageName.Split(';')[1]
|
||||
$ndkLatestVersion = $ndkLatestPackageName.Split(';')[1]
|
||||
|
||||
# Android NDK root path.
|
||||
$ndkRoot = "$sdkRoot\ndk-bundle"
|
||||
# This changes were added due to incompatibility with android ndk-bundle (ndk;22.0.7026061).
|
||||
# Link issue virtual-environments: https://github.com/actions/virtual-environments/issues/2481
|
||||
# Link issue xamarin-android: https://github.com/xamarin/xamarin-android/issues/5526
|
||||
New-Item -Path $ndkRoot -ItemType SymbolicLink -Value "$sdkRoot\ndk\21.3.6528147"
|
||||
New-Item -Path $ndkRoot -ItemType SymbolicLink -Value "$sdkRoot\ndk\$ndkLTSVersion"
|
||||
|
||||
if (Test-Path $ndkRoot) {
|
||||
setx ANDROID_HOME $sdkRoot /M
|
||||
@@ -90,9 +114,16 @@ if (Test-Path $ndkRoot) {
|
||||
setx ANDROID_NDK_ROOT $ndkRoot /M
|
||||
(Get-Content -Encoding UTF8 "${ndkRoot}\ndk-build.cmd").replace('%~dp0\build\ndk-build.cmd','"%~dp0\build\ndk-build.cmd"')|Set-Content -Encoding UTF8 "${ndkRoot}\ndk-build.cmd"
|
||||
} else {
|
||||
Write-Host "NDK is not installed at path $ndk_root"
|
||||
Write-Host "LTS NDK $ndkLTSVersion is not installed at path $ndkRoot"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ndkLatestPath = "$sdkRoot\ndk\$ndkLatestVersion"
|
||||
if (Test-Path $ndkLatestPath) {
|
||||
setx ANDROID_NDK_LATEST_HOME $ndkLatestPath /M
|
||||
} else {
|
||||
Write-Host "Latest NDK $ndkLatestVersion is not installed at path $ndkLatestPath"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "Android"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user