Skip to content

Commit d281fb8

Browse files
authored
Merge pull request #74883 from finagolfin/droid
[android] Enable several C++ Interop and other tests
2 parents f6844aa + 6ede1c2 commit d281fb8

25 files changed

+31
-56
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY
414414

415415

416416
if(BRIDGING_MODE STREQUAL "DEFAULT" OR NOT BRIDGING_MODE)
417-
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "${SWIFT_HOST_VARIANT_SDK}" MATCHES "WINDOWS|ANDROID" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
417+
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
418418
# In debug builds, to workaround a problem with LLDB's `po` command (rdar://115770255).
419-
# On Windows and Android, to workaround a build problem.
419+
# On Windows, to workaround a build problem.
420420
# If the host Swift version is less than 5.8, use pure mode to workaround a C++ interop compiler crash.
421421
set(BRIDGING_MODE "PURE")
422422
else()

docs/Android.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Swift-to-Java bridging.
3131
To follow along with this guide, you'll need:
3232

3333
1. A Linux environment capable of building Swift from source, preferably
34-
Ubuntu 20.04 or Ubuntu 18.04. Before attempting to build for Android,
34+
Ubuntu 22.04 or Ubuntu 20.04. Before attempting to build for Android,
3535
please make sure you are able to build for Linux by following the
3636
instructions in the Swift project README.
3737
2. The latest build of the Swift compiler for your Linux distro, available at
3838
https://www.swift.org/download/ or sometimes your distro package manager.
39-
3. The latest version of the Android LTS NDK (r26c at the time of this writing),
39+
3. The latest version of the Android LTS NDK (r26d at the time of this writing),
4040
available to download here:
4141
https://developer.android.com/ndk/downloads
4242
4. An Android device with remote debugging enabled or the emulator. We require
@@ -54,9 +54,9 @@ and the prebuilt Swift toolchain (add --skip-early-swift-driver if you already
5454
have a Swift toolchain in your path):
5555

5656
```
57-
$ NDK_PATH=path/to/android-ndk-r26c
58-
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2023-09-30-a-ubuntu20.04/usr/bin
59-
$ git checkout swift-DEVELOPMENT-SNAPSHOT-2023-09-30-a
57+
$ NDK_PATH=path/to/android-ndk-r26d
58+
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2024-07-09-a-ubuntu22.04/usr/bin
59+
$ git checkout swift-DEVELOPMENT-SNAPSHOT-2024-07-09-a
6060
$ utils/build-script \
6161
-R \ # Build in ReleaseAssert mode.
6262
--android \ # Build for Android.
@@ -83,8 +83,8 @@ Then use the standalone Swift stdlib from the previous step to compile a Swift
8383
source file, targeting Android:
8484

8585
```
86-
$ NDK_PATH="path/to/android-ndk-r26c"
87-
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2023-09-30-a-ubuntu20.04/usr/bin
86+
$ NDK_PATH="path/to/android-ndk-r26d"
87+
$ SWIFT_PATH=path/to/swift-DEVELOPMENT-SNAPSHOT-2024-07-09-a-ubuntu22.04/usr/bin
8888
$ $SWIFT_PATH/swiftc \ # The prebuilt Swift compiler you downloaded
8989
# The location of the tools used to build Android binaries
9090
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
@@ -133,7 +133,7 @@ $ adb push build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift/android/libBlo
133133
In addition, you'll also need to copy the Android NDK's libc++:
134134

135135
```
136-
$ adb push /path/to/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp
136+
$ adb push /path/to/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp
137137
```
138138

139139
Finally, you'll need to copy the `hello` executable you built in the
@@ -176,8 +176,8 @@ $ utils/build-script \
176176
-R \ # Build in ReleaseAssert mode.
177177
-T \ # Run all tests, including on the Android device (add --host-test to only run Android tests on the Linux host).
178178
--android \ # Build for Android.
179-
--android-ndk ~/android-ndk-r26c \ # Path to an Android NDK.
180-
--android-arch aarch64 \ # Optionally specify Android architecture, alternately armv7
179+
--android-ndk ~/android-ndk-r26d \ # Path to an Android NDK.
180+
--android-arch aarch64 \ # Optionally specify Android architecture, alternately armv7 or x86_64
181181
--android-api-level 21
182182
```
183183

test/Concurrency/Runtime/actor_assert_precondition_executor_checkIsolated_dispatch_dispatchMain_swift_6_mode.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import Darwin
2222
import Glibc
2323
#elseif canImport(Musl)
2424
import Musl
25+
#elseif canImport(Android)
26+
import Android
2527
#endif
2628

2729
@main struct Main {

test/Interop/Cxx/class/custom-new-operator-irgen.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %target-swiftxx-frontend -I %S/Inputs %s -emit-ir | %FileCheck %s
22

3-
// XFAIL: OS=linux-android, OS=linux-androideabi
4-
53
import CustomNewOperator
64

75
var x = callsCustomNew()

test/Interop/Cxx/class/memory-layout-silgen.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %target-swiftxx-frontend -I %S/Inputs -emit-ir -o - %s | %FileCheck %s
22

3-
// XFAIL: OS=linux-android
4-
// XFAIL: OS=linux-androideabi
5-
63
import MemoryLayout
74

85
var v = PrivateMemberLayout()

test/Interop/Cxx/foreign-reference/move-only-irgen.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-experimental-cxx-interop -validate-tbd-against-ir=none -disable-llvm-verify -Xcc -fignore-exceptions -disable-availability-checking | %FileCheck %s
2-
//
3-
// XFAIL: OS=linux-android, OS=linux-androideabi
42

53
import MoveOnly
64

test/Interop/Cxx/foreign-reference/move-only-module-interface.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-ide-test -print-module -module-to-print=MoveOnly -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
2-
//
3-
// XFAIL: OS=linux-android, OS=linux-androideabi
42

53
// CHECK: class MoveOnly {
64
// CHECK-NOT: init

test/Interop/Cxx/foreign-reference/move-only-silgen.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-emit-silgen %s -I %S/Inputs -enable-experimental-cxx-interop -disable-availability-checking | %FileCheck %s
2-
//
3-
// XFAIL: OS=linux-android, OS=linux-androideabi
42

53
import MoveOnly
64

test/Interop/Cxx/foreign-reference/nullable-module-interface.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-ide-test -print-module -module-to-print=Nullable -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
2-
//
3-
// XFAIL: OS=linux-android, OS=linux-androideabi
42

53
// CHECK: class Empty {
64
// CHECK: func test() -> Int32

test/Interop/Cxx/foreign-reference/pod-irgen.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-experimental-cxx-interop -validate-tbd-against-ir=none -disable-llvm-verify -Xcc -fignore-exceptions -disable-availability-checking | %FileCheck %s
2-
//
3-
// XFAIL: OS=linux-android, OS=linux-androideabi
42

53
import POD
64

0 commit comments

Comments
 (0)