Skip to content

Commit

Permalink
Add support for Swift 6.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vzsg committed Oct 28, 2024
1 parent d73a906 commit 236f3a7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ $ heroku create --buildpack vapor/vapor

$ git push heroku main
remote: -----> Swift app detected
remote: -----> Using Swift 6.0.1 (default)
remote: -----> Using Swift 6.0.2 (default)
remote: -----> Installing swiftenv
remote: -----> Installing Swift 6.0.1
remote: -----> Installing Swift 6.0.2
...
```

Expand Down Expand Up @@ -49,22 +49,22 @@ web: Run --env=production --port=$PORT

### Specify a Swift version

The buildpack defaults to Swift 6.0.1, but is compatible with Swift 5.9.1 - 5.10.1 and 6.0.
The buildpack defaults to Swift 6.0.2, but is compatible with Swift 5.9.1 - 6.0.1.

If you need to use a specific older version of the Swift toolchain from this range, you can pin the version number using a file called `.swift-version` in the root of the project folder, or by setting a `SWIFT_VERSION` configuration variable on Heroku, then deploying again.

```shell
$ echo '5.9.2' > .swift-version
$ echo '5.10.1' > .swift-version
$ git add .swift-version
$ git commit -m "Pin Swift version to 5.9.2"
$ git commit -m "Pin Swift version to 5.10.1"
$ git push heroku main
```

Or:

```shell
$ heroku config:set SWIFT_VERSION=5.9.2
$ git commit -m "Pin Swift version to 5.9.2" --allow-empty
$ heroku config:set SWIFT_VERSION=5.10.1
$ git commit -m "Pin Swift version to 5.10.1" --allow-empty
$ git push heroku main
```

Expand Down
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BUILD_DIR=$1
CACHE_DIR=$2
ENV_DIR=$3

SWIFT_VERSION="6.0.1"
SWIFT_VERSION="6.0.2"
SWIFT_BUILD_CONFIGURATION="release"
SWIFT_BUILD_FLAGS=""

Expand Down
47 changes: 47 additions & 0 deletions swiftenv/share/swiftenv-install/6.0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
case "$PLATFORM" in
'osx' )
URL="https://swift.org/builds/swift-6.0.2-release/xcode/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-osx.pkg"
;;

'ubuntu14.04' )
echo
echo " ! Swift 6.0 does not support Ubuntu 14.04."
echo " ! Please upgrade your stack using the 'heroku stack:set' command or via the dashboard."
echo " ! If that is not an option, pin an older version of Swift."
echo
exit 1
;;

'ubuntu16.04' )
echo
echo " ! Swift 6.0 does not support Ubuntu 16.04."
echo " ! Please upgrade your stack using the 'heroku stack:set' command or via the dashboard."
echo " ! If that is not an option, pin an older version of Swift."
echo
exit 1
;;

'ubuntu18.04' )
echo
echo " ! Swift 6.0 does not support Ubuntu 18.04."
echo " ! Please upgrade your stack using the 'heroku stack:set' command or via the dashboard."
echo " ! If that is not an option, pin an older version of Swift."
echo
exit 1
;;

'ubuntu20.04' )
URL="https://swift.org/builds/swift-6.0.2-release/ubuntu2004/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu20.04.tar.gz"
;;

'ubuntu22.04' )
URL="https://swift.org/builds/swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu22.04.tar.gz"
;;

'ubuntu24.04' )
URL="https://swift.org/builds/swift-6.0.2-release/ubuntu2404/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu24.04.tar.gz"
;;

* )
;;
esac

0 comments on commit 236f3a7

Please sign in to comment.