diff --git a/swift-ci/sdks/android/build-docker b/swift-ci/sdks/android/build-docker index e8f1f3f1..8d1a8c4c 100755 --- a/swift-ci/sdks/android/build-docker +++ b/swift-ci/sdks/android/build-docker @@ -26,7 +26,15 @@ HOST_OS=ubuntu24.04 source ./scripts/toolchain-vars.sh # Check-out and patch the sources +if [[ "${BUILD_COMPILER}" != "1" ]]; then ./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG} +else +if [[ "${BUILD_SCHEME}" == "development" ]]; then +./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme main +else +./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme release/6.2 +fi +fi ./patches/apply-patches.sh ${WORKDIR}/source/swift-project mkdir -p ${WORKDIR}/products diff --git a/swift-ci/sdks/android/patches/apply-patches.sh b/swift-ci/sdks/android/patches/apply-patches.sh index 36f234f1..dabb8e93 100755 --- a/swift-ci/sdks/android/patches/apply-patches.sh +++ b/swift-ci/sdks/android/patches/apply-patches.sh @@ -6,12 +6,11 @@ cd ${1} case "${BUILD_SCHEME}" in swift-*-branch) git apply -v -C1 ${patches_dir}/swift-android.patch - git apply -v -C1 ${patches_dir}/swift-android-testing-except-release.patch + git apply -v -C1 ${patches_dir}/swift-android-devel.patch ;; development) git apply -v -C1 ${patches_dir}/swift-android.patch git apply -v -C1 ${patches_dir}/swift-android-trunk-libdispatch.patch - git apply -v -C1 ${patches_dir}/swift-android-testing-except-release.patch ;; *) echo "$0: invalid BUILD_SCHEME=${BUILD_SCHEME}" diff --git a/swift-ci/sdks/android/patches/swift-android-testing-except-release.patch b/swift-ci/sdks/android/patches/swift-android-devel.patch similarity index 74% rename from swift-ci/sdks/android/patches/swift-android-testing-except-release.patch rename to swift-ci/sdks/android/patches/swift-android-devel.patch index 4d6fea0d..60dd9615 100644 --- a/swift-ci/sdks/android/patches/swift-android-testing-except-release.patch +++ b/swift-ci/sdks/android/patches/swift-android-devel.patch @@ -1,16 +1,23 @@ +commit 2e87eb24f85f3e84bff78051fba4870a5c061ec0 +Author: finagolfin +Date: Mon Jun 30 10:39:26 2025 + + [test] Fix or disable tests for 32-bit platforms (#82501) + + Fix two IRGen tests that are failing on Android armv7 and disable eight ClangImporter, C++ Interop, and SILOptimizer tests, two of which that were already failing on other 32-bit platforms. + diff --git a/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift b/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift -index f5048b9e3d5..c227ef7b77d 100644 +index f5048b9e3d5..6bc26ca3177 100644 --- a/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift +++ b/swift/test/ClangImporter/pcm-emit-direct-cc1-mode.swift -@@ -9,7 +9,7 @@ - // CHECK-DUMP: Module map file: {{.*[/\\]}}Inputs{{/|\\}}custom-modules{{/|\\}}module.modulemap - - // Verify that the clang command-line used is cc1 --// RUN: %FileCheck -check-prefix CHECK-CLANG -DTRIPLE=%target-triple %s < %t.diags.txt -+// RUN: %FileCheck -check-prefix CHECK-CLANG -DTRIPLE=%module-target-triple %s < %t.diags.txt - // CHECK-CLANG: clang importer cc1 args - // CHECK-CLANG-SAME: '-o' '{{.*[/\\]}}script.pcm' '-fsyntax-only' '-x' 'objective-c' '{{.*[/\\]}}module.modulemap' '-triple' '[[TRIPLE]]' +@@ -15,5 +15,7 @@ // CHECK-CLANG-SAME: '-fmodules' + // CHECK-CLANG-NOT: clang importer driver args + ++// XFAIL: OS=linux-androideabi ++ + import script + var _ : ScriptTy diff --git a/swift/test/IRGen/abitypes_arm.swift b/swift/test/IRGen/abitypes_arm.swift index 9428294483d..52bd8b10145 100644 --- a/swift/test/IRGen/abitypes_arm.swift @@ -111,6 +118,23 @@ index f7f2664b2de..01d36e127c6 100644 // CHECK-DISABLED-NOT: normal_count +diff --git a/swift/utils/swift_build_support/swift_build_support/cmake.py b/swift/utils/swift_build_support/swift_build_support/cmake.py +index bfb69965890..b5e9f5349c2 100644 +--- a/swift/utils/swift_build_support/swift_build_support/cmake.py ++++ b/swift/utils/swift_build_support/swift_build_support/cmake.py +@@ -153,10 +153,8 @@ class CMake(object): + toolchain_path = product.native_toolchain_path(args.host_target) + cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', + os.path.join(toolchain_path, 'bin', 'swiftc')) +- define("CMAKE_C_COMPILER:PATH", os.path.join(toolchain_path, +- 'bin', 'clang')) +- define("CMAKE_CXX_COMPILER:PATH", os.path.join(toolchain_path, +- 'bin', 'clang++')) ++ define("CMAKE_C_COMPILER:PATH", toolchain.cc) ++ define("CMAKE_CXX_COMPILER:PATH", toolchain.cxx) + define("CMAKE_Swift_COMPILER:PATH", cmake_swiftc_path) + else: + cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', toolchain.swiftc) diff --git a/swift/utils/swift_build_support/swift_build_support/products/product.py b/swift/utils/swift_build_support/swift_build_support/products/product.py index 274b6037305..bf0f7fcf671 100644 --- a/swift/utils/swift_build_support/swift_build_support/products/product.py @@ -124,33 +148,3 @@ index 274b6037305..bf0f7fcf671 100644 install_destdir = os.path.join(install_destdir, self.args.host_target) return targets.toolchain_path(install_destdir, self.args.install_prefix) -diff --git a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake -index 468dc61..a90ae3d 100644 ---- a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake -+++ b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake -@@ -2,6 +2,10 @@ - set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info) - if(CMAKE_Swift_COMPILER_TARGET) - list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET}) -+else() -+ set(arg_list ${CMAKE_Swift_FLAGS}) -+ separate_arguments(arg_list) -+ list(APPEND print_target_info_invocation ${arg_list}) - endif() - execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json) - message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n" -diff --git a/swift-testing/cmake/modules/PlatformInfo.cmake b/swift-testing/cmake/modules/PlatformInfo.cmake -index 94c60ef..ab8a491 100644 ---- a/swift-testing/cmake/modules/PlatformInfo.cmake -+++ b/swift-testing/cmake/modules/PlatformInfo.cmake -@@ -9,6 +9,10 @@ - set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info) - if(CMAKE_Swift_COMPILER_TARGET) - list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET}) -+else() -+ set(arg_list ${CMAKE_Swift_FLAGS}) -+ separate_arguments(arg_list) -+ list(APPEND print_target_info_invocation ${arg_list}) - endif() - execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json) - message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n" diff --git a/swift-ci/sdks/android/patches/swift-android-testing-release.patch b/swift-ci/sdks/android/patches/swift-android-testing-release.patch deleted file mode 100644 index 923d1194..00000000 --- a/swift-ci/sdks/android/patches/swift-android-testing-release.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py -index b6bfa5760ef..324d1a77eea 100644 ---- a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py -+++ b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py -@@ -51,7 +51,7 @@ class SwiftTesting(product.Product): - return False - - def should_install(self, host_target): -- return self.args.install_swift_testing_macros -+ return self.args.install_swift_testing - - def _cmake_product(self, host_target): - build_root = os.path.dirname(self.build_dir) -diff --git a/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c b/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c -index 90f4aa78..0429425b 100644 ---- a/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c -+++ b/swift-corelibs-foundation/Sources/CoreFoundation/CFPlatform.c -@@ -1948,7 +1948,7 @@ CF_CROSS_PLATFORM_EXPORT void *_CFReallocf(void *ptr, size_t size) { - #endif - } - --#if TARGET_OS_ANDROID -+#if TARGET_OS_ANDROID && __ANDROID_API__ < 28 - - #include - #include -@@ -2277,6 +2277,10 @@ CF_EXPORT int _CFPosixSpawnFileActionsAddClose(_CFPosixSpawnFileActionsRef file_ - return _CFPosixSpawnFileActionsAddCloseImpl(file_actions, filedes); - } - -+CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_actions, const char *path) { -+ return ENOSYS; -+} -+ - CF_EXPORT int _CFPosixSpawn(pid_t *_CF_RESTRICT pid, const char *_CF_RESTRICT path, _CFPosixSpawnFileActionsRef file_actions, _CFPosixSpawnAttrRef _Nullable _CF_RESTRICT attrp, char *_Nullable const argv[_Nullable _CF_RESTRICT], char *_Nullable const envp[_Nullable _CF_RESTRICT]) { - _CFPosixSpawnInitialize(); - return _CFPosixSpawnImpl(pid, path, file_actions, attrp, argv, envp); -@@ -2279,7 +2279,7 @@ CF_EXPORT int _CFPosixSpawnFileActionsAddClose(_CFPosixSpawnFileActionsRef file_ - } - - CF_EXPORT int _CFPosixSpawnFileActionsChdir(_CFPosixSpawnFileActionsRef file_actions, const char *path) { -- #if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29) -+ #if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29) || (defined(__ANDROID__) && __ANDROID_API__ < 34) - // Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting: - // - Amazon Linux 2 (EoL mid-2025) - return ENOSYS; -diff --git a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake -index 1553725..d9f9e5b 100644 ---- a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake -+++ b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake -@@ -75,6 +75,10 @@ function(_swift_testing_install_target module) - set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info) - if(CMAKE_Swift_COMPILER_TARGET) - list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET}) -+ else() -+ set(arg_list ${CMAKE_Swift_FLAGS}) -+ separate_arguments(arg_list) -+ list(APPEND module_triple_command ${arg_list}) - endif() - execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json) - string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple") diff --git a/swift-ci/sdks/android/patches/swift-android-trunk-libdispatch.patch b/swift-ci/sdks/android/patches/swift-android-trunk-libdispatch.patch index 4e824fad..ffec4ff6 100644 --- a/swift-ci/sdks/android/patches/swift-android-trunk-libdispatch.patch +++ b/swift-ci/sdks/android/patches/swift-android-trunk-libdispatch.patch @@ -10,30 +10,24 @@ index 3f36fc979cb..8713ae8fea8 100755 "grep", "--extended-regexp", "--recursive", -diff --git a/swift/test/Reflection/conformance_descriptors.swift b/swift/test/Reflection/conformance_descriptors.swift -index b114f764552..e1bd98c08f4 100644 ---- a/swift/test/Reflection/conformance_descriptors.swift -+++ b/swift/test/Reflection/conformance_descriptors.swift -@@ -5,6 +5,7 @@ - // - // Temporarily disable on AArch64 Linux (rdar://88451721) - // UNSUPPORTED: OS=linux-gnu && CPU=aarch64 -+// XFAIL: OS=linux-android +diff --git a/swift/utils/swift_build_support/swift_build_support/cmake.py b/swift/utils/swift_build_support/swift_build_support/cmake.py +index 9a0f5b43e2d..5c7d1320a2d 100644 +--- a/swift/utils/swift_build_support/swift_build_support/cmake.py ++++ b/swift/utils/swift_build_support/swift_build_support/cmake.py +@@ -150,11 +150,8 @@ class CMake(object): + define("CMAKE_CXX_COMPILER_LAUNCHER:PATH", args.cmake_cxx_launcher) - // rdar://100558042 - // UNSUPPORTED: CPU=arm64e -diff --git a/swift/test/Reflection/typeref_decoding.swift b/swift/test/Reflection/typeref_decoding.swift -index e0a3b4465a3..c01af893eda 100644 ---- a/swift/test/Reflection/typeref_decoding.swift -+++ b/swift/test/Reflection/typeref_decoding.swift -@@ -10,6 +10,7 @@ + if self.prefer_native_toolchain and product: +- clang_tools_path = product.native_clang_tools_path(args.host_target) +- define("CMAKE_C_COMPILER:PATH", os.path.join(clang_tools_path, +- 'bin', 'clang')) +- define("CMAKE_CXX_COMPILER:PATH", os.path.join(clang_tools_path, +- 'bin', 'clang++')) ++ define("CMAKE_C_COMPILER:PATH", toolchain.cc) ++ define("CMAKE_CXX_COMPILER:PATH", toolchain.cxx) - // FIXME: rdar://127796117 - // UNSUPPORTED: OS=linux-gnu && CPU=aarch64 -+// XFAIL: OS=linux-android - - // RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library %no-fixup-chains -module-name TypesToReflect -o %t/%target-library-name(TypesToReflect) - // RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift %S/Inputs/main.swift -emit-module -emit-executable %no-fixup-chains -module-name TypesToReflect -o %t/TypesToReflect + toolchain_path = product.native_toolchain_path(args.host_target) + cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', diff --git a/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake b/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake index 3da519e..e2dd8ed 100644 --- a/swift-corelibs-libdispatch/cmake/modules/SwiftSupport.cmake diff --git a/swift-ci/sdks/android/patches/swift-android.patch b/swift-ci/sdks/android/patches/swift-android.patch index 2d465ea2..eeb84df8 100644 --- a/swift-ci/sdks/android/patches/swift-android.patch +++ b/swift-ci/sdks/android/patches/swift-android.patch @@ -1,3 +1,27 @@ +diff --git a/swift/test/SILOptimizer/concat_string_literals.32.swift b/swift/test/SILOptimizer/concat_string_literals.32.swift +index 01390761c8c..d84c142397c 100644 +--- a/swift/test/SILOptimizer/concat_string_literals.32.swift ++++ b/swift/test/SILOptimizer/concat_string_literals.32.swift +@@ -4,6 +4,7 @@ + + // We have a separate test for 64-bit architectures. + // REQUIRES: PTRSIZE=32 ++// XFAIL: OS=linux-androideabi + + // NOTE: 25185.byteSwapped = 0x62 'a', 0x61 'b' + // CHECK-LABEL: test_ascii_scalar_scalar2 +diff --git a/swift/test/SILOptimizer/semantic-arc-opts-redundantcopyopts.sil b/swift/test/SILOptimizer/semantic-arc-opts-redundantcopyopts.sil +index 98765e0e4a3..4dc68bf522b 100644 +--- a/swift/test/SILOptimizer/semantic-arc-opts-redundantcopyopts.sil ++++ b/swift/test/SILOptimizer/semantic-arc-opts-redundantcopyopts.sil +@@ -1,5 +1,7 @@ + // RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -semantic-arc-opts -sil-semantic-arc-peepholes-redundant-copyvalue-elim %s | %FileCheck %s + ++// XFAIL: OS=linux-android, OS=linux-androideabi ++ + // NOTE: Some of our tests here depend on borrow elimination /not/ running! + // Please do not add it to clean up the IR like we did in + // semanticarcopts-loadcopy-to-loadborrow! diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl index 16e05052609..7ab8cebfab8 100755 --- a/swift/utils/build-script-impl @@ -59,6 +83,21 @@ index 7f290d16..95366592 100644 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +diff --git a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake +index 468dc61..a90ae3d 100644 +--- a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake ++++ b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake +@@ -2,6 +2,10 @@ + set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info) + if(CMAKE_Swift_COMPILER_TARGET) + list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET}) ++else() ++ set(arg_list ${CMAKE_Swift_FLAGS}) ++ separate_arguments(arg_list) ++ list(APPEND print_target_info_invocation ${arg_list}) + endif() + execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json) + message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n" diff --git a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake index cbdfc2a..bb4121d 100644 --- a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake @@ -86,6 +125,21 @@ index 1be9a4b..bd7b1bd 100644 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +diff --git a/swift-testing/cmake/modules/PlatformInfo.cmake b/swift-testing/cmake/modules/PlatformInfo.cmake +index 94c60ef..ab8a491 100644 +--- a/swift-testing/cmake/modules/PlatformInfo.cmake ++++ b/swift-testing/cmake/modules/PlatformInfo.cmake +@@ -9,6 +9,10 @@ + set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info) + if(CMAKE_Swift_COMPILER_TARGET) + list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET}) ++else() ++ set(arg_list ${CMAKE_Swift_FLAGS}) ++ separate_arguments(arg_list) ++ list(APPEND print_target_info_invocation ${arg_list}) + endif() + execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json) + message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n" diff --git a/swift-testing/cmake/modules/TargetTriple.cmake b/swift-testing/cmake/modules/TargetTriple.cmake index e087cc4..02f3a95 100644 --- a/swift-testing/cmake/modules/TargetTriple.cmake