Skip to content

Commit d6b3fd1

Browse files
committed
Fix Android build for non-default NDKs with new swift-build build system, by updating ANDROID_NDK_ROOT too
1 parent c8aaa3d commit d6b3fd1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,12 +815,16 @@ build() {
815815

816816
alias swift='$SWIFT_EXECUTABLE_FOR_ANDROID_SDK'
817817

818+
log "Using NDK at $ANDROID_NDK_HOME"
819+
818820
# This can become a single invocation in the future when `swift build` supports multiple Android triples at once
819821
for android_sdk_triple in "${ANDROID_SDK_TRIPLES[@]}" ; do
820822
if [[ "$SWIFT_VERSION_INPUT" == "6.3" || "$SWIFT_VERSION_INPUT" == "nightly-6.3" ]]; then
821823
local build_command="$SWIFT_BUILD_COMMAND --swift-sdk ${android_sdk_triple}"
822824
else
823-
local build_command="$SWIFT_BUILD_COMMAND --swift-sdk ${sdk_name} --triple ${android_sdk_triple}"
825+
local build_command="$SWIFT_BUILD_COMMAND --swift-sdk ${sdk_name} --triple ${android_sdk_triple} -v"
826+
# Work around swift-build issue with ANDROID_NDK_ROOT overriding ANDROID_NDK_HOME
827+
ANDROID_NDK_ROOT="${ANDROID_NDK_HOME}"
824828
fi
825829
if [[ -n "$SWIFT_BUILD_FLAGS" ]]; then
826830
build_command="$build_command $SWIFT_BUILD_FLAGS"

0 commit comments

Comments
 (0)