Skip to content

Commit 52108a8

Browse files
authored
Update toolchain-vars.sh to only download the latest release compiler if building the Swift compiler from source
1 parent 1161e56 commit 52108a8

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

swift-ci/sdks/android/scripts/toolchain-vars.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
# obtain the latest toolchain for building.
1414

1515
OS=$(echo $HOST_OS | tr -d '.')
16+
# e.g., "swift-6.1-RELEASE"
17+
# there is no latest-build.yml for releases, so we need to get it from the API
18+
export RELEASE_TAG=$(curl -fsSL https://www.swift.org/api/v1/install/releases.json | jq -r '.[-1].tag')
19+
# e.g., "swift-6.1-release"
20+
export RELEASE_BRANCH=$(echo "${SWIFT_TAG}" | tr '[A-Z]' '[a-z]')
1621

1722
case "${BUILD_SCHEME}" in
1823
release)
19-
# e.g., "swift-6.1-RELEASE"
20-
# there is no latest-build.yml for releases, so we need to get it from the API
21-
export SWIFT_TAG=$(curl -fsSL https://www.swift.org/api/v1/install/releases.json | jq -r '.[-1].tag')
22-
# e.g., "swift-6.1-release"
23-
export SWIFT_BRANCH=$(echo "${SWIFT_TAG}" | tr '[A-Z]' '[a-z]')
24+
export SWIFT_TAG=$RELEASE_TAG
25+
export SWIFT_BRANCH=$RELEASE_BRANCH
2426
;;
2527
development|swift-*-branch)
2628
# e.g., swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-15-a
@@ -35,8 +37,11 @@ case "${BUILD_SCHEME}" in
3537
esac
3638

3739
SWIFT_BASE=$SWIFT_TAG-$HOST_OS
38-
if [[ "${BUILD_SCHEME}" == "development" ]]; then
39-
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a-$HOST_OS.tar.gz"
40-
else
41-
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
42-
fi
40+
case $BUILD_COMPILER in
41+
1|true|yes|YES)
42+
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS.tar.gz"
43+
;;
44+
*)
45+
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
46+
;;
47+
esac

0 commit comments

Comments
 (0)