Skip to content

Commit 0d2a8d5

Browse files
committed
Android SDK build
1 parent 641cb60 commit 0d2a8d5

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

.github/workflows/pull_request.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@ jobs:
3535
run: ./build
3636

3737
android-build:
38-
name: Build Android ${{ matrix.arch }}
38+
#name: Build Android ${{ matrix.arch }}
39+
#strategy:
40+
#fail-fast: false
41+
#matrix:
42+
#arch: [armv7,aarch64,x86_64]
43+
name: Build Android SDK
3944
runs-on: ubuntu-24.04
40-
timeout-minutes: 120
41-
strategy:
42-
fail-fast: false
43-
matrix:
44-
arch: [armv7,aarch64,x86_64,x86]
4545
steps:
4646
- name: Checkout repository
4747
uses: actions/checkout@v4
4848
- name: Build Android SDK
4949
working-directory: swift-ci/sdks/android
5050
run: |
5151
sudo apt install ninja-build
52-
TARGET_ARCHS=${{ matrix.arch }} ./build
52+
#TARGET_ARCHS=${{ matrix.arch }} ./build
53+
./build
5354

swift-ci/sdks/android/build

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
#!/bin/bash -ex
22
# Swift Android SDK: Top-level Build Script
33

4-
# the architecture(s) to build; on GH Actions we build everything
5-
if [[ -z "${CI}" ]]; then
6-
TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64}
7-
#TARGET_ARCHS=${TARGET_ARCHS:-aarch64}
8-
else
9-
TARGET_ARCHS=${TARGET_ARCHS:-armv7,aarch64,x86_64,x86}
10-
#TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64}
11-
#TARGET_ARCHS=${TARGET_ARCHS:-aarch64}
12-
fi
4+
# default architectures to build for
5+
TARGET_ARCHS=${TARGET_ARCHS:-armv7,aarch64,x86_64}
136

147
ANDROID_NDK_VERSION=android-ndk-r27c
158
ANDROID_API=28

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ declare_package zlib "zlib" "Zlib" "https://zlib.net"
100100
# Parse command line arguments
101101
android_sdk_version=0.1
102102
sdk_name=
103-
archs=aarch64,armv7,x86_64,x86
103+
archs=aarch64,armv7,x86_64
104104
android_api=28
105105
build_type=Release
106106
parallel_jobs=$(($(nproc --all) + 2))
@@ -196,12 +196,16 @@ function quiet_popd {
196196
header "Swift Android SDK build script"
197197

198198
swift_dir=$(realpath $(dirname "$swiftc")/..)
199+
HOST=linux-x86_64
200+
#HOST=$(uname -s -m | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
201+
ndk_toolchain=$ndk_home/toolchains/llvm/prebuilt/$HOST
202+
199203

200204
echo "Swift found at ${swift_dir}"
201205
echo "Host toolchain found at ${host_toolchain}"
202206
${host_toolchain}/bin/swift --version
203207
echo "Android NDK found at ${ndk_home}"
204-
${toolchain}/bin/clang --version
208+
${ndk_toolchain}/bin/clang --version
205209
echo "Building for ${archs}"
206210
echo "Sources are in ${source_dir}"
207211
echo "Build will happen in ${build_dir}"
@@ -219,17 +223,12 @@ function run() {
219223
"$@"
220224
}
221225

222-
HOST=linux-x86_64
223-
#HOST=$(uname -s -m | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
224-
225-
ndktoolchain=$ndk_home/toolchains/llvm/prebuilt/$HOST
226-
227226
for arch in $archs; do
228227
case $arch in
229228
armv7) target_host="arm-linux-androideabi"; compiler_target_host="armv7a-linux-androideabi$android_api"; android_abi="armeabi-v7a" ;;
230229
aarch64) target_host="aarch64-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="arm64-v8a" ;;
231-
x86) target_host="x86-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="x86" ;;
232230
x86_64) target_host="x86_64-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="x86_64" ;;
231+
x86) target_host="x86-linux-android"; compiler_target_host="$target_host$android_api"; android_abi="x86" ;;
233232
*) echo "Unknown architecture '$1'"; usage; exit 0 ;;
234233
esac
235234

@@ -335,6 +334,9 @@ for arch in $archs; do
335334
RelWithDebInfo) build_type_flag="--release-debuginfo" ;;
336335
esac
337336

337+
# use an out-of-tree build folder, otherwise subsequent arch builds have conflicts
338+
export SWIFT_BUILD_ROOT=${build_dir}/$arch/swift-project
339+
338340
./swift/utils/build-script \
339341
$build_type_flag \
340342
--reconfigure \

0 commit comments

Comments
 (0)