Skip to content

Commit d9755eb

Browse files
committed
Swift Android build 6.2
1 parent 41e50a2 commit d9755eb

File tree

3 files changed

+8
-44
lines changed

3 files changed

+8
-44
lines changed

.github/workflows/pull_request.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ jobs:
5353
- name: Free Disk Space
5454
run: |
5555
df -h
56-
# brings available space from 25G to 42G
57-
#sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
56+
# brings available space from 25G to 32G
57+
# otherwise we sometimes run out of space during the build
5858
sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL
59-
df -h
6059
sudo docker image prune --all --force
6160
sudo docker builder prune -a
6261
df -h
@@ -97,32 +96,8 @@ jobs:
9796
# swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
9897
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
9998
100-
#tree ${ARTIFACT_BUILD}/
10199
# show an abridged tree
102-
tree ${ARTIFACT_BUILD} --filesfirst --prune -P 'Android.swiftmodule' -P 'libswiftAndroid.*' -P 'libFoundation.*' -P 'swiftrt.o' -P 'swift*.json' -P 'info.json' -P 'api-level.h' -P 'android.modulemap' -P 'SwiftAndroidNDK.h' -P 'bridging.modulemap'
103-
104-
# validate some required paths in the artifactbundle
105-
#pushd ${ARTIFACT_BUILD}/*/*/usr
106-
#ls lib/swift/android
107-
#ls lib/swift/android/*
108-
#ls lib/swift/android/*/swiftrt.o
109-
#ls lib/*-linux-android/*/crtbegin_dynamic.o
110-
111-
#ls lib/swift_static-*
112-
#ls lib/swift_static-*/android
113-
#ls lib/swift_static-*/android/libFoundationEssentials.a
114-
115-
#ls lib/*-linux-android/libFoundationEssentials.so
116-
#ls lib/*-linux-android/libFoundationNetworking.so
117-
#ls lib/*-linux-android/libFoundationInternationalization.so
118-
#ls lib/*-linux-android/lib_FoundationICU.so
119-
#ls lib/*-linux-android/libFoundationXML.so
120-
#ls lib/*-linux-android/libTesting.so
121-
122-
#ls lib/swift/clang/lib
123-
#ls lib/swift/clang/lib/linux
124-
#ls lib/swift/clang/lib/linux/*/libunwind.a
125-
#popd
100+
tree ${ARTIFACT_BUILD} --filesfirst --prune -P 'Android.swiftmodule' -P 'libswiftAndroid.*' -P 'libFoundation.*' -P 'swiftrt.o' -P 'swift*.json' -P 'info.json' -P 'api-level.h' -P 'android.modulemap' -P 'SwiftAndroidNDK.h' -P 'bridging.modulemap' -P 'linux' -P 'libclang*.a' -P 'libunwind.a' -P 'libclang_rt.builtins-*-android.a'
126101
- name: Upload SDK artifactbundle
127102
uses: actions/upload-artifact@v4
128103
with:

swift-ci/sdks/android/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -ex
1+
#!/bin/bash -e
22
# Swift Android SDK: Top-level Build Script
33

44
# default architectures to build for

swift-ci/sdks/android/scripts/build.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,10 @@ cp -a ${build_dir}/sdk_root ${sdk_staging}
432432

433433
if [ "${NDK_LOCATION}" = "external" ]; then
434434
swift_res_root="swift-resources"
435-
#ndk_sysroot=${ndk_installation}/sysroot
436-
#ndk_sysroot=NONE
437435
ndk_sysroot="ndk-sysroot"
438436
cp -a ${ndk_installation}/sysroot ${ndk_sysroot}
439437
else
440-
#sysroot_path="ndk-sysroot"
441-
#sysroot_path="android-27c-sysroot"
442438
merged_sysroot_path="sysroot"
443-
444439
swift_res_root=${merged_sysroot_path}
445440
ndk_sysroot=${merged_sysroot_path}
446441
cp -a ${ndk_installation}/sysroot ${ndk_sysroot}
@@ -507,16 +502,10 @@ if [ "${NDK_LOCATION}" = "external" ]; then
507502
# error: link command failed with exit code 1 (use -v to see invocation)
508503
# clang: error: no such file or directory: '${HOME}/.swiftpm/swift-sdks/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-04-24-a-android-0.1.artifactbundle/swift-android/ndk-sysroot/usr/lib/swift/android/x86_64/swiftrt.o'
509504
# see: https://github.com/swiftlang/swift-driver/pull/1822#issuecomment-2762811807
510-
if [ "${NDK_LOCATION}" = "external" ]; then
511-
for arch in $archs; do
512-
mkdir -p ${ndk_sysroot}/usr/lib/swift/android/${arch}
513-
ln -srv ${swift_res_root}/usr/lib/swift-${arch}/android/${arch}/swiftrt.o ${ndk_sysroot}/usr/lib/swift/android/${arch}/swiftrt.o
514-
done
515-
else
516-
# try brute copying swiftrt.o to EVERY directory to see if it gets picked up somehow
517-
echo "Seeking workaround for swiftrt.o needing to be under sdkRoot"
518-
#find ${swift_res_root} -type d -exec cp -av ${SWIFTRT} {} \;
519-
fi
505+
for arch in $archs; do
506+
mkdir -p ${ndk_sysroot}/usr/lib/swift/android/${arch}
507+
ln -srv ${swift_res_root}/usr/lib/swift-${arch}/android/${arch}/swiftrt.o ${ndk_sysroot}/usr/lib/swift/android/${arch}/swiftrt.o
508+
done
520509
else
521510
rm -r ${swift_res_root}/usr/{include,lib}/{i686,riscv64}-linux-android
522511
rm -r ${swift_res_root}/usr/lib/swift/clang/lib/linux/*{i[36]86,riscv64}*

0 commit comments

Comments
 (0)