Skip to content

Commit 17d779f

Browse files
committed
Check if the locally installed Android NDK matches the wanted NDK version
We were never actually checking `android_ndk_versions` if ANDROID_NDK_HOME was set, as that environment variable always will be on the github runners. Add some log output so we can check this info easily from now on too.
1 parent c188fe5 commit 17d779f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/scripts/install-and-build-with-sdk.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,13 +653,16 @@ install_android_sdk() {
653653
# guess some common places where the swift-sdks file lives
654654
cd ~/Library/org.swift.swiftpm || cd ~/.config/swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm || cd /root/.swiftpm
655655

656+
# permit the "--android-ndk" flag to override the default
657+
local android_ndk_version="${ANDROID_NDK_VERSION:-r27d}"
658+
log "Checking for Android NDK $android_ndk_version at $ANDROID_NDK_HOME"
659+
656660
# Download and install the Android NDK.
657661
# Note that we could use the system package manager, but it is
658662
# named different things for different distributions
659663
# (e.g., "google-android-ndk-r26-installer" on Debian)
660-
if [[ ! -d "${ANDROID_NDK_HOME:-}" ]]; then
661-
# permit the "--android-ndk" flag to override the default
662-
local android_ndk_version="${ANDROID_NDK_VERSION:-r27d}"
664+
if [[ ! -d "${ANDROID_NDK_HOME:-}" || ! $(grep "Pkg.ReleaseName = ${android_ndk_version}" "${ANDROID_NDK_HOME}/source.properties") ]]; then
665+
log "Android NDK $android_ndk_version may not have matched $(grep "Pkg.ReleaseName" "$ANDROID_NDK_HOME/source.properties")"
663666
curl_with_retry -fsSL -o ndk.zip https://dl.google.com/android/repository/android-ndk-"${android_ndk_version}"-"$(uname -s)".zip
664667
command -v unzip >/dev/null || install_package unzip
665668
unzip -q ndk.zip

0 commit comments

Comments
 (0)