Skip to content

Commit fa17cb1

Browse files
committed
Better checking for swift-sdk install location; install NDK if it is not present
1 parent a430110 commit fa17cb1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ install_android_sdk() {
554554
# FIXME: we will be removing the "-0.1" suffix
555555
local android_sdk_suffix="-0.1"
556556

557-
local android_sdk_bundle_name="${ANDROID_SDK_TAG}_android${android_sdk_suffix}.artifactbundle"
557+
local android_sdk_name="${ANDROID_SDK_TAG}_android${android_sdk_suffix}"
558+
local android_sdk_bundle_name="${android_sdk_name}.artifactbundle"
558559
# FIXME: next SDK will remove the "_" from the name
559560
local android_sdk_bundle_dir="${android_sdk_bundle_name//_android/-android}"
560561
local android_sdk_filename="${android_sdk_bundle_name}.tar.gz"
@@ -569,7 +570,16 @@ install_android_sdk() {
569570
fi
570571

571572
# now setup the link to the local ANDROID_NDK_HOME
572-
cd ~/Library/org.swift.swiftpm || cd "${XDG_CONFIG_HOME:-$HOME}"/swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm
573+
swift sdk configure "${android_sdk_name}" --show-configuration
574+
cd ~/Library/org.swift.swiftpm || cd ~/.local/swiftpm || cd ~/.swiftpm
575+
576+
if [[ ! -d "${ANDROID_NDK_HOME}" ]]; then
577+
# download and install the Android NDK
578+
local android_ndk_version=r27d
579+
curl --retry=3 -fsSLO https://dl.google.com/android/repository/android-ndk-"${android_ndk_version}"-"$(uname -s)".zip
580+
unzip -q android-ndk-"${android_ndk_version}"-*.zip
581+
export ANDROID_NDK_HOME="${PWD}"/android-ndk-"${android_ndk_version}"
582+
fi
573583
./swift-sdks/"${android_sdk_bundle_dir}"/swift-android/scripts/setup-android-sdk.sh
574584
cd -
575585
}

0 commit comments

Comments
 (0)