Skip to content

Commit 2fd85c0

Browse files
committed
Enable specifying --android-ndk-version flag
1 parent 122a8fa commit 2fd85c0

File tree

3 files changed

+15
-38
lines changed

3 files changed

+15
-38
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ while [[ $# -gt 0 ]]; do
3232
INSTALL_ANDROID=true
3333
shift
3434
;;
35+
--android-ndk-version=*)
36+
ANDROID_NDK_VERSION="${1#*=}"
37+
shift
38+
;;
3539
--android-sdk-triple=*)
3640
ANDROID_SDK_TRIPLE="${1#*=}"
3741
shift
@@ -575,9 +579,13 @@ install_android_sdk() {
575579
# guess some common places where the swift-sdks file lives
576580
cd ~/Library/org.swift.swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm || cd /root/.swiftpm
577581

582+
# Download and install the Android NDK.
583+
# Note that we could use the system package manager, but it is
584+
# named different things for different distributions
585+
# (e.g., "google-android-ndk-r26-installer" on Debian)
578586
if [[ ! -d "${ANDROID_NDK_HOME:-}" ]]; then
579-
# download and install the Android NDK
580-
local android_ndk_version=r27d
587+
# permit the "--android-ndk" flag to override the default
588+
local android_ndk_version="${ANDROID_NDK_VERSION:-r27d}"
581589
curl --retry 3 -fsSLO https://dl.google.com/android/repository/android-ndk-"${android_ndk_version}"-"$(uname -s)".zip
582590
unzip -q android-ndk-"${android_ndk_version}"-*.zip
583591
export ANDROID_NDK_HOME="${PWD}"/android-ndk-"${android_ndk_version}"

.github/workflows/swift_package_test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ on:
119119
type: string
120120
description: "The triple to use when building with the Swift SDK for Android"
121121
default: "x86_64-unknown-linux-android28"
122+
android_ndk_version:
123+
type: string
124+
description: "The NDK version to use when building with the Swift SDK for Android"
125+
default: "r27d"
122126
windows_pre_build_command:
123127
type: string
124128
description: "Windows Command Prompt command to execute before building the Swift package"
@@ -489,7 +493,7 @@ jobs:
489493
# FIXME: restore to main when this PR is ready to be merged
490494
#curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
491495
curl -s --retry 3 https://raw.githubusercontent.com/swift-android-sdk/github-workflows/refs/heads/android-workflow/.github/workflows/scripts/install-and-build-with-sdk.sh | \
492-
bash -s -- --android --flags="$BUILD_FLAGS" --build-command="${{ inputs.android_sdk_build_command }}" --android-sdk-triple="${{ inputs.android_sdk_triple }}" ${{ matrix.swift_version }}
496+
bash -s -- --android --flags="$BUILD_FLAGS" --build-command="${{ inputs.android_sdk_build_command }}" --android-sdk-triple="${{ inputs.android_sdk_triple }}" --android-ndk-version="${{ inputs.android_ndk_version }}" ${{ matrix.swift_version }}
493497
494498
windows-build:
495499
name: Windows (${{ matrix.swift_version }} - windows-2022)

.github/workflows/test-sdks.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)