-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cross-compile for Scala 3 * Use testcontainers instead of cassandra-launcher * Remove Scala 3 pureconfig compat * Remove pureconfig derivation * Update pureconfig version * Upgrade cross scala versions * Update sbt-scoverage * Use cursor ConfigReaders * Move cassandraContainer up * Unit test empty ConfigReader Simple * Set version to 5.0.3-SNAPSHOT * Fix ReplicationStrategyConfig#Simple binary incompat * Set version to 5.1.0-SNAPSHOT
- Loading branch information
1 parent
9feef7d
commit 3e9ffb3
Showing
32 changed files
with
380 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,84 @@ | ||
import Dependencies._ | ||
|
||
def crossSettings[T](scalaVersion: String, if3: List[T], if2: List[T]) = | ||
CrossVersion.partialVersion(scalaVersion) match { | ||
case Some((3, _)) => if3 | ||
case Some((2, 12 | 13)) => if2 | ||
case _ => Nil | ||
} | ||
|
||
lazy val commonSettings = Seq( | ||
organization := "com.evolutiongaming", | ||
homepage := Some(new URL("http://github.com/evolution-gaming/scassandra")), | ||
startYear := Some(2018), | ||
organizationName := "Evolution", | ||
organizationHomepage := Some(url("http://evolution.com")), | ||
scalaVersion := crossScalaVersions.value.head, | ||
crossScalaVersions := Seq("2.13.8", "2.12.17"), | ||
crossScalaVersions := Seq("2.13.13", "3.3.3", "2.12.19"), | ||
Compile / doc / scalacOptions ++= Seq("-groups", "-implicits", "-no-link-warnings"), | ||
publishTo := Some(Resolver.evolutionReleases), | ||
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))), | ||
releaseCrossBuild := true, | ||
scalacOptsFailOnWarn := Some(false)) | ||
scalacOptsFailOnWarn := Some(false), | ||
scalacOptions ++= crossSettings( | ||
scalaVersion.value, | ||
if3 = List("-Ykind-projector", "-language:implicitConversions", "-explain", "-deprecation"), | ||
if2 = List("-Xsource:3"), | ||
)) | ||
|
||
lazy val root = (project in file(".") | ||
settings (name := "scassandra") | ||
settings commonSettings | ||
settings ( | ||
lazy val root = (project in file(".")) | ||
.settings(name := "scassandra") | ||
.settings(commonSettings) | ||
.settings( | ||
publish / skip := true, | ||
skip / publishArtifact := true) | ||
aggregate(scassandra, tests)) | ||
skip / publishArtifact := true | ||
) | ||
.aggregate(scassandra, tests) | ||
|
||
lazy val scassandra = (project in file("scassandra") | ||
settings (name := "scassandra") | ||
settings commonSettings | ||
settings (libraryDependencies ++= Seq( | ||
Cats.core, | ||
Cats.effect, | ||
`config-tools`, | ||
`cats-helper`, | ||
sstream, | ||
scalatest % Test, | ||
nel, | ||
`cassandra-driver`, | ||
`executor-tools`, | ||
Pureconfig.pureconfig, | ||
Pureconfig.cats))) | ||
lazy val scassandra = (project in file("scassandra")) | ||
.settings(name := "scassandra") | ||
.settings(commonSettings) | ||
.settings( | ||
libraryDependencies ++= Seq( | ||
Cats.core, | ||
Cats.effect, | ||
`config-tools`, | ||
`cats-helper`, | ||
sstream, | ||
scalatest % Test, | ||
nel, | ||
`cassandra-driver`, | ||
`executor-tools`, | ||
Pureconfig.cats | ||
) | ||
) | ||
.settings( | ||
libraryDependencies ++= crossSettings( | ||
scalaVersion.value, | ||
if3 = List(Pureconfig.core), | ||
if2 = List(Pureconfig.pureconfig), | ||
) | ||
) | ||
|
||
lazy val tests = (project in file("tests") | ||
settings (name := "tests") | ||
settings commonSettings | ||
settings Seq( | ||
publish / skip := true, | ||
skip / publishArtifact := true, | ||
Test / fork := true, | ||
Test / parallelExecution := false) | ||
dependsOn scassandra % "test->test;compile->compile" | ||
settings (libraryDependencies ++= Seq( | ||
`cassandra-launcher` % Test, | ||
Slf4j.api % Test, | ||
Slf4j.`log4j-over-slf4j` % Test, | ||
Logback.core % Test, | ||
Logback.classic % Test, | ||
scalatest % Test))) | ||
lazy val tests = (project in file("tests")) | ||
.settings(name := "tests") | ||
.settings(commonSettings) | ||
.settings( | ||
Seq( | ||
publish / skip := true, | ||
skip / publishArtifact := true, | ||
Test / fork := true, | ||
Test / parallelExecution := false | ||
) | ||
) | ||
.dependsOn(scassandra % "test->test;compile->compile") | ||
.settings( | ||
libraryDependencies ++= Seq( | ||
`testcontainers-cassandra` % Test, | ||
Slf4j.api % Test, | ||
Slf4j.`log4j-over-slf4j` % Test, | ||
Logback.core % Test, | ||
Logback.classic % Test, | ||
scalatest % Test | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
scassandra/src/main/scala-3/com/evolutiongaming/util/ToJava.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.evolutiongaming.util | ||
|
||
import scala.jdk.CollectionConverters._ | ||
|
||
object ToJava { | ||
|
||
def from[T](collection: List[T]): java.util.Collection[T] = | ||
collection.asJavaCollection | ||
|
||
def from[T](set: Set[T]): java.util.Set[T] = | ||
set.asJava | ||
|
||
def from[A, B](map: Map[A, B]): java.util.Map[A, B] = | ||
map.asJava | ||
} |
13 changes: 13 additions & 0 deletions
13
scassandra/src/main/scala-3/com/evolutiongaming/util/ToScala.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.evolutiongaming.util | ||
|
||
import scala.collection.mutable | ||
import scala.jdk.CollectionConverters._ | ||
|
||
object ToScala { | ||
|
||
def from[T](collection: java.util.Collection[T]): Iterable[T] = | ||
collection.asScala | ||
|
||
def from[A, B](map: java.util.Map[A, B]): mutable.Map[A, B] = | ||
map.asScala | ||
} |
7 changes: 2 additions & 5 deletions
7
scassandra/src/main/scala/com/evolutiongaming/scassandra/AuthenticationConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
scassandra/src/main/scala/com/evolutiongaming/scassandra/AuthenticationConfigImplicits.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.evolutiongaming.scassandra | ||
|
||
import com.evolutiongaming.scassandra.util.PureconfigSyntax._ | ||
import pureconfig.ConfigReader | ||
|
||
trait AuthenticationConfigImplicits { | ||
implicit val configReaderAuthenticationConfig: ConfigReader[AuthenticationConfig] = | ||
ConfigReader.fromCursor[AuthenticationConfig] { cursor => | ||
for { | ||
objCur <- cursor.asObjectCursor | ||
username <- objCur.getAt[String]("username") | ||
password <- objCur.getAt[String]("password") | ||
} yield AuthenticationConfig( | ||
username = username, | ||
password = password | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
scassandra/src/main/scala/com/evolutiongaming/scassandra/LoadBalancingConfigImplicits.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.evolutiongaming.scassandra | ||
|
||
import com.evolutiongaming.scassandra.util.PureconfigSyntax._ | ||
import pureconfig.ConfigReader | ||
|
||
trait LoadBalancingConfigImplicits { | ||
implicit val configReaderLoadBalancingConfig: ConfigReader[LoadBalancingConfig] = ConfigReader.fromCursor[LoadBalancingConfig] { cursor => | ||
val defaultConfig = LoadBalancingConfig() | ||
|
||
for { | ||
objCur <- cursor.asObjectCursor | ||
localDc <- objCur.getAtOpt[String]("local-dc").map(_.getOrElse(defaultConfig.localDc)) | ||
allowRemoteDcsForLocalConsistencyLevel <- objCur.getAtOpt[Boolean]("allow-remote-dcs-for-local-consistency-level").map(_.getOrElse(defaultConfig.allowRemoteDcsForLocalConsistencyLevel)) | ||
} yield LoadBalancingConfig( | ||
localDc = localDc, | ||
allowRemoteDcsForLocalConsistencyLevel = allowRemoteDcsForLocalConsistencyLevel | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.