Skip to content

Commit 1ec5b3e

Browse files
committed
Use official endpoints for discovering latest Swift release/devel/trunk tags
1 parent 8b18b5f commit 1ec5b3e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,23 @@
1212
# to provide information about the Swift tag name in use and where to
1313
# obtain the latest toolchain for building.
1414

15-
# TODO: we could instead use the latest-build.yml files for this, like:
16-
# https://download.swift.org/swift-6.2-branch/ubuntu2404/latest-build.yml
17-
# https://download.swift.org/development/ubuntu2404/latest-build.yml
18-
# but there doesn't seem to be one for the current release build.
15+
OS=$(echo $HOST_OS | tr -d '.')
1916

2017
case "${BUILD_VERSION}" in
2118
release)
22-
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/swiftlang/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"
19+
# e.g., "swift-6.1-RELEASE"
20+
SWIFT_TAG=$(curl -fsSL https://www.swift.org/api/v1/install/releases.json | jq -r '.[-1].tag')
21+
# e.g., "swift-6.1-release"
22+
SWIFT_BRANCH=$(echo "${SWIFT_TAG}" | tr '[A-Z]' '[a-z]')
2523
;;
2624
devel)
27-
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/swiftlang/swift/tags | grep -m1 swift-6.2-DEV | cut -d- -f8-10)
28-
SWIFT_TAG="swift-6.2-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION}-a"
25+
# e.g., swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-15-a
26+
SWIFT_TAG=$(curl -fsSL https://download.swift.org/swift-6.2-branch/$OS/latest-build.yml | grep '^dir: ' | cut -f 2 -d ' '
2927
SWIFT_BRANCH="swift-$(echo $SWIFT_TAG | cut -d- -f2)-branch"
3028
;;
3129
trunk)
32-
LATEST_TOOLCHAIN_VERSION=$(curl -sL https://github.com/swiftlang/swift/tags | grep -m1 swift-DEV | cut -d- -f7-9)
33-
SWIFT_TAG="swift-DEVELOPMENT-SNAPSHOT-${LATEST_TOOLCHAIN_VERSION}-a"
30+
# e.g., swift-DEVELOPMENT-SNAPSHOT-2025-05-14-a
31+
SWIFT_TAG=$(curl -fsSL https://download.swift.org/development/$OS/latest-build.yml | grep '^dir: ' | cut -f 2 -d ' ')
3432
SWIFT_BRANCH="development"
3533
;;
3634
*)
@@ -40,5 +38,5 @@ case "${BUILD_VERSION}" in
4038
esac
4139

4240
SWIFT_BASE=$SWIFT_TAG-$HOST_OS
43-
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$(echo $HOST_OS | tr -d '.')/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
41+
export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz"
4442

0 commit comments

Comments
 (0)