Skip to content

Commit

Permalink
Add URLs for Swift 5.6.3 and 5.7 (new default) (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
vzsg authored Sep 13, 2022
1 parent f0cc16a commit 362576e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 10 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ $ heroku create --buildpack vapor/vapor

$ git push heroku master
remote: -----> Swift app detected
remote: -----> Using Swift 5.6.2 (default)
remote: -----> Using built-in clang (Swift 5.6.2)
remote: -----> Using Swift 5.7 (default)
remote: -----> Using built-in clang (Swift 5.7)
remote: -----> Installing swiftenv
remote: -----> Installing Swift 5.6.2
remote: -----> Installing Swift 5.7
...
```

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

### Specify a Swift version

The buildpack defaults to Swift 5.6.2 and will be updated when new Swift versions are released.
The buildpack defaults to Swift 5.7 and will be updated when new Swift versions are released.

If you need to use a specific version of the Swift toolchain, including older versions – for example Swift 4.2.x to retain compatibility with Swift 3 projects, you can pin that 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.
If you need to use a specific version of the Swift toolchain, including older versions – for example Swift 4.2.x to retain compatibility with Swift 3 projects, or a previous version as you run into issues with the latest – you can pin any 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.5.3' > .swift-version
$ echo '5.6.3' > .swift-version
$ git add .swift-version
$ git commit -m "Pin Swift version to 5.5.3"
$ git commit -m "Pin Swift version to 5.6.3"
$ git push heroku master
```

Or:

```shell
$ heroku config:set SWIFT_VERSION=5.5.3
$ git commit -m "Pin Swift version to 5.5.3" --allow-empty
$ heroku config:set SWIFT_VERSION=5.6.3
$ git commit -m "Pin Swift version to 5.6.3" --allow-empty
$ git push heroku master
```

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

CLANG_VERSION=7.0.1

SWIFT_VERSION="5.6.2"
SWIFT_VERSION="5.7"
SWIFT_BUILD_CONFIGURATION="release"
SWIFT_BUILD_FLAGS=""

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

'ubuntu14.04' )
echo
echo " ! Swift 5.6.3 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' )
URL="https://swift.org/builds/swift-5.6.3-release/ubuntu1604/swift-5.6.3-RELEASE/swift-5.6.3-RELEASE-ubuntu16.04.tar.gz"
;;

'ubuntu18.04' )
URL="https://swift.org/builds/swift-5.6.3-release/ubuntu1804/swift-5.6.3-RELEASE/swift-5.6.3-RELEASE-ubuntu18.04.tar.gz"
;;

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

'ubuntu22.04' )
echo
echo " ! Swift 5.6.3 does not support Ubuntu 22.04, nor any later versions of the Heroku stack."
echo " !"
echo " ! As of 2022-06-21, Swift does not yet have a release that supports Ubuntu 22.04."
echo " ! Downgrade your stack to heroku-20 using the 'heroku stack:set' command or the dashboard."
echo
exit 1
;;

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

'ubuntu14.04' )
echo
echo " ! Swift 5.7 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' )
URL="https://swift.org/builds/swift-5.7-release/ubuntu1604/swift-5.7-RELEASE/swift-5.7-RELEASE-ubuntu16.04.tar.gz"
;;

'ubuntu18.04' )
URL="https://swift.org/builds/swift-5.7-release/ubuntu1804/swift-5.7-RELEASE/swift-5.7-RELEASE-ubuntu18.04.tar.gz"
;;

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

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

* )
;;
esac

0 comments on commit 362576e

Please sign in to comment.