Skip to content

Commit 8a8b68b

Browse files
committed
Swift Androd build
1 parent af6ff72 commit 8a8b68b

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

.github/workflows/pull_request.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,12 @@ jobs:
4646
steps:
4747
- name: Checkout repository
4848
uses: actions/checkout@v4
49+
- name: Install Dependencies
50+
run: |
51+
sudo apt install -q ninja-build patchelf
4952
- name: Build Android SDK
5053
working-directory: swift-ci/sdks/android
5154
run: |
52-
sudo apt install -q ninja-build patchelf
53-
# build all architectures
54-
#./build
55-
56-
# just build x86_64 for testing
57-
#TARGET_ARCHS=x86_64 ./build
58-
59-
# build arch specified by the matrix
6055
TARGET_ARCHS=${{ matrix.arch }} ./build
6156
- name: Get artifact info
6257
id: paths
@@ -69,7 +64,7 @@ jobs:
6964
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
7065
7166
ARTIFACT_EXT=".artifactbundle.tar.gz"
72-
ARTIFACT_NAME=$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
67+
ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
7368
# artifacts need a unique name so we suffix with the matrix arch(s)
7469
if [[ ! -z "${{ matrix.arch }}" ]]; then
7570
ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
@@ -93,13 +88,39 @@ jobs:
9388
run: |
9489
# need to free up some space or else when installing we get: No space left on device
9590
rm -rf ${{ runner.temp }}/swift-android-sdk/{build,src}
96-
- name: Install SDK
91+
- name: Install artifactbundle
92+
shell: bash
9793
run: |
94+
set -ex
9895
${{ steps.paths.outputs.swift-path }} sdk install ${{ steps.paths.outputs.artifact-path }}
9996
${{ steps.paths.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.paths.outputs.swift-path }} sdk list | head -n 1) x86_64-unknown-linux-android28
10097
# recent releases require that ANDROID_NDK_ROOT *not* be set
10198
# see https://github.com/finagolfin/swift-android-sdk/issues/207
10299
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV
100+
101+
# validate some required paths in the artifactbundle
102+
cd ${HOME}/.config/swiftpm/swift-sdks/*.artifactbundle/*/*/usr
103+
pwd
104+
105+
ls lib/swift/android
106+
ls lib/swift/android/*
107+
ls lib/swift/android/*/swiftrt.o
108+
ls lib/*-linux-android/*/crtbegin_dynamic.o
109+
110+
ls lib/swift_static-*
111+
ls lib/swift_static-*/android
112+
ls lib/swift_static-*/android/libFoundationEssentials.a
113+
114+
ls lib/*-linux-android/libFoundationEssentials.so
115+
ls lib/*-linux-android/libFoundationNetworking.so
116+
ls lib/*-linux-android/libFoundationInternationalization.so
117+
ls lib/*-linux-android/lib_FoundationICU.so
118+
ls lib/*-linux-android/libFoundationXML.so
119+
ls lib/*-linux-android/libTesting.so
120+
121+
ls lib/swift/clang/lib
122+
ls lib/swift/clang/lib/linux
123+
ls lib/swift/clang/lib/linux/*/libunwind.a
103124
- name: Build Demo Project
104125
run: |
105126
cd ${{ runner.temp }}
@@ -114,6 +135,12 @@ jobs:
114135
echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
115136
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
116137
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android28
138+
- name: Test Demo Project on Android
139+
uses: skiptools/swift-android-action@main
140+
with:
141+
package-path: ${{ runner.temp }}/DemoProject
142+
installed-sdk: x86_64-unknown-linux-android28
143+
installed-swift: ${{ steps.paths.outputs.swift-root }}
117144
- name: Build swift-algorithms
118145
run: |
119146
cd ${{ runner.temp }}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,13 @@ quiet_pushd ${sysroot_path}/usr
487487
ls lib/swift_static-*/android
488488
ls lib/swift_static-*/android/libFoundationEssentials.a
489489

490+
ls lib/*-linux-android/libFoundationEssentials.so
491+
ls lib/*-linux-android/libFoundationNetworking.so
492+
ls lib/*-linux-android/libFoundationInternationalization.so
493+
ls lib/*-linux-android/lib_FoundationICU.so
494+
ls lib/*-linux-android/libFoundationXML.so
495+
ls lib/*-linux-android/libTesting.so
496+
490497
ls lib/swift/clang/lib
491498
ls lib/swift/clang/lib/linux
492499
ls lib/swift/clang/lib/linux/*
@@ -545,10 +552,9 @@ if [[ -z "$SWIFT_ANDROID_ARCHIVEONLY" ]]; then
545552

546553
quiet_pushd "${build_dir}"
547554
mkdir -p "${products_dir}"
548-
tar cvzf "${products_dir}/${bundle}.tar.gz" "${bundle}"
555+
tar czf "${products_dir}/${bundle}.tar.gz" "${bundle}"
549556
quiet_popd
550557
fi
551558

552559
groupend
553560

554-

0 commit comments

Comments
 (0)