-
Notifications
You must be signed in to change notification settings - Fork 1k
Update the nightlies doc #3213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the nightlies doc #3213
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,80 +8,89 @@ We regularly publish nightly versions of both Scala 3 and 2 so that users can pr | |
|
||
Here's how to find and use these versions. | ||
|
||
## Scala 3 | ||
## General information on nightlies | ||
|
||
Scala 3 nightly versions are published to Maven Central. If you know the full version number of the nightly you want to use, you can use it just like any other Scala 3 version. | ||
### Scala 3 | ||
|
||
One quick way to get that version number is to visit [https://dotty.epfl.ch](https://dotty.epfl.ch) and look in the upper left corner. | ||
Scala 3 nightly versions are published to [https://repo.scala-lang.org](https://repo.scala-lang.org). Historically, they used to be published to Maven Central. Old nightly versions of Scala 3 (all the way until `3.8.0-RC1-bin-20250822-658c8bd-NIGHTLY` in August 2025) are still available there, as well as via [https://repo.scala-lang.org](https://repo.scala-lang.org). | ||
|
||
Another way is to scrape Maven Central, as shown in this script: [https://raw.githubusercontent.com/VirtusLab/community-build3/master/scripts/lastVersionNightly.sc](https://raw.githubusercontent.com/VirtusLab/community-build3/master/scripts/lastVersionNightly.sc) | ||
If you know the full version number of the nightly you want to use, you can use it just like any other Scala 3 version. | ||
|
||
A third way is to use [scala-cli](https://scala-cli.virtuslab.org), as follows. (Since Scala 3.5.0, the `scala` command runs `scala-cli`.) | ||
There are a number of ways to get that version number, as listed below. | ||
|
||
### scala-cli | ||
### Scala 2 | ||
|
||
You can run nightlies with commands such as: | ||
|
||
scala-cli -S 3.nightly | ||
scala-cli -S 3.3.nightly | ||
|
||
The default command is `repl`, but all the other scala-cli subcommands such as `compile` and `run` work, too. It also works with `//>` directives in your script itself, for example: | ||
We informally refer to Scala 2 “nightly” versions, but technically it's a misnomer. A so-called “nightly” is built for every merged PR in the Scala 2 repo. | ||
|
||
//> using scala 3.nightly | ||
|
||
See this [scala-cli doc page](https://scala-cli.virtuslab.org/docs/commands/compile#scala-nightlies) for details. | ||
Similarly to Scala 3 nightlies, they are available at [https://repo.scala-lang.org/artifactory/maven-nightlies](https://repo.scala-lang.org/artifactory/maven-nightlies). | ||
|
||
## Scala 2.13 or 2.12 | ||
## How to use nightly versions | ||
|
||
We informally refer to Scala 2 “nightly” versions, but technically it's a misnomer. A so-called “nightly” is built for every merged PR. | ||
### Scala CLI | ||
|
||
Scala 2 nightly versions are published to a special resolver. Unless you are using scala-cli, you'll need to add that resolver to your build configuration in order to use these versions. | ||
Scala CLI is the official runner of the language and has nightlies available without any extra configuration. From Scala 3.5.0 and on it's available under the `scala` command in Scala 3 installations. It can also be installed separately as `scala-cli`. | ||
|
||
### quick version (sbt) | ||
Note: The nightly repository is supported since Scala CLI v1.9.0 onwards (or `scala` installed with Scala 3.7.3 or newer). | ||
|
||
Global / resolvers += "scala-integration" at | ||
"https://scala-ci.typesafe.com/artifactory/scala-integration/" | ||
scalaVersion := "2.13.15-bin-abcd123" | ||
You can run nightlies with commands such as: | ||
|
||
For a 2.12 nightly, substitute e.g. `2.12.20` for `2.13.15`; in either case, it's the version number of the _next_ release on that branch. | ||
scala -e 'println("Hello") -S 3.nightly | ||
scala -e 'println("Hello") -S 3.3.nightly | ||
scala -e 'println("Hello") -S 2.13.nightly | ||
scala -e 'println("Hello") -S 2.nightly # same as 2.13.nightly | ||
scala -e 'println("Hello") -S 2.12.nightly | ||
|
||
For `abcd123`, substitute the first 7 characters of the SHA of the latest commit to the [2.13.x branch](https://github.com/scala/scala/commits/2.13.x) or [2.12.x branch](https://github.com/scala/scala/commits/2.12.x) that has a green checkmark. (Clicking the checkmark will show a CI job name with the whole version in its name.) | ||
The default command is `repl` (unless sources are passed, in which case it switches to `run`), but all the other scala-cli subcommands such as `compile` and `run` work, too. It also works with `//> using` directives in your script itself, for example: | ||
|
||
A quick way to find out the full version number of a current nightly is to use [scala-cli](https://scala-cli.virtuslab.org), as follows. | ||
//> using scala 3.nightly | ||
Gedochao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//> using scala 3.3.nightly | ||
//> using scala 2.nightly | ||
//> using scala 2.13.nightly | ||
//> using scala 2.12.nightly | ||
|
||
### quick version (scala-cli) | ||
See this [scala-cli doc page](https://scala-cli.virtuslab.org/docs/commands/compile#scala-nightlies) for details. | ||
|
||
You can run nightlies with: | ||
### Get it from the nightly website | ||
|
||
scala-cli -S 2.13.nightly | ||
scala-cli -S 2.nightly # same as 2.13.nightly | ||
scala-cli -S 2.12.nightly | ||
A quick way to get that version number is to visit [https://nightly.scala-lang.org](https://nightly.scala-lang.org) and look in the upper left corner. | ||
|
||
The default command is `repl`, but all the other scala-cli subcommands such as `compile` and `run` work, too. It also works with `//>` directives in your script itself, for example: | ||
### Check the repository, directly | ||
|
||
//> using scala 2.nightly | ||
Another way is to scrape the repository, as shown in this script: [https://raw.githubusercontent.com/VirtusLab/community-build3/master/scripts/lastVersionNightly.sc](https://raw.githubusercontent.com/VirtusLab/community-build3/master/scripts/lastVersionNightly.sc) | ||
|
||
### Longer explanation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
### SBT | ||
Gedochao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
We no longer publish `-SNAPSHOT` versions of Scala 2. | ||
To use recent nightlies with SBT, adding the appropriate resolver to the build configuration is necessary. | ||
|
||
But the team does publish nightly versions, each with its own fixed version number. The version number of a nightly looks like e.g. `2.13.1-bin-abcd123`. (`-bin-` signals binary compatibility to sbt; all 2.13.x releases since 2.13.0 are binary compatible with each other.) | ||
ThisBuild / scalaVersion := "3.8.0-RC1-bin-20250916-eb1bb73-NIGHTLY" | ||
ThisBuild / resolvers += Resolver.scalaNightlyRepository | ||
lazy val root = (project in file(".")) | ||
.settings(name := "sbt-with-scala-nightlies") | ||
|
||
To tell sbt to use one of these nightlies, you need to do three things. | ||
Also note that SBT 1.11.5 or newer is necessary. | ||
Gedochao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
First, add the resolver where the nightlies are kept: | ||
### Mill | ||
|
||
Global / resolvers += "scala-integration" at | ||
"https://scala-ci.typesafe.com/artifactory/scala-integration/" | ||
To use recent nightlies with Mill, a custom resolver for the initial bootstrap of the build is needed. | ||
Here's an example `build.mill` file: | ||
|
||
Second, specify the Scala version: | ||
package build | ||
import mill.* | ||
import mill.api.* | ||
import scalalib.* | ||
|
||
scalaVersion := "2.13.1-bin-abcd123" | ||
def scalaNightlyRepo = "https://repo.scala-lang.org/artifactory/maven-nightlies" | ||
|
||
But that isn't a real version number. Manually substitute a version number containing the 7-character SHA of the last commit in the [scala/scala repository](https://github.com/scala/scala) for which a nightly version was published. Look at [https://travis-ci.org/scala/scala/branches](https://travis-ci.org/scala/scala/branches) and you'll see the SHA in the upper right corner of the 2.13.x (or 2.12.x) section. | ||
object project extends ScalaModule { | ||
def jvmWorker = ModuleRef(CustomJvmWorkerModule) | ||
override def scalaVersion = "3.8.0-RC1-bin-20250916-eb1bb73-NIGHTLY" | ||
override def repositories = Task { super.repositories() ++ Seq(scalaNightlyRepo)} | ||
} | ||
|
||
As soon as 2.13.1 is released, the version number in the nightly will bump to 2.13.2, and so on. | ||
object CustomJvmWorkerModule extends JvmWorkerModule, CoursierModule { | ||
override def repositories = Task { super.repositories() ++ Seq(scalaNightlyRepo)} | ||
} | ||
|
||
If you have a multiproject build, be sure you set these settings across all projects when you modify your build definition. Or, you may set them temporarily in the sbt shell with `++2.13.1-bin-abcd123` (sbt 0.13.x) or `++2.13.1-bin-abcd123!` (sbt 1.x; the added exclamation point is necessary to force a version not included in `crossScalaVersions` to be used). | ||
Note how the custom `JvmWorkerModule` is necessary with the added repository. It is not enough to just define it as a repository for the module dependencies. | ||
|
||
Ideally, we would suggest an automated way to ask Travis-CI for the right SHA. This is presumably possible via Travis-CI's API, but as far as we know, nobody has looked into it yet. (Is there a volunteer?) | ||
Also note that Mill 1.0.5 or newer is necessary for this. |
Uh oh!
There was an error while loading. Please reload this page.