1
- #! /bin/bash -e
1
+ #! /bin/bash -ex
2
2
# Swift Android SDK: Top-level Build Script
3
3
4
4
# default architectures to build for
@@ -13,12 +13,28 @@ mkdir -p ${SDKROOT}
13
13
# Install a Swift host toolchain if it isn't already present
14
14
SWIFT_ROOT=${SDKROOT} /host-toolchain
15
15
HOST_OS=ubuntu$( lsb_release -sr)
16
- SWIFT_VERSION=6.1
17
- SWIFT_TAG=" swift-${SWIFT_VERSION} -RELEASE"
18
- SWIFT_BRANCH=" swift-$( echo $SWIFT_TAG | cut -d- -f2) -release"
16
+
17
+ # BUILD_VERSION='release'
18
+ # BUILD_VERSION='trunk'
19
+ BUILD_VERSION=${BUILD_VERSION:- ' devel' }
20
+
21
+ if [ " ${BUILD_VERSION} " = ' release' ]; then
22
+ LATEST_TOOLCHAIN_VERSION=$( curl -sL https://github.com/apple/swift/releases | grep -m1 swift-6.1 | cut -d- -f2)
23
+ SWIFT_TAG=" swift-${LATEST_TOOLCHAIN_VERSION} -RELEASE"
24
+ SWIFT_BRANCH=" swift-$( echo $SWIFT_TAG | cut -d- -f2) -release"
25
+ elif [ " ${BUILD_VERSION} " = ' devel' ]; then
26
+ LATEST_TOOLCHAIN_VERSION=$( curl -sL https://github.com/apple/swift/tags | grep -m1 swift-6.2-DEV | cut -d- -f8-10)
27
+ SWIFT_TAG=" swift-6.2-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION} -a"
28
+ SWIFT_BRANCH=" swift-$( echo $SWIFT_TAG | cut -d- -f2) -branch"
29
+ else
30
+ LATEST_TOOLCHAIN_VERSION=$( curl -sL https://github.com/apple/swift/tags | grep -m1 swift-DEV | cut -d- -f7-9)
31
+ SWIFT_TAG=" swift-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION} -a"
32
+ SWIFT_BRANCH=" development"
33
+ fi
34
+
19
35
SWIFT_BASE=$SWIFT_TAG -$HOST_OS
20
36
21
- if [[ ! -d $SWIFT_ROOT ]]; then
37
+ if [[ ! -d " $SWIFT_ROOT / $SWIFT_BASE " ]]; then
22
38
mkdir -p $SWIFT_ROOT
23
39
pushd $SWIFT_ROOT
24
40
@@ -75,7 +91,11 @@ if [[ ! -d ${PATCHDIR} ]]; then
75
91
# swift-android-ci.patch is not needed, since it is only used for llbuild, etc.
76
92
# git apply -C1 $PATCHDIR/swift-android-ci.patch
77
93
# git apply -v $PATCHDIR/swift-android-ci-release.patch
78
- git apply -v $PATCHDIR /swift-android-testing-release.patch
94
+ if [ " ${BUILD_VERSION} " = ' release' ]; then
95
+ git apply -v $PATCHDIR /swift-android-testing-release.patch
96
+ else
97
+ git apply -v $PATCHDIR /swift-android-testing-except-release.patch
98
+ fi
79
99
80
100
perl -pi -e ' s%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
81
101
# disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
0 commit comments