Skip to content
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

add Scala 3.0.0-RC1 to crossbuild #571

Merged
merged 2 commits into from Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -47,6 +47,12 @@ jobs:
- SCALA_VERSION=3.0.0-M3
- TRAVIS_JDK=8

- name: "Run tests with Scala 3 and AdoptOpenJDK 8"
script: scripts/test-code.sh
env:
- SCALA_VERSION=3.0.0-RC1
- TRAVIS_JDK=8

- stage: publish
name: "Publish artifacts to Bintray"
script: sbt +publish
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -123,7 +123,7 @@ lazy val commonSettings = Def.settings(
),
headerLicense := Some(HeaderLicense.Custom(s"Copyright (C) 2009-2021 Lightbend Inc. <https://www.lightbend.com>")),
scalaVersion := Dependencies.Scala212,
crossScalaVersions := Seq(Dependencies.Scala212, Dependencies.Scala213, Dependencies.Scala3),
crossScalaVersions := Seq(Dependencies.Scala212, Dependencies.Scala213) ++ Dependencies.Scala3,
javacOptions in Compile ++= javacSettings,
javacOptions in Test ++= javacSettings,
javacOptions in (Compile, compile) ++= Seq("-target", "1.8"), // sbt #1785, avoids passing to javadoc
Expand Down
32 changes: 24 additions & 8 deletions play-json/shared/src/test/scala/play/api/libs/json/MacroSpec.scala
Expand Up @@ -101,7 +101,8 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
implicit val simpleReads: Reads[Simple] = Reads[Simple] { js =>
(js \ "bar").validate[String].map(Simple(_))
}
import LoremCodec.loremReads
//import LoremCodec.loremReads // Doesn't work in Scala 3.0.0-RC1
implicit val loremReads: Reads[Lorem[Any]] = LoremCodec.loremReads
implicit val optionalReads: Reads[Optional] = Json.reads[Optional]
implicit val familyReads: Reads[Family] = Json.reads[Family]

Expand Down Expand Up @@ -195,7 +196,8 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
implicit val simpleWrites: OWrites[Simple] = OWrites[Simple] { simple =>
Json.obj("bar" -> simple.bar)
}
import LoremCodec.loremWrites
//import LoremCodec.loremWrites // Doesn't work in Scala 3.0.0-RC1
implicit val loremWrites: OWrites[Lorem[Any]] = LoremCodec.loremWrites
implicit val optionalWrites: OWrites[Optional] = Json.writes[Optional]
// Following won't work due to inference issue (see #117)
// with inheritance/contravariance/implicit resolution
Expand Down Expand Up @@ -236,7 +238,11 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach

"Macro" should {
"handle case class with self type as nested type parameter" when {
import TestFormats._
//import TestFormats._ // Doesn't work in Scala 3.0.0-RC1
implicit def eitherReads[A: Reads, B: Reads]: Reads[Either[A, B]] = TestFormats.eitherReads[A, B]
implicit def eitherWrites[A: Writes, B: Writes]: Writes[Either[A, B]] = TestFormats.eitherWrites[A, B]
implicit def tuple2Reads[A: Reads, B: Reads]: Reads[(A, B)] = TestFormats.tuple2Reads[A, B]
implicit def tuple2OWrites[A: Writes, B: Writes]: OWrites[(A, B)] = TestFormats.tuple2OWrites[A, B]

val jsonNoValue = Json.obj("id" -> "A")
val jsonStrValue = Json.obj("id" -> "B", "value" -> "str")
Expand Down Expand Up @@ -301,7 +307,11 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
}

"handle generic case class with multiple generic parameters and self references" when {
import TestFormats._
//import TestFormats._ // Doesn't work in Scala 3.0.0-RC1
implicit def eitherReads[A: Reads, B: Reads]: Reads[Either[A, B]] = TestFormats.eitherReads[A, B]
implicit def eitherWrites[A: Writes, B: Writes]: Writes[Either[A, B]] = TestFormats.eitherWrites[A, B]
implicit def tuple2Reads[A: Reads, B: Reads]: Reads[(A, B)] = TestFormats.tuple2Reads[A, B]
implicit def tuple2OWrites[A: Writes, B: Writes]: OWrites[(A, B)] = TestFormats.tuple2OWrites[A, B]

val nestedLeft = Json.obj("id" -> 2, "a" -> 0.2F, "b" -> 0.3F, "c" -> 3)

Expand Down Expand Up @@ -366,7 +376,9 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
implicit val simpleReads: Reads[Simple] = Reads[Simple] { js =>
(js \ "bar").validate[String].map(Simple(_))
}
import LoremCodec._
//import import LoremCodec._ // Doesn't work in Scala 3.0.0-RC1
implicit val loremReads: Reads[Lorem[Any]] = LoremCodec.loremReads
implicit val loremWrites: OWrites[Lorem[Any]] = LoremCodec.loremWrites
implicit val optionalFormat: OFormat[Optional] = Json.format[Optional]
implicit val familyFormat: OFormat[Family] = Json.format[Family]

Expand Down Expand Up @@ -396,7 +408,9 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
implicit val simpleReads: Reads[Simple] = Reads[Simple] { js =>
(js \ "bar").validate[String].map(Simple(_))
}
import LoremCodec._
//import import LoremCodec._ // Doesn't work in Scala 3.0.0-RC1
implicit val loremReads: Reads[Lorem[Any]] = LoremCodec.loremReads
implicit val loremWrites: OWrites[Lorem[Any]] = LoremCodec.loremWrites
implicit val optionalFormat: OFormat[Optional] = Json.format[Optional]
implicit val familyFormat: OFormat[Family] = Json.format[Family]

Expand Down Expand Up @@ -434,8 +448,10 @@ class MacroSpec extends AnyWordSpec with Matchers with org.scalatestplus.scalach
(js \ "bar").validate[String].map(Simple(_))
}
implicit val optionalFormat: OFormat[Optional] = Json.format[Optional]
import LoremCodec._
implicit val familyFormat: OFormat[Family] = Json.format[Family]
//import import LoremCodec._ // Doesn't work in Scala 3.0.0-RC1
implicit val loremReads: Reads[Lorem[Any]] = LoremCodec.loremReads
implicit val loremWrites: OWrites[Lorem[Any]] = LoremCodec.loremWrites
implicit val familyFormat: OFormat[Family] = Json.format[Family]

val simple = Simple("foo")
val jsSimple = simpleWrites.writes(simple) + (
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Expand Up @@ -2,5 +2,5 @@ object Dependencies {
// scalaVersion needs to be kept in sync with travis-ci
val Scala212 = "2.12.13"
val Scala213 = "2.13.4"
val Scala3 = "3.0.0-M3"
val Scala3 = Seq("3.0.0-M3", "3.0.0-RC1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why M3 as well?

Copy link
Member Author

@SethTisue SethTisue Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be convenient for downstream maintainers to publish for the last two versions, so that people can take the library version bump separately from the Scala version bump, to help narrow down the number of possible causes if something goes wrong

@dwijnand regardless, if keeping M3 makes any trouble for supporting RC1, it is totally fine with me to just drop M3

}
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.4.6
sbt.version=1.4.7
4 changes: 2 additions & 2 deletions project/plugins.sbt
Expand Up @@ -15,12 +15,12 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")

addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")

addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3")