Skip to content

Commit

Permalink
Go back to using the pre-installed NDK 27 from the CI runner instead
Browse files Browse the repository at this point in the history
  • Loading branch information
finagolfin committed Nov 18, 2024
1 parent e494ee5 commit dfa434b
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions .github/workflows/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ jobs:
path: ~/${{ steps.version.outputs.tag }}-${{ startsWith(matrix.os, 'macos') && 'osx.pkg' || 'ubuntu22.04.tar.gz' }}
key: swift-${{ matrix.os }}-${{ steps.version.outputs.tag }}-toolchain
fail-on-cache-miss: true
- name: Get cached Android NDK
uses: actions/cache/restore@v4
if: ${{ (steps.cache-bundle.outputs.cache-hit != 'true') && startsWith(matrix.os, 'ubuntu') }}
with:
path: ~/android-ndk-r${{ env.NDK_VERSION }}-linux.zip
key: android-ndk-${{ env.NDK_VERSION }}-full
- name: Setup Swift Toolchain
env:
SWIFT_TAG: ${{ steps.version.outputs.tag }}
Expand All @@ -189,9 +183,6 @@ jobs:
elif ${{ startsWith(matrix.os, 'ubuntu') }}; then
tar xf ~/$SWIFT_TAG-ubuntu22.04.tar.gz
TOOLCHAIN=${PWD}/$SWIFT_TAG-ubuntu22.04/usr
if ${{ steps.cache-bundle.outputs.cache-hit != 'true' }}; then
unzip -q ~/android-ndk-r$NDK_VERSION-linux.zip
fi
fi
echo "TOOLCHAIN=${TOOLCHAIN}" >> $GITHUB_ENV
Expand Down Expand Up @@ -220,7 +211,6 @@ jobs:
git apply swift-android.patch swift-android-foundation.patch swift-android-ci.patch swift-crypto.patch swift-system.patch
if [ ${{ matrix.version }} = 'trunk' ]; then
unset ANDROID_NDK_ROOT
git apply swift-android-ci-trunk.patch swift-android-foundation-trunk.patch
else
git apply swift-android-ci-except-trunk.patch swift-android-foundation-except-trunk.patch
Expand All @@ -232,13 +222,13 @@ jobs:
fi
fi
perl -pi -e 's%r26%r27%' swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
perl -pi -e 's%r26%ndk/27%' swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
perl -pi -e "s%/data/data/com.termux/files%$SDK%g" $SDK/usr/lib/pkgconfig/sqlite3.pc
perl -pi -e 's%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android --android-ndk android-ndk-r$NDK_VERSION --android-arch ${{ matrix.arch }} --android-api-level $ANDROID_API_LEVEL --build-swift-tools=0 --native-swift-tools-path=${TOOLCHAIN}/bin --native-clang-tools-path=${TOOLCHAIN}/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='compiler;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_LATEST_HOME --android-arch ${{ matrix.arch }} --android-api-level $ANDROID_API_LEVEL --build-swift-tools=0 --native-swift-tools-path=${TOOLCHAIN}/bin --native-clang-tools-path=${TOOLCHAIN}/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='compiler;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 android-ndk-r$NDK_VERSION/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_LATEST_HOME/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/lib[dFXs]*.so
# Remove executables and unused toolchain headers/libraries
Expand Down Expand Up @@ -282,7 +272,7 @@ jobs:
ARCH_JSON="$PWD/android-${{ matrix.arch }}.json"
NDK_PREBUILT=android-ndk-r$NDK_VERSION/toolchains/llvm/prebuilt/${{ startsWith(matrix.os, 'macos') && 'darwin' || 'linux' }}-x86_64
NDK_PREBUILT=${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/${{ startsWith(matrix.os, 'macos') && 'darwin' || 'linux' }}-x86_64
if ${{ startsWith(matrix.os, 'macos') }}; then
cp -r ${NDK_PREBUILT}/lib/clang/*/lib/linux ${SDK_PATH}/usr/lib/swift/clang/lib
else
Expand Down Expand Up @@ -515,7 +505,7 @@ jobs:
fi
# need to free up some space or else the emulator fails to launch:
# ERROR | Not enough space to create userdata partition. Available: 6086.191406 MB at /home/runner/.android/avd/../avd/test.avd, need 7372.800000 MB.
rm -rf sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/{bin,lib/*swift*} */.build sdk-config/android-ndk-r$NDK_VERSION ~/android-ndk-r$NDK_VERSION-linux.zip
rm -rf sdk-config/${{ steps.version.outputs.tag }}-ubuntu22.04/usr/{bin,lib/*swift*} */.build
chmod +x ~/test-toolchain.sh
Expand Down

0 comments on commit dfa434b

Please sign in to comment.