1- #! /bin/bash -e
1+ #! /bin/bash -ex
22# Swift Android SDK: Top-level Build Script
33
44# default architectures to build for
@@ -13,12 +13,28 @@ mkdir -p ${SDKROOT}
1313# Install a Swift host toolchain if it isn't already present
1414SWIFT_ROOT=${SDKROOT} /host-toolchain
1515HOST_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+
1935SWIFT_BASE=$SWIFT_TAG -$HOST_OS
2036
21- if [[ ! -d $SWIFT_ROOT ]]; then
37+ if [[ ! -d " $SWIFT_ROOT / $SWIFT_BASE " ]]; then
2238 mkdir -p $SWIFT_ROOT
2339 pushd $SWIFT_ROOT
2440
@@ -75,7 +91,11 @@ if [[ ! -d ${PATCHDIR} ]]; then
7591 # swift-android-ci.patch is not needed, since it is only used for llbuild, etc.
7692 # git apply -C1 $PATCHDIR/swift-android-ci.patch
7793 # 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
7999
80100 perl -pi -e ' s%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
81101 # disable backtrace() for Android (needs either API33+ or libandroid-execinfo, or to manually add in backtrace backport)
0 commit comments