Skip to content

Commit

Permalink
Remove ndk-bundle from ubuntu (#5926)
Browse files Browse the repository at this point in the history
  • Loading branch information
miketimofeev authored Jul 19, 2022
1 parent ce779a6 commit 893e347
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 33 deletions.
12 changes: 3 additions & 9 deletions images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,13 @@ function Get-AndroidGoogleAPIsVersions {
function Get-AndroidNDKVersions {
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
$versions = Get-ChildItem -Path $ndkFolderPath -Name
$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>")
return ($versions | Join-String -Separator "<br>")
}

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

$shouldResolveLink = 'ANDROID_NDK_PATH', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
$shouldResolveLink = 'ANDROID_NDK_LATEST_HOME'
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
[PSCustomObject] @{
"Name" = $_.Name
Expand Down
12 changes: 0 additions & 12 deletions images/linux/scripts/installers/android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ function get_full_ndk_version {
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment

# ANDROID_HOME is deprecated, but older versions of Gradle rely on it
echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment

# Set env variables for NDK Root
echo "ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}" | tee -a /etc/environment
echo "ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" | tee -a /etc/environment

# Create android sdk directory
mkdir -p ${ANDROID_SDK_ROOT}

Expand Down Expand Up @@ -89,8 +84,6 @@ extras=$(get_toolset_value '.android.extra_list[]|"extras;" + .')
addons=$(get_toolset_value '.android.addon_list[]|"add-ons;" + .')
additional=$(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')
ndkDefaultFullVersion=$(get_full_ndk_version $ANDROID_NDK_MAJOR_DEFAULT)

components=("${extras[@]}" "${addons[@]}" "${additional[@]}")
for ndk_version in "${ANDROID_NDK_MAJOR_VERSIONS[@]}"
Expand All @@ -99,11 +92,6 @@ do
components+=("ndk;$ndk_full_version")
done

# 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
ln -s $ANDROID_SDK_ROOT/ndk/$ndkDefaultFullVersion $ANDROID_NDK_ROOT

ANDROID_NDK_MAJOR_LATEST=(${ANDROID_NDK_MAJOR_VERSIONS[-1]})
ndkLatestFullVersion=$(get_full_ndk_version $ANDROID_NDK_MAJOR_LATEST)
echo "ANDROID_NDK_LATEST_HOME=$ANDROID_SDK_ROOT/ndk/$ndkLatestFullVersion" | tee -a /etc/environment
Expand Down
9 changes: 0 additions & 9 deletions images/linux/scripts/tests/Android.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Describe "Android" {
$androidSdkManagerPackages = Get-AndroidPackages
[int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version"
[version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version"
[string]$ndkDefaultVersion = Get-ToolsetValue "android.ndk.default"
[array]$ndkVersions = Get-ToolsetValue "android.ndk.versions"
$ndkDefaultFullVersion = Get-ChildItem "$env:ANDROID_HOME/ndk/$ndkDefaultVersion.*" -Name | Select-Object -Last 1
$ndkFullVersions = $ndkVersions | ForEach-Object { (Get-ChildItem "/usr/local/lib/android/sdk/ndk/${_}.*" | Select-Object -Last 1).Name } | ForEach-Object { "ndk/${_}" }
# Platforms starting with a letter are the preview versions, which is not installed on the image
$platformVersionsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("platforms;") }) -replace 'platforms;android-', '' | Where-Object { $_ -match "^\d+$" } | Sort-Object -Unique
Expand Down Expand Up @@ -61,17 +59,10 @@ Describe "Android" {

Context "Packages" {
$testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } }
$defaultNdkTestCase = @{ NdkDefaultFullVersion = $ndkDefaultFullVersion }

It "<PackageName>" -TestCases $testCases {
param ([string] $PackageName)
Validate-AndroidPackage $PackageName
}

It "ndk-bundle points to the default NDK version" -TestCases $defaultNdkTestCase {
$ndkLinkTarget = (Get-Item $env:ANDROID_NDK_HOME).Target
$ndkVersion = Split-Path -Path $ndkLinkTarget -Leaf
$ndkVersion | Should -BeExactly $NdkDefaultFullVersion
}
}
}
1 change: 0 additions & 1 deletion images/linux/toolsets/toolset-1804.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"cmake;3.18.1"
],
"ndk": {
"default": "23",
"versions": [
"21", "23", "24"
]
Expand Down
1 change: 0 additions & 1 deletion images/linux/toolsets/toolset-2004.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"cmake;3.18.1"
],
"ndk": {
"default": "23",
"versions": [
"21", "23", "24"
]
Expand Down
1 change: 0 additions & 1 deletion images/linux/toolsets/toolset-2204.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"cmake;3.18.1"
],
"ndk": {
"default": "23",
"versions": [
"21", "23", "24"
]
Expand Down

0 comments on commit 893e347

Please sign in to comment.