Skip to content

Commit

Permalink
Now that NDK 25 has been removed from the github CI, stop building an…
Browse files Browse the repository at this point in the history
…d testing with it
  • Loading branch information
finagolfin committed Aug 21, 2024
1 parent 22c0f0e commit 54866b7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 173 deletions.
50 changes: 16 additions & 34 deletions .github/workflows/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [release-25c, release-27, devel, trunk]
version: [release, devel, trunk]
arch: [aarch64, x86_64, armv7]
env:
ANDROID_API_LEVEL: 24
steps:
- name: Extract the latest version string
id: version
run: |
if [[ ${{ matrix.version }} = 'release'* ]]; then
if [[ ${{ matrix.version }} = 'release' ]]; then
TAG="${{ needs.get-latest-toolchain.outputs.release-version }}"
echo "latest=$(echo $TAG | cut -d- -f2)" >> $GITHUB_OUTPUT
elif [ ${{ matrix.version }} = 'devel' ]; then
Expand Down Expand Up @@ -111,44 +111,37 @@ jobs:
./$SWIFT_TAG-ubuntu22.04/usr/bin/swift --version
git apply swift-android-ci.patch
git apply -C1 swift-android.patch swift-android-both-ndks.patch
if [[ ${{ matrix.version }} = 'release'* ]]; then
if [[ ${{ matrix.version }} = 'release' ]]; then
sed -i "s%strsignal(signal).map%String(cString: strsignal(signal)) //%" swift-driver/Sources/SwiftDriver/Driver/ToolExecutionDelegate.swift
git apply swift-android-stdlib-except-trunk.patch
STUPID_FILE_RENAMING=Tool
else
sed -i "s%r26%ndk/27%" swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
STUPID_FILE_RENAMING=Command
fi
if [ ${{ matrix.version }} = 'release-25c' ]; then
NDK=$ANDROID_NDK/../25.2.9519653
sed -i "s%#include <unistd%#include <signal.h>\n#include <unistd%" swift-corelibs-libdispatch/dispatch/dispatch.h
sed -i "s%#include <unistd%#include <signal.h>\n#include <unistd%" llbuild/products/libllbuild/include/llbuild/buildsystem.h
sed -i "s%#include <time%#include <signal.h>\n#include <time%" swift-tools-support-core/Sources/TSCclibc/include/indexstore_functions.h
sed -i "s%#include <time%#include <signal.h>\n#include <time%" swift-crypto/Sources/CCryptoBoringSSL/include/CCryptoBoringSSL_asn1.h
git apply -C0 swift-android-foundation-ndk26.patch
if [ ${{ matrix.version }} = 'release' ]; then
git apply swift-android-stdlib-ndk26.patch
else
NDK=$ANDROID_NDK
git apply -C0 swift-android-foundation-ndk26.patch
if [ ${{ matrix.version }} = 'release-27' ]; then
git apply swift-android-stdlib-ndk26.patch
if [ ${{ matrix.version }} = 'devel' ]; then
git apply android-overlay/import-android-devel.patch
else
if [ ${{ matrix.version }} = 'devel' ]; then
git apply android-overlay/import-android-devel.patch
else
git apply swift-android-foundation-trunk.patch
fi
git apply android-overlay/foundation-fixes.patch android-overlay/swift-argument-parser.patch android-overlay/swift-stdlib-modulemap.patch android-overlay/swift-system.patch android-overlay/yams.patch
git apply swift-android-foundation-trunk.patch
fi
git apply android-overlay/foundation-fixes.patch android-overlay/swift-argument-parser.patch android-overlay/swift-stdlib-modulemap.patch android-overlay/swift-system.patch android-overlay/yams.patch
fi
sed -i "s%/data/data/com.termux/files%$SDK%" $SDK/usr/lib/pkgconfig/sqlite3.pc
sed -i "s%String(cString: getpass%\"fake\" //%" swiftpm/Sources/PackageRegistry$STUPID_FILE_RENAMING/PackageRegistry$STUPID_FILE_RENAMING+Auth.swift
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android --android-ndk $NDK --android-arch ${{ matrix.arch }} --android-api-level $ANDROID_API_LEVEL --build-swift-tools=0 --native-swift-tools-path=`pwd`/$SWIFT_TAG-ubuntu22.04/usr/bin --native-clang-tools-path=`pwd`/$SWIFT_TAG-ubuntu22.04/usr/bin --cross-compile-hosts=android-${{ matrix.arch }} --cross-compile-deps-path=$SDK --skip-local-build --build-swift-static-stdlib --xctest --skip-early-swift-driver --install-swift --install-libdispatch --install-foundation --install-xctest --install-destdir=$SDK --swift-install-components='clang-resource-dir-symlink;license;stdlib;sdk-overlay' --cross-compile-append-host-target-to-destdir=False -b -p --install-llbuild --sourcekit-lsp --skip-early-swiftsyntax
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android --android-ndk $ANDROID_NDK --android-arch ${{ matrix.arch }} --android-api-level $ANDROID_API_LEVEL --build-swift-tools=0 --native-swift-tools-path=`pwd`/$SWIFT_TAG-ubuntu22.04/usr/bin --native-clang-tools-path=`pwd`/$SWIFT_TAG-ubuntu22.04/usr/bin --cross-compile-hosts=android-${{ matrix.arch }} --cross-compile-deps-path=$SDK --skip-local-build --build-swift-static-stdlib --xctest --skip-early-swift-driver --install-swift --install-libdispatch --install-foundation --install-xctest --install-destdir=$SDK --swift-install-components='clang-resource-dir-symlink;license;stdlib;sdk-overlay' --cross-compile-append-host-target-to-destdir=False -b -p --install-llbuild --sourcekit-lsp --skip-early-swiftsyntax
cp $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$(echo ${{ matrix.arch }} | sed "s/v7//")-linux-android*/libc++_shared.so $SDK/usr/lib
cp $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$(echo ${{ matrix.arch }} | sed "s/v7//")-linux-android*/libc++_shared.so $SDK/usr/lib
patchelf --set-rpath \$ORIGIN $SDK/usr/lib/swift/android/libdispatch.so
patchelf --set-rpath \$ORIGIN/../..:\$ORIGIN $SDK/usr/lib/swift/android/lib[FXs]*.so
tar cJf ~/${SDK_NAME/-release/-${{ matrix.version }}}.tar.xz $SDK_NAME
tar cJf ~/$SDK_NAME.tar.xz $SDK_NAME
rm -rf build/ $SDK_NAME llvm-project/
- name: Upload SDK
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -183,9 +176,6 @@ jobs:
- name: Build Swift crypto package
run: |
cd swift-crypto
if [ ${{ matrix.version }} = 'release-25c' ]; then
sed -i "s%#include <time%#include <signal.h>\n#include <time%" Sources/CCryptoBoringSSL/include/CCryptoBoringSSL_asn1.h
fi
sed -i "s%\\\\(testsDirectory)/.*Vectors%/data/local/tmp/pack/crypto-vectors%" Tests/CryptoTests/Utils/RFCVector.swift Tests/CryptoTests/Utils/Wycheproof.swift Tests/_CryptoExtrasTests/Utils/Wycheproof.swift
sed -i 's%#file%"/data/local/tmp/pack/crypto-vectors"%;s%../_CryptoExtrasVectors/%%' Tests/_CryptoExtrasTests/TestRSABlindSigning.swift
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
Expand All @@ -197,12 +187,7 @@ jobs:
- name: Build Swift NIO package
run: |
cd swift-nio
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem-both-ndks.patch
if [ ${{ matrix.version }} = 'release-25c' ]; then
git apply -R ../sdk-config/swift-nio-ndk26.patch
else
git apply ../sdk-config/swift-nio-ndk27.patch
fi
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem-both-ndks.patch ../sdk-config/swift-nio-ndk27.patch
../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift package update
cd .build/checkouts/
patch -p1 < ../../../sdk-config/android-overlay/swift-system.patch
Expand Down Expand Up @@ -259,9 +244,6 @@ jobs:
- name: Build Swift NIO SSL package
run: |
cd snl
if [ ${{ matrix.version }} = 'release-25c' ]; then
sed -i "s%#include <time%#include <signal.h>\n#include <time%" Sources/CNIOBoringSSL/include/CNIOBoringSSL_asn1.h
fi
SWIFTCI_USE_LOCAL_DEPS=1 ../sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/bin/swift build --build-tests --destination ../sdk-config/swift-*-sdk/usr/swiftpm-android-${{ matrix.arch }}.json -Xlinker -rpath -Xlinker \$ORIGIN/lib/swift/android
- name: Get Yams package
uses: actions/checkout@v4
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ the Swift toolchain for AArch64, armv7, and x86_64, builds several Swift
packages against those SDKs, and then runs their tests in the Android x86_64
emulator](https://github.com/finagolfin/swift-android-sdk/blob/main/.github/workflows/sdks.yml).

The CI now builds with both the latest LTS NDK 27 and the last LTS NDK before
nullability annotations were added, 25c. Now that Swift 5.9 supports [the new experimental SDK bundle
Now that Swift 5.10 supports [the new SDK bundle
format](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md),
I plan to distribute an Android SDK bundle for NDK 27 in the coming months.

If you cannot build against NDK 27 because of the nullability annotations, you
can download a 5.10 SDK built against 25c from a recent run of
the CI, eg `sdk-release-25c-aarch64` under `Artifacts`.
I plan to distribute an Android SDK bundle in the coming months.

## Cross-compiling and testing Swift packages with the Android SDK

Expand Down
132 changes: 0 additions & 132 deletions swift-nio-ndk26.patch

This file was deleted.

0 comments on commit 54866b7

Please sign in to comment.