Skip to content

Commit

Permalink
Merge pull request #1099 from alexarchambault/scala-2.12.16
Browse files Browse the repository at this point in the history
Update Scala to 2.12.16
  • Loading branch information
alexarchambault authored Jun 14, 2022
2 parents ddd4202 + 6ed7823 commit 05de912
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scala.build.tests

import com.eed3si9n.expecty.Expecty.{assert => expect}
import coursier.cache.FileCache
import dependency.ScalaParameters

import scala.build.Ops._
Expand All @@ -23,6 +24,7 @@ import scala.build.{Build, BuildThreads, LocalRepo}
import scala.build.Directories
import scala.build.options.ScalacOpt
import scala.build.Positioned
import scala.concurrent.duration.DurationInt

class BuildOptionsTests extends munit.FunSuite {

Expand Down Expand Up @@ -258,6 +260,9 @@ class BuildOptionsTests extends munit.FunSuite {
val options = BuildOptions(
scalaOptions = ScalaOptions(
scalaVersion = prefix.map(MaybeScalaVersion(_))
),
internal = InternalOptions(
cache = Some(FileCache().withTtl(0.seconds))
)
)
val scalaParams = options.scalaParams.orThrow.getOrElse(???)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,26 @@ final case class BuildOptions(
case Right(versions) =>
versions.find(_.scalaCliVersion == scalaCliVersion)
.orElse {
val scalaCliVersion0 = Version(scalaCliVersion)
val retainedCliVersion =
if (scalaCliVersion.endsWith("-SNAPSHOT"))
if (scalaCliVersion.contains("-g"))
// version like 0.1.7-30-g51330f19d-SNAPSHOT
scalaCliVersion.takeWhile(_ != '-').split('.') match {
case Array(maj, min, patch) if patch.nonEmpty && patch.forall(_.isDigit) =>
val patch0 = patch.toInt + 1
s"$maj.$min.$patch0"
case _ =>
// shouldn't happen
scalaCliVersion
}
else
// version like 0.1.8-SNAPSHOT
scalaCliVersion.takeWhile(_ != '-')
else
scalaCliVersion
val retainedCliVersion0 = Version(retainedCliVersion)
versions
.filter(_.scalaCliVersion0.compareTo(scalaCliVersion0) <= 0)
.filter(_.scalaCliVersion0.compareTo(retainedCliVersion0) <= 0)
.maxByOption(_.scalaCliVersion0)
}
.map(_.supportedScalaVersions)
Expand Down Expand Up @@ -335,11 +352,14 @@ final case class BuildOptions(
}

lazy val scalaParams: Either[BuildException, Option[ScalaParameters]] =
computeScalaParams(Constants.version, finalCache).orElse(
// when the passed scala version is missed in the cache, we always force a cache refresh
// https://github.com/VirtusLab/scala-cli/issues/1090
if (System.getenv("CI") == null)
computeScalaParams(Constants.version, finalCache).orElse(
// when the passed scala version is missed in the cache, we always force a cache refresh
// https://github.com/VirtusLab/scala-cli/issues/1090
computeScalaParams(Constants.version, finalCache.withTtl(0.seconds))
)
else
computeScalaParams(Constants.version, finalCache.withTtl(0.seconds))
)

private[build] def computeScalaParams(
scalaCliVersion: String,
Expand Down
6 changes: 3 additions & 3 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mill._, scalalib._
import scala.util.Properties

object Scala {
def scala212 = "2.12.15"
def scala212 = "2.12.16"
def scala213 = "2.13.8"
def scala3 = "3.1.2"
val allScala2 = Seq(scala213, scala212)
Expand Down Expand Up @@ -59,12 +59,12 @@ object Deps {
def coursier = "2.1.0-M6-26-gcec901e9a"
def coursierCli = "2.1.0-M5-18-gfebf9838c"
def jsoniterScala = "2.13.26"
def scalaMeta = "4.5.8"
def scalaMeta = "4.5.9"
def scalaNative = "0.4.4"
def scalaPackager = "0.1.26"
def signingCli = "0.1.6"
}
def ammonite = ivy"com.lihaoyi:::ammonite:2.5.4"
def ammonite = ivy"com.lihaoyi:::ammonite:2.5.4-8-30448e49"
def asm = ivy"org.ow2.asm:asm:9.3"
// Force using of 2.13 - is there a better way?
def bloopConfig = ivy"io.github.alexarchambault.bleep:bloop-config_2.13:1.5.0-sc-1"
Expand Down
3 changes: 2 additions & 1 deletion website/docs/reference/scala-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ it is recommended to update scala-cli.
|---------------------|:-----------------:|------------:|-----------:|
| 0.0.9 | 3.0.2 | 2.13.7 | 2.12.7 |
| 0.1.0 - 0.1.3 | 3.1.1 | 2.13.8 | 2.12.15 |
| 0.1.4 - current | 3.1.2 | 2.13.8 | 2.12.15 |
| 0.1.4 - 0.1.7 | 3.1.2 | 2.13.8 | 2.12.15 |
| 0.1.8 - current | 3.1.2 | 2.13.8 | 2.12.16 |

0 comments on commit 05de912

Please sign in to comment.