From 11f9ecfa0afd0198218c8acf2de43769e0640af7 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 28 Apr 2026 17:19:41 -0700 Subject: [PATCH] Change default Android SDK build command Updated default build command for Android SDK to use 'swift build' instead of 'swift build --build-system native'. The 4/27 snapshot contains the requisite changes for Android to work. For Wasm, we want to wait until https://github.com/swiftlang/swift-build/pull/1348 lands before unpinning. --- .../scripts/android/android-emulator-tests.sh | 2 +- .../scripts/install-and-build-with-sdk.sh | 14 ++++++++++++++ .github/workflows/swift_package_test.yml | 3 +-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/android/android-emulator-tests.sh b/.github/workflows/scripts/android/android-emulator-tests.sh index 1cd32a30..86380832 100755 --- a/.github/workflows/scripts/android/android-emulator-tests.sh +++ b/.github/workflows/scripts/android/android-emulator-tests.sh @@ -122,7 +122,7 @@ STAGING_DIR="swift-android-test" rm -rf "${STAGING_DIR}" mkdir "${STAGING_DIR}" -BUILD_DIR=.build/"${ANDROID_SDK_TRIPLE}"/debug +BUILD_DIR=$(swift build --show-bin-path --swift-sdk "${ANDROID_SDK_TRIPLE}") find "${BUILD_DIR}" -name '*.xctest' -exec cp -av {} "${STAGING_DIR}" \; find "${BUILD_DIR}" -name '*.resources' -exec cp -av {} "${STAGING_DIR}" \; diff --git a/.github/workflows/scripts/install-and-build-with-sdk.sh b/.github/workflows/scripts/install-and-build-with-sdk.sh index e18b6451..c753acf1 100755 --- a/.github/workflows/scripts/install-and-build-with-sdk.sh +++ b/.github/workflows/scripts/install-and-build-with-sdk.sh @@ -653,6 +653,20 @@ if [[ "$INSTALL_WASM" == true ]]; then fi fi +# Make the custom toolchain available to subsequent workflow steps +for _exec_var in "$SWIFT_EXECUTABLE_FOR_ANDROID_SDK" "$SWIFT_EXECUTABLE_FOR_STATIC_LINUX_SDK" "$SWIFT_EXECUTABLE_FOR_WASM_SDK"; do + if [[ -n "$_exec_var" && "$_exec_var" != "swift" ]]; then + _bin_dir="$(dirname "$_exec_var")" + log "Adding custom toolchain to PATH: $_bin_dir" + export PATH="$_bin_dir:$PATH" + if [[ -n "${GITHUB_PATH:-}" ]]; then + echo "$_bin_dir" >> "$GITHUB_PATH" + fi + break + fi +done +unset _exec_var _bin_dir + ANDROID_SDK_DOWNLOAD_ROOT="${SWIFT_DOWNLOAD_ROOT}/${SWIFT_VERSION_BRANCH}/android-sdk" STATIC_LINUX_SDK_DOWNLOAD_ROOT="${SWIFT_DOWNLOAD_ROOT}/${SWIFT_VERSION_BRANCH}/static-sdk" WASM_SDK_DOWNLOAD_ROOT="${SWIFT_DOWNLOAD_ROOT}/${SWIFT_VERSION_BRANCH}/wasm-sdk" diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 6c29d825..ff72d3d5 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -171,8 +171,7 @@ on: android_sdk_build_command: type: string description: "Command to use when building the package with the Swift SDK for Android" - # Temporarily use native build system on Android due to https://github.com/swiftlang/swift/issues/88282 - default: "swift build --build-system native" + default: "swift build" android_sdk_triples: type: string description: "The triples to use when building with the Swift SDK for Android. The final triple in the list will be used for the emulator testing and should match the host architecture."