Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Add ndk-related environment variables #5984

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions images/macos/provision/core/android-toolsets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ANDROID_EXTRA_LIST=($(get_toolset_value '.android."extra-list"[]'))
ANDROID_ADDON_LIST=($(get_toolset_value '.android."addon-list"[]'))
ANDROID_ADDITIONAL_TOOLS=($(get_toolset_value '.android."additional-tools"[]'))
ANDROID_NDK_MAJOR_VERSIONS=($(get_toolset_value '.android.ndk."versions"[]'))
ANDROID_NDK_MAJOR_DEFAULT=$(get_toolset_value '.android.ndk.default')
ANDROID_NDK_MAJOR_LATEST=$(get_toolset_value '.android.ndk."versions"[-1]')
# Get the latest command line tools from https://developer.android.com/studio#cmdline-tools
cmdlineToolsVersion=$(get_toolset_value '.android."cmdline-tools"')
Expand Down Expand Up @@ -81,8 +82,14 @@ do
echo y | $SDKMANAGER "ndk;$ndk_full_version"
done

ndkDefault=$(get_full_ndk_version $ANDROID_NDK_MAJOR_DEFAULT)
ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$ndkDefault
ndkLatest=$(get_full_ndk_version $ANDROID_NDK_MAJOR_LATEST)
ANDROID_NDK_LATEST_HOME=$ANDROID_HOME/ndk/$ndkLatest
# 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
echo "export ANDROID_NDK=$ANDROID_NDK_HOME" >> "${HOME}/.bashrc"
echo "export ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> "${HOME}/.bashrc"
echo "export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME" >> "${HOME}/.bashrc"
echo "export ANDROID_NDK_LATEST_HOME=$ANDROID_NDK_LATEST_HOME" >> "${HOME}/.bashrc"

availablePlatforms=($($SDKMANAGER --list | grep "platforms;android-[0-9]" | cut -d"|" -f 1 | sort -u))
Expand Down
10 changes: 8 additions & 2 deletions images/macos/software-report/SoftwareReport.Android.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function Build-AndroidTable {
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 Expand Up @@ -177,7 +177,13 @@ function Get-AndroidGoogleAPIsVersions {
function Get-AndroidNDKVersions {
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
$versions += Get-ChildItem -Path $ndkFolderPath -Name
return ($versions | Join-String -Separator "<br>")
$ndkDefaultVersion = Get-ToolsetValue "android.ndk.default"
$ndkDefaultFullVersion = Get-ChildItem "$env:ANDROID_HOME/ndk/$ndkDefaultVersion.*" -Name | Select-Object -Last 1

return ($versions | ForEach-Object {
$defaultPostfix = ( $_ -eq $ndkDefaultFullVersion ) ? " (default)" : ""
$_ + $defaultPostfix
} | Join-String -Separator "<br>")
}

function Get-IntelHaxmVersion {
Expand Down
1 change: 1 addition & 0 deletions images/macos/toolsets/toolset-10.15.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"cmake;3.18.1"
],
"ndk": {
"default": "25",
"versions": [
"23", "24", "25"
]
Expand Down
1 change: 1 addition & 0 deletions images/macos/toolsets/toolset-11.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"cmake;3.22.1"
],
"ndk": {
"default": "25",
"versions": [
"23", "24", "25"
]
Expand Down
1 change: 1 addition & 0 deletions images/macos/toolsets/toolset-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"cmake;3.22.1"
],
"ndk": {
"default": "25",
"versions": [
"23", "24", "25"
]
Expand Down