-
Notifications
You must be signed in to change notification settings - Fork 1
Android API 23 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android API 23 #16
Conversation
* Build Android image * Checkout without ssh * Retry build if it fails * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Update installed packages after nightly platform expansion (swiftlang#458) * update nightly-6.1 dependencies * update nightly-main dependencies * fix ubuntu images * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Fedora 41 Dockerfile (swiftlang#464) * Build Android image * Build Android image * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Build Android image * Build Android image * Build Android image * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Android build * Swift Android build * Swift Android build * Swift Android build --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Chris McGee <[email protected]> Co-authored-by: Justice Adams <[email protected]> Co-authored-by: Andrew Sukach <[email protected]>
* Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Start splitting NDK out from the rest of the SDK * Start splitting NDK out from the rest of the SDK * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2
* Swift Android build 6.2 * Swift Android build 6.2 * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle
* Add static libraries to post-install script * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Update submodules
…z,max-page-size=16384
…-*-branch, or development
… for build reproducibility
| perl -pi -g -we "s#(call rm ... \".\{LIBDISPATCH_BUILD_DIR\}\"\n(\s+)fi\n)#\1\2if [[ -d \"\\\${ANDROID_NDK}\" ]]; then call ln -sf \"\\\${SWIFT_BUILD_PATH}/lib/swift\" \"\\\${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib\"; fi#" swift-project/swift/utils/build-script-impl | ||
|
|
||
| # disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport) | ||
| perl -pi -e 's;os\(Android\);os\(AndroidDISABLED\);g' swift-project/swift-testing/Sources/Testing/SourceAttribution/Backtrace.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch isn't necessary anymore. Swift Testing uses dlsym() to look up backtrace() before calling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, it is still needed for the 6.2 branch though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derp. OK, I'll put it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but remove it for main! 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meaning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to get this patch out of the way now, then revisit if needed when we add #available to the mix. I don't like having an official toolchain that isn't building from actual source. Makes for spooky bugs I can't diagnose or fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, we have much bigger problems with Testing, as any Swift package with macros sees strange build errors when cross-compiling, swiftlang/swift-package-manager#8094, so I wouldn't worry about many using Testing until that is fixed. 😉 We will probably have to add doc telling people to only use XCTest on Android until then.
As for this change, rather than putting in logic to check both scheme and tag names that use 6.2 and only applying this change then, let's decide after the next trunk tag, when people can try the new #available(Android feature on their code finally, if we want to submit that new feature for 6.2. If not, I guarantee you that I will elide this change for 6.3 alone before the branch in a couple weeks. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely don't want to tell people to only use XCTest! Given that Swift Testing is part of the toolchain, there should be no reason a developer who can use XCTest can't use Swift Testing.
But okay, I'll stop complaining until after the next tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that Swift Testing is part of the toolchain, there should be no reason a developer who can use XCTest can't use Swift Testing.
Given that long-standing issue with cross-compiling macros for tests, I don't see any way around warning Android users off Testing for now.
| perl -pi -e 's;posix_spawnattr_destroy;//posix_spawnattr_destroy;g' swift-corelibs-foundation/Sources/Foundation/Process.swift | ||
|
|
||
| # Stub out getgrgid_r and getgrnam_r missing from Android API 23 | ||
| perl -pi -e 's;getgrgid_r|getgrnam_r;{ _, _, _, _, _ in 0 };g' swift-foundation/Sources/FoundationEssentials/Platform.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you want to do with this pull, actually merge all these changes, that simply stub out newer API calls, to the official CI and SDK bundle generator or properly #available check them in their repos once you try this stubbed-out bundle here first?
My bigger concern is who is going to maintain the SDK bundle for these older APIs in the coming years. If @etcwilde and @madsodgaard and whoever else wants us to ship an official bundle built against API 23, they should be willing to handle all issues stemming from APIs 23-27, since that primarily affects them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you want to do with this pull
Well, I mostly started this PR to see how hard it would be to get an SDK build that worked for API 23. I was surprised how little patching was needed. I hadn't developed any concrete plans beyond that.
Ideally, we'd hear from more people from the forum post on the topic, and especially whether this build might be suitable for @madsodgaard's work. If supporting back to API 23 would prevent the need for people to use their own custom builds of the SDK, then I think it would be worth it to get this in.
The question then would be whether to just go ahead with this PR (which merely disables things that aren't really applicable on Android anyway), or wait on being able to use #available(Android, …) (which, from what I understand, would need to wait until we want to require NDK 28+ for Android development). Since we're already patching stuff, and since the patches are fairly harmless, I personally think it would be fine to merge this short-term. We could even say that we "officially" only support/recommend API 28+, and older targets like x86_64-unknown-linux-android23 would be left to the developer to experiment with.
WDYT, @finagolfin, @shahmishal, @madsodgaard, @grynspan, @andriydruk, @Joannis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great for us, so that we don't have to fork our own SDK:) but as I mentioned on the forums, we would still need the shim for ifaddrs (to use networking like NIO) and probably also fix up the FILE pointer, for this to be usable for us. Other than that, it would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to be overly cantankerous, but an official Android toolchain really ought to be built from the official Swift sources. In other words, if there are changes needed in components of the Swift toolchain, we should get PRs up for as many of them as possible. If this is a stopgap until #available is, er, available, then can it wait a few weeks for that to happen?
I realize the situation is different for Swift 6.2, but Swift 6.2 has shipped to developers already and changes to the Swift toolchain should probably focus on the next release (6.3) instead.
With regards to the Swift Testing patch specifically, it's a problem for us because it is fragile and means a change to our code could break Android without us having any signal. The code in question is shaped like:
#if Apple
doThis()
#elseif os(Linux)
doThat()
#elseif os(Android)
if let doThat = dlsym("doThat") { doThat() }
#else
#warning("Didn't do that.")
#endifBut if we were to change the code such that Android came first, or such that we had #error instead of #warning, now the toolchain would fail to build. I'm not anticipating those changes will actually happen, just trying to illustrate why I'm opposed to having the patch here.
Anyway, that's my two cents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to be overly cantankerous, but an official Android toolchain really ought to be built from the official Swift sources
I understand — and I don't disagree with — your objection, but do note that the potential backtrace issue you mention is already in place with the current Swift SDK for Android release. This PR just shuffles the patch from the build-docker and build-local scripts into a single place in fetch-sources.sh (as well as implementing the additional patches).
Not to be too cavalier, but if the build starts failing (either in the official CI or in my watchdog CI), either @finagolfin or I will know to address it. And if/when we are able to make @swift-ci Please test Android requests, that will further enhance stability.
The broader picture is that this PR widens the potential users of this SDK, which is something @shahmishal asked us to look into. The patching is meant to be temporary, and will be progressively removed as we either start relying on #available(Android, …) or work around them with dlsym jiggery-pokery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I'm not trying to hold up the merge, just trying to get my thoughts out before I forget 'em all. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait on being able to use #available(Android, …) (which, from what I understand, would need to wait until we want to require NDK 28+ for Android development).
Hmm, that is a good question: we may have to provide an SDK bundle ourselves that's built against the new stable NDK 29, as the next trunk tag may not work well with LTS NDK 27, now that Mads's #available pull was merged.
We may have to use different NDKs for 6.3 and the upcoming 6.2 CI, as long as one has #available and the other doesn't, then decide if we want to push #available into 6.2 or not.
@marcprux, since you're one of the few people building your own toolchain, want to try pushing the #available pull and NDK 29 into a release/6.2.1 bundle locally generated by the Docker script, then copy that modified swift-frontend it builds into your toolchain and test it? We're going to have to provide something like that in our quasi-official 6.2 releases next, so people can try out this new feature easily.
Not to be overly cantankerous, but an official Android toolchain really ought to be built from the official Swift sources. In other words, if there are changes needed in components of the Swift toolchain, we should get PRs up for as many of them as possible.
No problem, I think we all agree on the principle, but as they say, the cantanker is in the details. 😉
In this case, I tried to upstream all the patches I could, but left only three in the final Docker script: a compiler test that we were seeing strange file permission errors with git grep in our Docker runs alone, a modification of build-script to work around a swift-driver regression for which I submitted a fix many months ago, and disabling backtrace() for swift-testing. I think that is fine for a preview release that can't use Testing much anyway because of this long-standing SwiftPM bug, swiftlang/swift-package-manager#8094, which appears to break cross-compiling Testing with SwiftPM to all platforms, while the first two changes obviously only affect the build, not the produced SDK bundle.
As for this change, I'm fine with it, as these APIs basically do nothing on any Android device, because the OS assigns a random temporary user to every Android app installed.
I do think we should investigate and remove the git grep issue soon, and not simply stub out those later posix_spawn APIs if we want to get this in.
|
Wow I missed a lot of discussion. I'm all for this PR, and supporting a wider range of devices. Even if we have to mark it as being less supported than more recent SDKs. I do agree with @grynspan 's sentiment that these should go in their respective repos. Also, I think our community should focus on making sure we're in the best shape for 6.3 before we focus on 6.2.x. |
|
I think we are all sufficiently aligned on this that this PR can be merged into https://github.com/swift-android-sdk/swift-docker/tree/main. I'll need to file another PR for upstream https://github.com/swiftlang/swift-docker/tree/main, so we can continue discussions there… |
* Add Android workflow * Build Android image (#1) * Build Android image * Checkout without ssh * Retry build if it fails * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Update installed packages after nightly platform expansion (swiftlang#458) * update nightly-6.1 dependencies * update nightly-main dependencies * fix ubuntu images * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Fedora 41 Dockerfile (swiftlang#464) * Build Android image * Build Android image * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Build Android image * Build Android image * Build Android image * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Android build * Swift Android build * Swift Android build * Swift Android build --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Chris McGee <[email protected]> Co-authored-by: Justice Adams <[email protected]> Co-authored-by: Andrew Sukach <[email protected]> * Swift Android build 6.2 (#2) * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Start splitting NDK out from the rest of the SDK * Start splitting NDK out from the rest of the SDK * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 (#3) * Swift Android build 6.2 * Swift Android build 6.2 * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Build SDK in Docker container (#4) * Add static libraries to post-install script * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Update submodules * Checkout patches repo instead of using a git submodule * Update libcurl to 8.13.0 * Remove resources that we no longer use * Update libcurl to 8.13.0 * Update libxml2 to 2.14.2 * Build libxml2, libcurl, and boringssl with support for Android 16kb page sizes * Add build-script --extra-cmake-options=-DCMAKE_EXTRA_LINK_FLAGS=-Wl,-z,max-page-size=16384 * Add 16KB page size linker flags to linker flags in swift-toolset.json * Add 16KB page size linker flags to linker flags in swift-toolset.json * Build with ndk-r28b * Revert to building with ndk-r27c * Use official endpoints for discovering latest Swift release/devel/trunk tags * Typo fix in version script * Cleanup for PR * Change BUILD_VERSION to BUILD_SCHEME and have it match release, swift-*-branch, or development * Update Android README * Update how patches are applied * Fix source directory for patch target * Harmonize timestamps in artifactbundle with the swift source tag date for build reproducibility * Simplify toolchain-vars.sh * Run the compiler validation suite for Android (#8) * Run the compiler validation suite for Android * Add --build-compiler option * Add --cross-compile-build-swift-tools=0 from swiftlang/swift#38441 * Build with --build-llvm=0 * Check out Yams for Swift 6.1.1 build * Add --llvm-ninja-targets-for-cross-compile-hosts=help * Install pre-requisites * Install build prerequisites * Only setup local toolchain if build-compiler is not 0 * Fix Yams version checkout * Quote arguments to build scripts * Permit empty host-toolchain argument in build.sh * Fix check for BUILD_COMPILER * Re-order Docker PATH to system clang is used before Swift toolchain clang * Use --host-test to skip attempt to test on connected device/emulator * Install clang in Dockerfile * Add --skip-test-linux flag to build * Remove more folders to free up space * Update patches * Add docker-specific CI variants that run the compiler validation tests * meaningless edit * Update pull_request.yml to stop the 6.1 release builds * Update pull_request.yml to really only build the full docker compiler with tests * Update README.md with meaningless edit to bump build * Update build.sh to skip testing XCTest for linux, as a handful of the linux tests fail for some reason * Update build.sh to disable building libTesting and for 16K memory pages, as both don't work yet * Update build.sh to skip testing Foundation for linux, which requires building SwiftPM from source first * Update build.sh to not build each arch in a separate build directory * Update Dockerfile to use clang 19 instead * Add self-hosted runner CI variant * Fix CI workflow syntax * Update CI runner config * Update CI runner config * Fix name of self-hosted CI runner * Re-order arch run sequence * Update CI for self-hosted runner * Build for self-hosted runner * Add swift-6.2-branch to self-hosted run matrix * Update build.sh to disable aarch64 temporarily, as we know it built fine * Update pull_request.yml to disable non-compiler builds, as they all work, and comment out self-hosted till we know armv7 works * Run compiler validation on self-hosted with increased timeout * Update build-docker to only build for armv7 * Update pull_request.yml to disable self-hosted builds temporarily * Update pull_request.yml to build the full compiler in github runners with the armv7 stdlib and tests * Update build-docker to build for aarch64 first * Update toolchain-vars.sh to use older trunk snapahot toolchain that didn't crash * Update toolchain-vars.sh to only download the latest release compiler if building the Swift compiler from source * Update build-docker to only build for armv7 again * Update toolchain-vars.sh to fix setting branch variable * Update build-docker to build for all three supported arches * Update pull_request.yml to try self-hosted runs again * Update build.sh to only install SDK components and remove linux stdlib * Tolerate missing linux folder when attempting to clean up unnecessary build artifacts * Fix extraCLIOptions in swift-toolset.json * gcpdw * Fix patch application * Update apply-patches.sh to remove unused changes * Update swift-android-testing-except-release.patch to add Testing fix * Update swift-android.patch to remove unneeded patches * Update build.sh to try and fix Testing and clean up the bundle more * Fix README.md --------- Co-authored-by: finagolfin <[email protected]> * Build compiler-validated bundles from latest branch commits, not older tags Also update patches, particularly to disable failing tests from the compiler validation suite * gcpd 'Update patches' * Update patches and build matrix * Disable compiler validated builds on self-hosted * Centralize cmake variable for 6.2 in patches, as done for trunk upstream * Update disabled tests * Try running Docker build on macOS host * Remove separate checks of libxml2, curl, and yams * Remove upstreamed 6.2 branch patches * Use command-line flags to work around CMake 3.30+ linker flag bug, rather than patching files * Create an Android CMake toolchain file instead to cross-compile Testing and add 16 KB page linker flag to 6.2 branch * Install the native host LLVM tools for full compiler builds * Extend `--cross-compile-build-swift-tools=False` to disable building and installing LLVM and the Testing macros for cross-compiled hosts, then enable building and using the Testing macros for the native host. * Don't copy any libraries from the NDK: link the NDK's clang resource directory in the post-install script instead * Wildcard the clang version link in the post-install script in order to accomodate NDK 27 and 28 * Switch generated shell header to use #!/usr/bin/env bash * SBOM and nits (#14) * Address nits * Eliminate unnecessaryt pushds and use run cmake install instead of ninja * Generate SBOM with SDK dependencies * Add example of command for building locally * Remove upstreamed patches and turn the last modifications into perl substitutions instead. * Remove self-hosted build on github CI * Remove android_build job from pull_request workflow * Add license headers to Android build scripts * Remove unnecessary .gitignore * Add license header to Dockerfile * Switch over to using explicit tags and branches when invoking build-docker/local Also, force the full Swift compiler to be built from source when building from a branch, since there are no existing toolchain builds of arbitrary commits that we can download. * Fix build script arguments to use false instead of False due to true_false not handling the capitalized form * Build swift-6.2-RELEASE * Apply patch from swiftlang/swift#84061 for 6.2.0 Android SDK release * Update patch application for 6.2 * Change 6.2 to perform local build * Change 6.2 to perform local build on ubuntu-24.04 * Switch back to building 6.2 from a tag * Switch back to building 6.2 from a tag * Switch back to building 6.2 from a tag * Build the Swift 6.2 release self-hosted with compiler validation * Set minimum Android API to 24 * Build against swift-DEVELOPMENT-SNAPSHOT-2025-10-16- * Disable building libxml2 tests to handle missing glob function in Android 24 * Disable building libxml2 tests to handle missing glob function in Android 24 * Build this PR without compiler validation * Build this PR without compiler validation * Disable posix_spawnattr_ for Android 24 * Reduce Android API from 24 to 23 * Restore Android minimum API to 24 * Add swift-nio to tests cases being run * Reduce Android API from 24 to 23 * Try building swift-collections * Try testing against emulator API level 23 * Fix backtrace call * Fail with an error for posix_spawn * Fix error for posix_spawn * Remove temporary swift-docker Android build workflow --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Chris McGee <[email protected]> Co-authored-by: Justice Adams <[email protected]> Co-authored-by: Andrew Sukach <[email protected]> Co-authored-by: finagolfin <[email protected]>
* Add Android workflow * Build Android image (#1) * Build Android image * Checkout without ssh * Retry build if it fails * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Update installed packages after nightly platform expansion (swiftlang#458) * update nightly-6.1 dependencies * update nightly-main dependencies * fix ubuntu images * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Fedora 41 Dockerfile (swiftlang#464) * Build Android image * Build Android image * Swift 6.1 Release Dockerfiles (swiftlang#456) * Change binutils-gold package dependency on Debian 12 to binutils (swiftlang#457) * Build Android image * Build Android image * Build Android image * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Android SDK build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Androd build * Swift Android build * Swift Android build * Swift Android build * Swift Android build --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Chris McGee <[email protected]> Co-authored-by: Justice Adams <[email protected]> Co-authored-by: Andrew Sukach <[email protected]> * Swift Android build 6.2 (#2) * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Start splitting NDK out from the rest of the SDK * Start splitting NDK out from the rest of the SDK * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 * Swift Android build 6.2 (#3) * Swift Android build 6.2 * Swift Android build 6.2 * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Build SDK in Docker container (#4) * Add static libraries to post-install script * Add post-install script to SDK bundle * Add post-install script to SDK bundle * Update submodules * Checkout patches repo instead of using a git submodule * Update libcurl to 8.13.0 * Remove resources that we no longer use * Update libcurl to 8.13.0 * Update libxml2 to 2.14.2 * Build libxml2, libcurl, and boringssl with support for Android 16kb page sizes * Add build-script --extra-cmake-options=-DCMAKE_EXTRA_LINK_FLAGS=-Wl,-z,max-page-size=16384 * Add 16KB page size linker flags to linker flags in swift-toolset.json * Add 16KB page size linker flags to linker flags in swift-toolset.json * Build with ndk-r28b * Revert to building with ndk-r27c * Use official endpoints for discovering latest Swift release/devel/trunk tags * Typo fix in version script * Cleanup for PR * Change BUILD_VERSION to BUILD_SCHEME and have it match release, swift-*-branch, or development * Update Android README * Update how patches are applied * Fix source directory for patch target * Harmonize timestamps in artifactbundle with the swift source tag date for build reproducibility * Simplify toolchain-vars.sh * Run the compiler validation suite for Android (#8) * Run the compiler validation suite for Android * Add --build-compiler option * Add --cross-compile-build-swift-tools=0 from swiftlang/swift#38441 * Build with --build-llvm=0 * Check out Yams for Swift 6.1.1 build * Add --llvm-ninja-targets-for-cross-compile-hosts=help * Install pre-requisites * Install build prerequisites * Only setup local toolchain if build-compiler is not 0 * Fix Yams version checkout * Quote arguments to build scripts * Permit empty host-toolchain argument in build.sh * Fix check for BUILD_COMPILER * Re-order Docker PATH to system clang is used before Swift toolchain clang * Use --host-test to skip attempt to test on connected device/emulator * Install clang in Dockerfile * Add --skip-test-linux flag to build * Remove more folders to free up space * Update patches * Add docker-specific CI variants that run the compiler validation tests * meaningless edit * Update pull_request.yml to stop the 6.1 release builds * Update pull_request.yml to really only build the full docker compiler with tests * Update README.md with meaningless edit to bump build * Update build.sh to skip testing XCTest for linux, as a handful of the linux tests fail for some reason * Update build.sh to disable building libTesting and for 16K memory pages, as both don't work yet * Update build.sh to skip testing Foundation for linux, which requires building SwiftPM from source first * Update build.sh to not build each arch in a separate build directory * Update Dockerfile to use clang 19 instead * Add self-hosted runner CI variant * Fix CI workflow syntax * Update CI runner config * Update CI runner config * Fix name of self-hosted CI runner * Re-order arch run sequence * Update CI for self-hosted runner * Build for self-hosted runner * Add swift-6.2-branch to self-hosted run matrix * Update build.sh to disable aarch64 temporarily, as we know it built fine * Update pull_request.yml to disable non-compiler builds, as they all work, and comment out self-hosted till we know armv7 works * Run compiler validation on self-hosted with increased timeout * Update build-docker to only build for armv7 * Update pull_request.yml to disable self-hosted builds temporarily * Update pull_request.yml to build the full compiler in github runners with the armv7 stdlib and tests * Update build-docker to build for aarch64 first * Update toolchain-vars.sh to use older trunk snapahot toolchain that didn't crash * Update toolchain-vars.sh to only download the latest release compiler if building the Swift compiler from source * Update build-docker to only build for armv7 again * Update toolchain-vars.sh to fix setting branch variable * Update build-docker to build for all three supported arches * Update pull_request.yml to try self-hosted runs again * Update build.sh to only install SDK components and remove linux stdlib * Tolerate missing linux folder when attempting to clean up unnecessary build artifacts * Fix extraCLIOptions in swift-toolset.json * gcpdw * Fix patch application * Update apply-patches.sh to remove unused changes * Update swift-android-testing-except-release.patch to add Testing fix * Update swift-android.patch to remove unneeded patches * Update build.sh to try and fix Testing and clean up the bundle more * Fix README.md --------- Co-authored-by: finagolfin <[email protected]> * Build compiler-validated bundles from latest branch commits, not older tags Also update patches, particularly to disable failing tests from the compiler validation suite * gcpd 'Update patches' * Update patches and build matrix * Disable compiler validated builds on self-hosted * Centralize cmake variable for 6.2 in patches, as done for trunk upstream * Update disabled tests * Try running Docker build on macOS host * Remove separate checks of libxml2, curl, and yams * Remove upstreamed 6.2 branch patches * Use command-line flags to work around CMake 3.30+ linker flag bug, rather than patching files * Create an Android CMake toolchain file instead to cross-compile Testing and add 16 KB page linker flag to 6.2 branch * Install the native host LLVM tools for full compiler builds * Extend `--cross-compile-build-swift-tools=False` to disable building and installing LLVM and the Testing macros for cross-compiled hosts, then enable building and using the Testing macros for the native host. * Don't copy any libraries from the NDK: link the NDK's clang resource directory in the post-install script instead * Wildcard the clang version link in the post-install script in order to accomodate NDK 27 and 28 * Switch generated shell header to use #!/usr/bin/env bash * SBOM and nits (#14) * Address nits * Eliminate unnecessaryt pushds and use run cmake install instead of ninja * Generate SBOM with SDK dependencies * Add example of command for building locally * Remove upstreamed patches and turn the last modifications into perl substitutions instead. * Remove self-hosted build on github CI * Remove android_build job from pull_request workflow * Add license headers to Android build scripts * Remove unnecessary .gitignore * Add license header to Dockerfile * Switch over to using explicit tags and branches when invoking build-docker/local Also, force the full Swift compiler to be built from source when building from a branch, since there are no existing toolchain builds of arbitrary commits that we can download. * Fix build script arguments to use false instead of False due to true_false not handling the capitalized form * Build swift-6.2-RELEASE * Apply patch from swiftlang/swift#84061 for 6.2.0 Android SDK release * Update patch application for 6.2 * Change 6.2 to perform local build * Change 6.2 to perform local build on ubuntu-24.04 * Switch back to building 6.2 from a tag * Switch back to building 6.2 from a tag * Switch back to building 6.2 from a tag * Build the Swift 6.2 release self-hosted with compiler validation * Set minimum Android API to 24 * Build against swift-DEVELOPMENT-SNAPSHOT-2025-10-16- * Disable building libxml2 tests to handle missing glob function in Android 24 * Disable building libxml2 tests to handle missing glob function in Android 24 * Build this PR without compiler validation * Build this PR without compiler validation * Disable posix_spawnattr_ for Android 24 * Reduce Android API from 24 to 23 * Restore Android minimum API to 24 * Add swift-nio to tests cases being run * Reduce Android API from 24 to 23 * Try building swift-collections * Try testing against emulator API level 23 * Fix backtrace call * Fail with an error for posix_spawn * Fix error for posix_spawn * Remove temporary swift-docker Android build workflow --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Chris McGee <[email protected]> Co-authored-by: Justice Adams <[email protected]> Co-authored-by: Andrew Sukach <[email protected]> Co-authored-by: finagolfin <[email protected]>
This PR builds the Swift SDK for Android to support Android API levels back to 23 (down from 28).
It also unified the source patches in the build scripts so they are just in a single place (in the
fetch-source.shscript).