Skip to content

Commit 53d9924

Browse files
committed
Swift Androd build
1 parent 3bf4a6a commit 53d9924

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

.github/workflows/pull_request.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
arch: ['x86_64', '']
43-
#name: Build Android SDK
42+
# build only x86_64 to speed up the validation
43+
arch: ['x86_64']
44+
#arch: ['x86_64', '']
4445
runs-on: ubuntu-24.04
4546
steps:
4647
- name: Checkout repository

swift-ci/sdks/android/build

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,33 @@ fi
5959
PATCHDIR=${SDKROOT}/patches
6060
if [[ ! -d ${PATCHDIR} ]]; then
6161
git clone https://github.com/finagolfin/swift-android-sdk.git ${PATCHDIR}
62-
fi
6362

64-
# Apply patches
65-
# TODO: need to selectively apply patches based on release or not release
66-
pushd ${SDKROOT}/src/swift-project
67-
echo "Applying patches"
63+
# TODO: need to selectively apply patches based on release or not release
64+
pushd ${SDKROOT}/src/swift-project
65+
echo "Applying patches"
6866

69-
# patch the patch, which seems to only be needed for an API less than 28
70-
# https://github.com/finagolfin/swift-android-sdk/blob/main/swift-android.patch#L110
71-
perl -pi -e 's/#if os\(Windows\)/#if os\(Android\)/g' $PATCHDIR/swift-android.patch
67+
# patch the patch, which seems to only be needed for an API less than 28
68+
# https://github.com/finagolfin/swift-android-sdk/blob/main/swift-android.patch#L110
69+
perl -pi -e 's/#if os\(Windows\)/#if os\(Android\)/g' $PATCHDIR/swift-android.patch
7270

73-
# remove the need to link in android-execinfo
74-
perl -pi -e 's/dispatch android-execinfo/dispatch/g' $PATCHDIR/swift-android.patch
71+
# remove the need to link in android-execinfo
72+
perl -pi -e 's/dispatch android-execinfo/dispatch/g' $PATCHDIR/swift-android.patch
7573

76-
git apply -v $PATCHDIR/swift-android.patch
77-
# swift-android-ci.patch is not needed, since it is only used for llbuild, etc.
78-
#git apply -C1 $PATCHDIR/swift-android-ci.patch
79-
git apply -v $PATCHDIR/swift-android-ci-release.patch
80-
git apply -v $PATCHDIR/swift-android-testing-release.patch
74+
git apply -v $PATCHDIR/swift-android.patch
75+
# swift-android-ci.patch is not needed, since it is only used for llbuild, etc.
76+
#git apply -C1 $PATCHDIR/swift-android-ci.patch
77+
git apply -v $PATCHDIR/swift-android-ci-release.patch
78+
git apply -v $PATCHDIR/swift-android-testing-release.patch
8179

82-
perl -pi -e 's%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
83-
# disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
84-
perl -pi -e 's/os\(Android\)/os\(AndroidDISABLED\)/g' swift-testing/Sources/Testing/SourceAttribution/Backtrace.swift
80+
perl -pi -e 's%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
81+
# disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
82+
perl -pi -e 's/os\(Android\)/os\(AndroidDISABLED\)/g' swift-testing/Sources/Testing/SourceAttribution/Backtrace.swift
8583

86-
# need to un-apply libandroid-spawn since we don't need it for API28+
87-
perl -pi -e 's/MATCHES "Android"/MATCHES "AndroidDISABLED"/g' llbuild/lib/llvm/Support/CMakeLists.txt
88-
perl -pi -e 's/ STREQUAL Android\)/ STREQUAL AndroidDISABLED\)/g' swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
89-
popd
84+
# need to un-apply libandroid-spawn since we don't need it for API28+
85+
perl -pi -e 's/MATCHES "Android"/MATCHES "AndroidDISABLED"/g' llbuild/lib/llvm/Support/CMakeLists.txt
86+
perl -pi -e 's/ STREQUAL Android\)/ STREQUAL AndroidDISABLED\)/g' swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
87+
popd
88+
fi
9089

9190
./scripts/build.sh --products-dir ${SDKROOT}/products --source-dir ${SDKROOT}/src --build-dir ${SDKROOT}/build --ndk-home ${ANDROID_NDK_HOME} --android-api ${ANDROID_API} --host-toolchain ${HOST_TOOLCHAIN} --archs ${TARGET_ARCHS}
9291

0 commit comments

Comments
 (0)