Skip to content

Commit

Permalink
Update Scala and dependencies (#417)
Browse files Browse the repository at this point in the history
* Update Scala and dependencies

* Fix tests

See zio/zio-quill#2970
  • Loading branch information
guizmaii authored Mar 15, 2024
1 parent df470ec commit 6f3999d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
scala: [ 3.3.1 ]
scala: [ 3.3.3 ]
module: [ sqltest, db, bigdata ]

steps:
Expand Down
23 changes: 12 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ val isCommunityRemoteBuild =
sys.props.getOrElse("communityRemote", "false").toBoolean

lazy val scalatestVersion =
if (isCommunityRemoteBuild) "3.2.7" else "3.2.17"
if (isCommunityRemoteBuild) "3.2.7" else "3.2.18"

lazy val baseModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]](
`quill-sql`
Expand Down Expand Up @@ -85,7 +85,8 @@ val filteredModules = {
selectedModules
}

val zioQuillVersion = "4.8.0"
val zioQuillVersion = "4.8.3"
val zioVersion = "2.0.21"

lazy val `quill` =
(project in file("."))
Expand Down Expand Up @@ -118,7 +119,7 @@ lazy val `quill-sql` =
"com.lihaoyi" %% "pprint" % "0.8.1",
"ch.qos.logback" % "logback-classic" % "1.5.3" % Test,
"io.getquill" %% "quill-engine" % zioQuillVersion,
"dev.zio" %% "zio" % "2.0.19",
"dev.zio" %% "zio" % zioVersion,
("io.getquill" %% "quill-util" % zioQuillVersion)
.excludeAll({
if (isCommunityBuild)
Expand Down Expand Up @@ -170,7 +171,7 @@ lazy val `quill-caliban` =
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
"com.github.ghostdogpr" %% "caliban-quick" % "2.5.1",
"com.github.ghostdogpr" %% "caliban-quick" % "2.5.3",
// Adding this to main dependencies would force users to use logback-classic for SLF4j unless the specifically remove it
// seems to be safer to just exclude & add a commented about need for a SLF4j implementation in Docs.
"ch.qos.logback" % "logback-classic" % "1.5.3" % Test,
Expand All @@ -188,8 +189,8 @@ lazy val `quill-zio` =
.settings(
Test / fork := true,
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "2.0.21",
"dev.zio" %% "zio-streams" % "2.0.21"
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion
)
)
.dependsOn(`quill-sql` % "compile->compile;test->test")
Expand Down Expand Up @@ -239,8 +240,8 @@ lazy val `quill-cassandra-zio` =
Test / fork := true,
libraryDependencies ++= Seq(
"com.datastax.oss" % "java-driver-core" % "4.17.0",
"dev.zio" %% "zio" % "2.0.21",
"dev.zio" %% "zio-streams" % "2.0.21"
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion
)
)
.dependsOn(`quill-cassandra` % "compile->compile;test->test")
Expand All @@ -265,11 +266,11 @@ lazy val jdbcTestingLibraries = Seq(
libraryDependencies ++= Seq(
"com.zaxxer" % "HikariCP" % "5.1.0" exclude("org.slf4j", "*"),
// In 8.0.22 error happens: Conversion from java.time.OffsetDateTime to TIMESTAMP is not supported
"com.mysql" % "mysql-connector-j" % "8.2.0" % Test,
"com.mysql" % "mysql-connector-j" % "8.3.0" % Test,
"com.h2database" % "h2" % "2.2.224" % Test,
// In 42.2.18 error happens: PSQLException: conversion to class java.time.OffsetTime from timetz not supported
"org.postgresql" % "postgresql" % "42.7.3" % Test,
"org.xerial" % "sqlite-jdbc" % "3.42.0.1" % Test,
"org.xerial" % "sqlite-jdbc" % "3.45.2.0" % Test,
// In 7.1.1-jre8-preview error happens: The conversion to class java.time.OffsetDateTime is unsupported.
"com.microsoft.sqlserver" % "mssql-jdbc" % "7.4.1.jre11" % Test,
"com.oracle.ojdbc" % "ojdbc8" % "19.3.0.0" % Test,
Expand All @@ -289,7 +290,7 @@ lazy val basicSettings = Seq(
excludeDependencies ++= Seq(
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13")
),
scalaVersion := "3.3.1",
scalaVersion := "3.3.3",
// The -e option is the 'error' report of ScalaTest. We want it to only make a log
// of the failed tests once all tests are done, the regular -o log shows everything else.
// Test / testOptions ++= Seq(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.7
sbt.version=1.9.9
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releas

addDependencyTreePlugin

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,35 @@ class SqlIdiomOptionCompareSpec extends Spec {
qr1.filter(t => t.o.exists(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL"
}
"forall" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.forall(op => op == 1))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o = 1)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o = 1 OR t.o IS NULL)"
}
"forall with null-check" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.forall(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL OR t.o IS NULL)"
}
"filterIfDefined" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.filterIfDefined(op => op == 1))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o = 1)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o = 1 OR t.o IS NULL)"
}
"filter IfDefined with null-check" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.filterIfDefined(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL OR t.o IS NULL)"
}
"embedded" - {
case class TestEntity(optionalEmbedded: Option[EmbeddedEntity])
Expand Down Expand Up @@ -183,39 +183,39 @@ class SqlIdiomOptionCompareSpec extends Spec {
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL"
}
"forall" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.forall(_ == 1)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue = 1"
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue = 1 OR t.optionalValue IS NULL"
}
"forall with null-check" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.forall(v => if (v == 1) true else false)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL OR t.optionalValue IS NULL"
}
"filterIfDefined" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.filterIfDefined(_ == 1)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue = 1"
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue = 1 OR t.optionalValue IS NULL"
}
"filterIfDefined with null-check" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.filterIfDefined(v => if (v == 1) true else false)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL OR t.optionalValue IS NULL"
}
}
}
Expand Down Expand Up @@ -318,35 +318,35 @@ class SqlIdiomOptionCompareSpec extends Spec {
qr1.filter(t => t.o.exists(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL"
}
"forall" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.forall(op => op == 1))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o = 1)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o = 1 OR t.o IS NULL)"
}
"forall with null-check" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.forall(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL OR t.o IS NULL)"
}
"filterIfDefined" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.filterIfDefined(op => op == 1))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o = 1)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o = 1 OR t.o IS NULL)"
}
"filterIfDefined with null-check" in {
inline def q = quote {
qr1.filter(t => t.i != 1 && t.o.filterIfDefined(op => if (op != 1) false else true))
}
testContext.run(q).string mustEqual
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (t.o IS NULL OR t.o IS NOT NULL AND CASE WHEN t.o <> 1 THEN false ELSE true END)"
"SELECT t.s, t.i, t.l, t.o, t.b FROM TestEntity t WHERE t.i <> 1 AND (CASE WHEN t.o <> 1 THEN false ELSE true END AND t.o IS NOT NULL OR t.o IS NULL)"
}
"embedded" - {
case class TestEntity(optionalEmbedded: Option[EmbeddedEntity])
Expand Down Expand Up @@ -394,39 +394,39 @@ class SqlIdiomOptionCompareSpec extends Spec {
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL"
}
"forall" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.forall(_ == 1)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue = 1"
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue = 1 OR t.optionalValue IS NULL"
}
"forall with null-check" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.forall(v => if (v == 1) true else false)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL OR t.optionalValue IS NULL"
}
"filterIfDefined" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.filterIfDefined(_ == 1)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue = 1"
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue = 1 OR t.optionalValue IS NULL"
}
"filterIfDefined with null-check" in {
inline def q = quote {
query[TestEntity].filter(t => t.optionalEmbedded.exists(_.optionalValue.filterIfDefined(v => if (v == 1) true else false)))
}

testContext.run(q).string mustEqual
"SELECT t.optionalValue FROM TestEntity t WHERE t.optionalValue IS NULL OR t.optionalValue IS NOT NULL AND CASE WHEN t.optionalValue = 1 THEN true ELSE false END"
"SELECT t.optionalValue FROM TestEntity t WHERE CASE WHEN t.optionalValue = 1 THEN true ELSE false END AND t.optionalValue IS NOT NULL OR t.optionalValue IS NULL"
}
}
}
Expand Down

0 comments on commit 6f3999d

Please sign in to comment.