diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 70092fe3..30ad55fa 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -38,7 +38,7 @@ jobs: uses: playframework/.github/.github/workflows/cmd.yml@v3 with: java: 17, 11 - scala: 2.13.x + scala: 2.13.x, 3.x cmd: sbt ++$MATRIX_SCALA test finish: diff --git a/.gitignore b/.gitignore index 592365c5..4c1364f9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,16 @@ bin .idea .bsp/ + +# vscode +.vscode/ + +# metals +.metals/ +project/metals.sbt +project/project + +# bloop +.bloop/ +project/.bloop/ + diff --git a/build.sbt b/build.sbt index fa44fc90..30a88d4b 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,5 @@ -import scala.sys.process._ - -import com.typesafe.tools.mima.plugin.MimaPlugin._ +import com.typesafe.tools.mima.core._ +import com.typesafe.tools.mima.core.ProblemFilters import interplay.ScalaVersions._ ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("releases") @@ -18,8 +17,8 @@ Global / onLoad := (Global / onLoad).value.andThen { s => lazy val commonSettings = Seq( // Work around https://issues.scala-lang.org/browse/SI-9311 scalacOptions ~= (_.filterNot(_ == "-Xfatal-warnings")), - scalaVersion := "2.13.10", // scala213, - crossScalaVersions := Seq("2.13.10"), // scala213, + scalaVersion := scala213, + crossScalaVersions := Seq(scala213, scala3), pomExtra := scala.xml.NodeSeq.Empty, // Can be removed when dropping interplay developers += Developer( "playframework", @@ -42,6 +41,11 @@ lazy val `play-slick` = (project in file("src/core")) .configs(Docs) .settings(libraryDependencies ++= Dependencies.core) .settings(mimaSettings) + .settings( + mimaBinaryIssueFilters ++= Seq( + ProblemFilters.exclude[DirectMissingMethodProblem]("play.api.db.slick.HasDatabaseConfig.db") + ) + ) .settings(commonSettings) lazy val `play-slick-evolutions` = (project in file("src/evolutions")) @@ -68,5 +72,9 @@ val previousVersion: Option[String] = Some("5.0.2") ThisBuild / mimaFailOnNoPrevious := false def mimaSettings = Seq( - mimaPreviousArtifacts := previousVersion.map(organization.value %% moduleName.value % _).toSet + mimaPreviousArtifacts := { + if (scalaBinaryVersion.value == "3") Set.empty[ModuleID] + else + previousVersion.map(organization.value %% moduleName.value % _).toSet + } ) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7b01ebac..9490340d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -21,7 +21,7 @@ object Dependencies { object Version { val play = _root_.play.core.PlayVersion.current - val slick = "3.4.1" + val slick = "3.5.0-pre.66.7d3ce9c0" val h2 = "2.1.214" } diff --git a/project/plugins.sbt b/project/plugins.sbt index 3f60cb14..0a441fdb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,8 +4,8 @@ resolvers ++= Seq( Resolver.sonatypeRepo("snapshots"), // used by deploy nightlies, which publish here & use -Dplay.version ) -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-M3")) -addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-M3")) +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-M4")) +addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-M4")) addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.get("interplay.version").getOrElse("3.1.0-RC10")) addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") diff --git a/src/core/src/main/scala/play/api/db/slick/DatabaseConfigProvider.scala b/src/core/src/main/scala/play/api/db/slick/DatabaseConfigProvider.scala index 87e3ea6d..a0b1327d 100644 --- a/src/core/src/main/scala/play/api/db/slick/DatabaseConfigProvider.scala +++ b/src/core/src/main/scala/play/api/db/slick/DatabaseConfigProvider.scala @@ -152,13 +152,14 @@ object DatabaseConfigProvider { trait HasDatabaseConfig[P <: BasicProfile] { /** The Slick database configuration. */ - protected val dbConfig: DatabaseConfig[P] // field is declared as a val because we want a stable identifier. + protected lazy val dbConfig: DatabaseConfig[P] = + ??? // field is declared as a val because we want a stable identifier. TODO: Remove ??? when dropping Scala 2 /** The Slick profile extracted from `dbConfig`. */ protected final lazy val profile: P = dbConfig.profile // field is lazy to avoid early initializer problems. @deprecated("Use `profile` instead of `driver`", "2.1") protected final lazy val driver: P = dbConfig.profile // field is lazy to avoid early initializer problems. /** The Slick database extracted from `dbConfig`. */ - protected final def db: P#Backend#Database = dbConfig.db + protected final def db = dbConfig.db } /** diff --git a/src/core/src/test/scala/play/api/db/slick/DefaultSlickApiSpec.scala b/src/core/src/test/scala/play/api/db/slick/DefaultSlickApiSpec.scala index 40130932..55b836c6 100644 --- a/src/core/src/test/scala/play/api/db/slick/DefaultSlickApiSpec.scala +++ b/src/core/src/test/scala/play/api/db/slick/DefaultSlickApiSpec.scala @@ -2,7 +2,6 @@ package play.api.db.slick import java.util.concurrent.ConcurrentLinkedDeque -import org.specs2.mock.Mockito import org.specs2.mutable.Specification import play.api.inject.Injector import play.api.inject.ApplicationLifecycle @@ -10,7 +9,7 @@ import play.api.inject.DefaultApplicationLifecycle import play.api.inject.guice.GuiceApplicationBuilder import slick.basic.BasicProfile -class DefaultSlickApiSpec extends Specification with Mockito { self => +class DefaultSlickApiSpec extends Specification { self => sequential diff --git a/src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala b/src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala index f92ac1a8..1f23cb67 100644 --- a/src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala +++ b/src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala @@ -27,7 +27,7 @@ class SlickApiSpec extends Specification { "return a DatabaseConfig instance for a correctly configured database" in { import SUTWithGoodConfig._ val default = api.dbConfig[BasicProfile](DbName("default")) - default must not beNull + default must not(beNull) } "always return the same DatabaseConfig instance for a given database name" in { import SUTWithGoodConfig._