@@ -9,8 +9,8 @@ emulator](https://github.com/finagolfin/swift-android-sdk/blob/main/.github/work
99
1010## Cross-compiling and testing Swift packages with the Android SDK bundle
1111
12- To build with the Swift 6.1.3 SDK bundle, first download [ the official open-source
13- Swift 6.1.3 toolchain for linux or macOS] ( https://swift.org/install )
12+ To build with the Swift 6.2 SDK bundle, first download [ the official open-source
13+ Swift 6.2 toolchain for linux or macOS] ( https://swift.org/install )
1414(make sure to install the Swift dependencies linked there). Install the OSS
1515toolchain on macOS as detailed in [ the instructions for using the static linux
1616Musl SDK bundle at swift.org] ( https://www.swift.org/documentation/articles/static-linux-getting-started.html ) .
@@ -19,15 +19,15 @@ On linux, simply download the toolchain, unpack it, and add it to your `PATH`.
1919Next, install the Android SDK bundle by having the Swift toolchain directly
2020download it:
2121```
22- swift sdk install https://github.com/finagolfin/swift-android-sdk/releases/download/6.1.3 /swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum 440d09d539bda5b94807598b00696ac5d3893cb515b24715ac8868d62130b6d5
22+ swift sdk install https://github.com/finagolfin/swift-android-sdk/releases/download/6.2 /swift-6.2 -RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum c26ebfd4e32c0ca1beabcc45729b62042da57ee76d7d043f63f2235da90dc491
2323```
2424or alternately, download the SDK bundle with your favorite downloader and install
2525it separately:
2626```
27- > wget https://github.com/finagolfin/swift-android-sdk/releases/download/6.1.3 /swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle.tar.gz
28- > sha256sum swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle.tar.gz
29- 440d09d539bda5b94807598b00696ac5d3893cb515b24715ac8868d62130b6d5 swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle.tar.gz
30- > swift sdk install swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle.tar.gz
27+ > wget https://github.com/finagolfin/swift-android-sdk/releases/download/6.2 /swift-6.2 -RELEASE-android-24-0.1.artifactbundle.tar.gz
28+ > sha256sum swift-6.2 -RELEASE-android-24-0.1.artifactbundle.tar.gz
29+ c26ebfd4e32c0ca1beabcc45729b62042da57ee76d7d043f63f2235da90dc491 swift-6.2 -RELEASE-android-24-0.1.artifactbundle.tar.gz
30+ > swift sdk install swift-6.2 -RELEASE-android-24-0.1.artifactbundle.tar.gz
3131```
3232You can check if it was properly installed by running ` swift sdk list ` .
3333
@@ -56,20 +56,20 @@ one depends on the example executables `color`, `generate-manual`, `math`,
5656point at test data in the repo: I've had success moving this data with the test
5757runner, after modifying the test source so it has the path to this test data in
5858the Android test environment. See the example of [ swift-crypto on the
59- CI] ( https://github.com/finagolfin/swift-android-sdk/blob/6.1.3 /.github/workflows/sdks.yml#L532 ) .
59+ CI] ( https://github.com/finagolfin/swift-android-sdk/blob/6.2 /.github/workflows/sdks.yml#L522 ) .
6060
6161You can copy these executables and the Swift runtime libraries to [ an emulator
62- or a USB debugging-enabled device with adb] ( https://github.com/swiftlang/swift/blob/release/6.1 /docs/Android.md#3-deploying-the-build-products-to-the-device ) ,
62+ or a USB debugging-enabled device with adb] ( https://github.com/swiftlang/swift/blob/release/6.2 /docs/Android.md#3-deploying-the-build-products-to-the-device ) ,
6363or put them on an Android device with [ a terminal emulator app like Termux] ( https://termux.dev/en/ ) .
6464I test aarch64 with Termux so I'll show how to run the test runner there, but
65- the process is similar with adb, [ as can be seen on the CI] ( https://github.com/finagolfin/swift-android-sdk/blob/6.1.3 /.github/workflows/sdks.yml#L480 ) .
65+ the process is similar with adb, [ as can be seen on the CI] ( https://github.com/finagolfin/swift-android-sdk/blob/6.2 /.github/workflows/sdks.yml#L470 ) .
6666
67- Copy the test executables to the same directory as the Swift 6.1.3 runtime libraries:
67+ Copy the test executables to the same directory as the Swift 6.2 runtime libraries:
6868```
6969cp .build/aarch64-unknown-linux-android24/debug/{swift-argument-parserPackageTests.xctest,color,generate-manual,math,repeat,roll} ..
70- cp ~/.swiftpm/swift-sdks/swift-6.1.3 -RELEASE-android-24-0.1.artifactbundle/swift-6.1.3 -release-android-24-sdk/android-27d-sysroot/usr/lib/aarch64-linux-android/lib*.so ..
70+ cp ~/.swiftpm/swift-sdks/swift-6.2 -RELEASE-android-24-0.1.artifactbundle/swift-6.2 -release-android-24-sdk/android-27d-sysroot/usr/lib/aarch64-linux-android/lib*.so ..
7171```
72- You can copy the test executables and Swift 6.1.3 runtime libraries to Termux using
72+ You can copy the test executables and Swift 6.2 runtime libraries to Termux using
7373scp from OpenSSH, run these commands in Termux on the Android device:
7474```
7575uname -m # check if you're running on the right architecture, should say `aarch64`
@@ -92,16 +92,12 @@ Revert that with `export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermu
9292when you're done running armv7 tests and want to go back to the normal aarch64
9393mode.
9494
95- Two issues were recently introduced into the Swift toolchain that you may need
96- to work around:
97-
98- 1 . If you have the ` ANDROID_NDK_ROOT ` environment variable set, as it is on
99- github Actions runners, this SDK bundle won't work, so unset it.
100-
101- 2 . There is a bug when trying to [ cross-compile ` Testing ` tests with the open-source
102- macOS toolchain alone] ( https://github.com/swiftlang/swift-package-manager/issues/8362 ) -
103- it works fine with the linux toolchain- use the ` -plugin-path ` workaround listed
104- there until it is fixed on macOS.
95+ An issue was recently introduced into the Swift toolchain that you may need
96+ to work around: if you have the ` ANDROID_NDK_ROOT ` environment variable set, as
97+ it is on github Actions runners, this SDK bundle won't work, so unset it. There
98+ is [ a proposed fix for this regression upstream] ( https://github.com/swiftlang/swift-driver/pull/1879 ) ,
99+ but you will have to unset this variable on the CI where it is normally set
100+ until that's in.
105101
106102## Porting Swift packages to Android
107103
@@ -137,11 +133,11 @@ packagingOptions {
137133
138134## Building an Android SDK from source
139135
140- Download the Swift 6.1.3 compiler as above and Android NDK 27d (only building
136+ Download the Swift 6.2 compiler as above and Android NDK 27d (only building
141137the Android SDKs on linux works for now). Check out this repo and run
142- ` SWIFT_TAG=swift-6.1.3 -RELEASE ANDROID_ARCH=aarch64 swift get-packages-and-swift-source.swift `
138+ ` SWIFT_TAG=swift-6.2 -RELEASE ANDROID_ARCH=aarch64 swift get-packages-and-swift-source.swift `
143139to get some prebuilt Android libraries and the Swift source to build an AArch64
144- SDK. If you pass in a different tag like ` swift-DEVELOPMENT-SNAPSHOT-2025-04-03 -a `
140+ SDK. If you pass in a different tag like ` swift-DEVELOPMENT-SNAPSHOT-2025-09-14 -a `
145141for the latest Swift trunk snapshot and pass in the path to the corresponding
146142prebuilt Swift toolchain to ` build-script ` below, you can build a Swift trunk
147143SDK too, as seen on the CI.
@@ -155,14 +151,14 @@ git apply swift-android.patch swift-android-testing-release.patch
155151perl -pi -e 's%r26%r27%' swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
156152```
157153
158- After making sure [ needed build tools like python 3, CMake, and ninja] ( https://github.com/swiftlang/swift/blob/release/6.1 /docs/HowToGuides/GettingStarted.md#linux )
154+ After making sure [ needed build tools like python 3, CMake, and ninja] ( https://github.com/swiftlang/swift/blob/release/6.2 /docs/HowToGuides/GettingStarted.md#linux )
159155are installed, run the following ` build-script ` command with your local paths
160156substituted instead:
161157```
162158./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android
163159--android-ndk /home/finagolfin/android-ndk-r27d/ --android-arch aarch64 --android-api-level 24
164- --build-swift-tools=0 --native-swift-tools-path=/home/finagolfin/swift-6.1.3 -RELEASE-ubuntu22.04/usr/bin/
165- --native-clang-tools-path=/home/finagolfin/swift-6.1.3 -RELEASE-ubuntu22.04/usr/bin/
160+ --build-swift-tools=0 --native-swift-tools-path=/home/finagolfin/swift-6.2 -RELEASE-ubuntu22.04/usr/bin/
161+ --native-clang-tools-path=/home/finagolfin/swift-6.2 -RELEASE-ubuntu22.04/usr/bin/
166162--host-cc=/usr/bin/clang-13 --host-cxx=/usr/bin/clang++-13
167163--cross-compile-hosts=android-aarch64 --cross-compile-deps-path=/home/finagolfin/swift-release-android-aarch64-24-sdk
168164--skip-local-build --xctest --swift-install-components='clang-resource-dir-symlink;license;stdlib;sdk-overlay'
@@ -225,7 +221,7 @@ packages, by compiling against a more recent Android API that doesn't need the
225221` libandroid-spawn ` backport, and by cross-compiling libcurl/libxml2 and their
226222dependencies yourself or not using FoundationNetworking and FoundationXML.
227223
228- Finally, it gets [ the 6.1.3 source] ( https://github.com/swiftlang/swift/releases/tag/swift-6.1.3 -RELEASE )
224+ Finally, it gets [ the 6.2 source] ( https://github.com/swiftlang/swift/releases/tag/swift-6.2 -RELEASE )
229225tarballs for eleven Swift repos and renames them to ` llvm-project/ ` , ` swift/ ` ,
230226` swift-syntax ` , ` swift-experimental-string-processing ` , ` swift-corelibs-libdispatch ` ,
231227` swift-corelibs-foundation ` , ` swift-collections ` , ` swift-foundation ` ,
0 commit comments