Skip to content

Commit f5ad6af

Browse files
committed
1 parent 5347bfd commit f5ad6af

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

swift-ci/sdks/android/build-docker

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7}
1111

1212
ANDROID_NDK_VERSION=android-ndk-r27c
1313
ANDROID_API=28
14+
HOST_OS=ubuntu24.04
15+
source ./scripts/toolchain-vars.sh
16+
17+
# Check-out and patch the sources
18+
./scripts/fetch-source.sh --source-dir ${PWD}/source --swift-tag ${SWIFT_TAG}
19+
./scripts/patch-sources.sh ${PWD}/source
20+
21+
mkdir -p products
1422

1523
if [[ "$DOCKER" == "" ]]; then
1624
DOCKER=docker
@@ -29,29 +37,15 @@ case $(arch) in
2937
;;
3038
esac
3139

32-
HOST_OS=ubuntu24.04
33-
source ./scripts/toolchain-vars.sh
40+
CONTAINER_NAME="swift-android"
3441

3542
# Build the Docker image
36-
$DOCKER build --build-arg OS_ARCH_SUFFIX=$OS_ARCH_SUFFIX --build-arg SWIFT_TOOLCHAIN_URL=$SWIFT_TOOLCHAIN_URL --build-arg ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION -t swift-android .
37-
38-
# Check-out and patch the sources
39-
./scripts/fetch-source.sh --source-dir ${PWD}/source --swift-tag ${SWIFT_TAG}
40-
./scripts/patch-sources.sh ${PWD}/source
41-
42-
mkdir -p products
43-
44-
echo "build-script-impl start ========="
45-
ls -la $(find source -name build-script-impl)
46-
cat $(find source -name build-script-impl)
47-
echo "build-script-impl end ========="
48-
grep 'VALIDATING SYMBOLIC LINK' $(find source -name build-script-impl)
49-
43+
$DOCKER build --build-arg OS_ARCH_SUFFIX=$OS_ARCH_SUFFIX --build-arg SWIFT_TOOLCHAIN_URL=$SWIFT_TOOLCHAIN_URL --build-arg ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION -t ${CONTAINER_NAME} .
5044

5145
$DOCKER run -i --rm \
5246
-v ./source:/source \
5347
-v ./products:/products \
54-
swift-android \
48+
${CONTAINER_NAME} \
5549
/scripts/build.sh \
5650
--source-dir /source \
5751
--products-dir /products \

swift-ci/sdks/android/build-local

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ fi
5555

5656
mkdir -p ${SDKROOT}/products
5757

58-
echo "build-script-impl start ========="
59-
ls -la $(find ${SDKROOT}/source -name build-script-impl)
60-
cat $(find ${SDKROOT}/source -name build-script-impl)
61-
echo "build-script-impl end ========="
62-
grep 'VALIDATING SYMBOLIC LINK' $(find ${SDKROOT}/source -name build-script-impl)
63-
6458
./scripts/build.sh \
6559
--source-dir ${SDKROOT}/source \
6660
--products-dir ${SDKROOT}/products \

swift-ci/sdks/android/scripts/patch-sources.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ fi
2121
cd ${source_dir}/swift-project
2222
swift_android_patch="${patches_dir}/swift-android.patch"
2323

24-
ls -la swift/utils/build-script-impl
25-
ls -la ${swift_android_patch}
26-
ls -la swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
27-
2824
# patch the patch, which seems to only be needed for an API less than 28
2925
# https://github.com/finagolfin/swift-android-sdk/blob/main/swift-android.patch#L110
3026
perl -pi -e 's/#if os\(Windows\)/#if os\(Android\)/g' $swift_android_patch
@@ -61,6 +57,7 @@ for patch in "$swift_android_patch" "$testing_patch" "$dispatch_patch"; do
6157
echo "applying patch $patch in $PWD"
6258
# first check to make sure the patches can apply and fail if not
6359
git apply -v --check -C1 "$patch"
60+
echo "git apply --check result: $0"
6461
git apply -v -C1 "$patch"
6562

6663
#if git apply -C1 --reverse --check "$patch" >/dev/null 2>&1 ; then
@@ -73,10 +70,16 @@ for patch in "$swift_android_patch" "$testing_patch" "$dispatch_patch"; do
7370
#fi
7471
done
7572

73+
# validate the patches
74+
ls -la swift/utils/build-script-impl
75+
grep 'VALIDATING SYMBOLIC LINK' swift/utils/build-script-impl
76+
77+
7678
perl -pi -e 's%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
7779
# disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
7880
perl -pi -e 's;os\(Android\);os\(AndroidDISABLED\);g' swift-testing/Sources/Testing/SourceAttribution/Backtrace.swift
7981

8082
# need to un-apply libandroid-spawn since we don't need it for API28+
8183
perl -pi -e 's;MATCHES "Android";MATCHES "AndroidDISABLED";g' llbuild/lib/llvm/Support/CMakeLists.txt
8284
perl -pi -e 's; STREQUAL Android\); STREQUAL AndroidDISABLED\);g' swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
85+

0 commit comments

Comments
 (0)