Skip to content

Commit

Permalink
Add ndk-related environment variables to windows (#5985)
Browse files Browse the repository at this point in the history
  • Loading branch information
miketimofeev authored Jul 29, 2022
1 parent 1c6ef2d commit 77dfaa7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions images/win/scripts/Installers/Install-AndroidSDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `

# NDKs
$ndkMajorVersions = $androidToolset.ndk.versions
$ndkDefaultMajorVersion = $androidToolset.ndk.default
$ndkLatestMajorVersion = $ndkMajorVersions | Select-Object -Last 1

$androidNDKs = $ndkMajorVersions | Foreach-Object {
Expand All @@ -120,10 +121,16 @@ Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
-AndroidPackages $androidNDKs

$ndkLatestVersion = ($androidNDKs | Where-Object { $_ -match "ndk;$ndkLatestMajorVersion" }).Split(';')[1]
$ndkDefaultVersion = ($androidNDKs | Where-Object { $_ -match "ndk;$ndkDefaultMajorVersion" }).Split(';')[1]
$ndkRoot = "$sdkRoot\ndk\$ndkDefaultVersion"

# Create env variables
setx ANDROID_HOME $sdkRoot /M
setx ANDROID_SDK_ROOT $sdkRoot /M
# ANDROID_NDK, ANDROID_NDK_HOME, and ANDROID_NDK_LATEST_HOME variables should be set as many customer builds depend on them https://github.com/actions/virtual-environments/issues/5879
setx ANDROID_NDK $ndkRoot /M
setx ANDROID_NDK_HOME $ndkRoot /M
setx ANDROID_NDK_ROOT $ndkRoot /M

$ndkLatestPath = "$sdkRoot\ndk\$ndkLatestVersion"
if (Test-Path $ndkLatestPath) {
Expand Down
10 changes: 8 additions & 2 deletions images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,22 @@ function Get-AndroidNdkVersions {
[object] $PackageInfo
)

$ndkDefaultFullVersion = Get-ChildItem $env:ANDROID_NDK_HOME -Name

$versions = $packageInfo | Where-Object { $_ -Match "ndk;" } | ForEach-Object {
(Split-TableRowByColumns $_)[1]
$version = (Split-TableRowByColumns $_)[1]
if ($version -eq $ndkDefaultFullVersion) {
$version += " (default)"
}
$version
}
return ($versions -Join "<br>")
}

function Build-AndroidEnvironmentTable {
$androidVersions = Get-Item env:ANDROID_*

$shoulddResolveLink = 'ANDROID_NDK_LATEST_HOME'
$shoulddResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
[PSCustomObject] @{
"Name" = $_.Name
Expand Down
1 change: 1 addition & 0 deletions images/win/toolsets/toolset-2019.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"patcher;v4"
],
"ndk": {
"default": "25",
"versions": [
"23", "24", "25"
]
Expand Down
1 change: 1 addition & 0 deletions images/win/toolsets/toolset-2022.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"patcher;v4"
],
"ndk": {
"default": "25",
"versions": [
"23", "24", "25"
]
Expand Down

0 comments on commit 77dfaa7

Please sign in to comment.