diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index 78cdd0d1..00000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-version: 2
-
-jobs:
- build:
- docker:
- # specify the version you desire here
- - image: circleci/openjdk:8-jdk-node-browsers
-
- working_directory: ~/repo
-
- environment:
- JAVA_OPTS: "-Xms512m -Xmx1024m"
- TRAVIS_SCALA_VERSION: 2.11.12
-
- steps:
- - checkout
-
- # Download and cache dependencies
- - restore_cache:
- keys:
- - v1-dependencies-{{ checksum "build.sbt" }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
-
- - run: ./.ci_scripts/validate.sh
-
- - save_cache:
- paths:
- - ~/.ivy2
- - ~/.sbt
- key: v1-dependencies-{{ checksum "build.sbt" }}
-
- - store_test_results:
- path: .
diff --git a/.travis.yml b/.travis.yml
index 95317bab..241daaf8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ cache:
- $HOME/.ivy2
- $HOME/.sbt
scala:
-# - 2.11.11 (on Circle)
- - 2.12.8
- - 2.13.0
+ - 2.11.11
+ - 2.12.8
+ - 2.13.0
script: ./.ci_scripts/validate.sh
diff --git a/build.sbt b/build.sbt
index abe2f754..8538d656 100644
--- a/build.sbt
+++ b/build.sbt
@@ -13,7 +13,9 @@ crossScalaVersions in ThisBuild := Seq(
"2.10.7", "2.11.12", (scalaVersion in ThisBuild).value, "2.13.0"
)
-resolvers in ThisBuild += Resolver.sonatypeRepo("snapshots")
+resolvers in ThisBuild ++= Seq(
+ Resolver.sonatypeRepo("snapshots"),
+ "Tatami Snapshots" at "https://raw.github.com/cchantep/tatami/master/snapshots")
//
val scalacPlugin = ScalacPlugin.project
diff --git a/jdbc-driver/src/test/scala/acolyte/jdbc/DriverSpec.scala b/jdbc-driver/src/test/scala/acolyte/jdbc/DriverSpec.scala
index 4ab663a8..ea07a623 100644
--- a/jdbc-driver/src/test/scala/acolyte/jdbc/DriverSpec.scala
+++ b/jdbc-driver/src/test/scala/acolyte/jdbc/DriverSpec.scala
@@ -12,7 +12,7 @@ import org.specs2.concurrent.ExecutionEnv
import acolyte.jdbc.test.EmptyConnectionHandler
-class DriverSpec(implicit ee: ExecutionEnv)
+final class DriverSpec(implicit ee: ExecutionEnv)
extends Specification with DriverUtils with DriverFixtures {
"Acolyte driver" title
@@ -140,25 +140,24 @@ class DriverSpec(implicit ee: ExecutionEnv)
acolyte.jdbc.Driver.register("id", h)
acolyte.jdbc.Driver.unregister("id").
- getStatementHandler aka "handler" mustEqual h
+ getStatementHandler aka "handler" must_=== h
}
"handle multi-threaded access" in {
import scala.concurrent.duration._
- val futures =
- (1 to 1000).map { _ =>
- Future {
- val handlerId = UUID.randomUUID().toString
- acolyte.jdbc.Driver.register(handlerId, new CompositeHandler())
- handlerId
- }.map { handlerId =>
- acolyte.jdbc.Driver.handlers.get(handlerId) must not(beNull)
- }
+ val futures = (1 to 1000).map { _ =>
+ Future {
+ val handlerId = UUID.randomUUID().toString
+ acolyte.jdbc.Driver.register(handlerId, new CompositeHandler())
+ handlerId
+ }.map { handlerId =>
+ acolyte.jdbc.Driver.handlers.get(handlerId) must not beNull
}
+ }
- Await.result(Future.sequence(futures), 5.seconds)
+ Future.sequence(futures).map(_.fold(ok)(_ and _)).await(1, 5.seconds)
}
}
}
diff --git a/play-jdbc/src/main/play-2.4/AcolyteDatabaseCompat.scala b/play-jdbc/src/main/play-2.4/AcolyteDatabaseCompat.scala
new file mode 100644
index 00000000..bc794f27
--- /dev/null
+++ b/play-jdbc/src/main/play-2.4/AcolyteDatabaseCompat.scala
@@ -0,0 +1,4 @@
+package acolyte.jdbc.play
+
+private[play] trait AcolyteDatabaseCompat { db: AcolyteDatabase ⇒
+}
diff --git a/play-jdbc/src/main/play-2.5/AcolyteDatabaseCompat.scala b/play-jdbc/src/main/play-2.5/AcolyteDatabaseCompat.scala
new file mode 100644
index 00000000..bc794f27
--- /dev/null
+++ b/play-jdbc/src/main/play-2.5/AcolyteDatabaseCompat.scala
@@ -0,0 +1,4 @@
+package acolyte.jdbc.play
+
+private[play] trait AcolyteDatabaseCompat { db: AcolyteDatabase ⇒
+}
diff --git a/play-jdbc/src/main/play-2.6/AcolyteDatabaseCompat.scala b/play-jdbc/src/main/play-2.6/AcolyteDatabaseCompat.scala
new file mode 100644
index 00000000..bc794f27
--- /dev/null
+++ b/play-jdbc/src/main/play-2.6/AcolyteDatabaseCompat.scala
@@ -0,0 +1,4 @@
+package acolyte.jdbc.play
+
+private[play] trait AcolyteDatabaseCompat { db: AcolyteDatabase ⇒
+}
diff --git a/play-jdbc/src/main/play-2.7/AcolyteDatabaseCompat.scala b/play-jdbc/src/main/play-2.7/AcolyteDatabaseCompat.scala
new file mode 100644
index 00000000..b3e34907
--- /dev/null
+++ b/play-jdbc/src/main/play-2.7/AcolyteDatabaseCompat.scala
@@ -0,0 +1,21 @@
+package acolyte.jdbc.play
+
+import java.sql.Connection
+
+import play.api.db.TransactionIsolationLevel
+
+private[play] trait AcolyteDatabaseCompat { db: AcolyteDatabase ⇒
+ def withTransaction[A](isolationLevel: TransactionIsolationLevel)(block: Connection ⇒ A): A = {
+ lazy val con = getConnection(false)
+
+ try {
+ con.setTransactionIsolation(isolationLevel.id)
+
+ block(con)
+ } catch {
+ case e: Throwable ⇒ sys.error(s"error: $e")
+ } finally {
+ con.close()
+ }
+ }
+}
diff --git a/play-jdbc/src/main/scala/AcolyteDatabase.scala b/play-jdbc/src/main/scala/AcolyteDatabase.scala
index 9a32b9c9..4e99598c 100644
--- a/play-jdbc/src/main/scala/AcolyteDatabase.scala
+++ b/play-jdbc/src/main/scala/AcolyteDatabase.scala
@@ -25,7 +25,7 @@ import acolyte.jdbc.{
final class AcolyteDatabase(
handler: ScalaCompositeHandler,
resourceHandler: ResourceHandler = new ResourceHandler.Default(),
- id: String = java.util.UUID.randomUUID().toString) extends Database { self ⇒
+ id: String = java.util.UUID.randomUUID().toString) extends Database with AcolyteDatabaseCompat { self ⇒
AcolyteDriver.register(id, new ConnectionHandler.Default(handler, resourceHandler))
diff --git a/play-jdbc/src/test/scala/PlayJdbcUseCases.scala b/play-jdbc/src/test/scala/PlayJdbcUseCases.scala
index 46d7c534..b8889de0 100644
--- a/play-jdbc/src/test/scala/PlayJdbcUseCases.scala
+++ b/play-jdbc/src/test/scala/PlayJdbcUseCases.scala
@@ -10,24 +10,24 @@ case object PlayJdbcUseCases {
val useCase1: PlayJdbcContext = PlayJdbcDSL.withPlayDBResult("foo")
- def useCase2(onUpdate: ⇒ Unit): PlayJdbcContext = new PlayJdbcContext(
+ def useCase2(onUpdate: => Unit): PlayJdbcContext = new PlayJdbcContext(
AcolyteDSL.handleStatement.withUpdateHandler {
- case UpdateExecution("insert into foo values (1, 'foo value')", Nil) ⇒
+ case UpdateExecution("insert into foo values (1, 'foo value')", Nil) =>
AcolyteDSL.updateResult(1, RowLists.longList.append(1L))
- case UpdateExecution("insert into bar values (1, 'bar value')", Nil) ⇒
+ case UpdateExecution("insert into bar values (1, 'bar value')", Nil) =>
AcolyteDSL.updateResult(2, RowLists.longList.append(1L))
- case u ⇒ throw new SQLException(s"Unexpected update: $u")
+ case u => throw new SQLException(s"Unexpected update: $u")
},
- AcolyteDSL.handleTransaction(whenCommit = { _ ⇒ onUpdate }))
+ AcolyteDSL.handleTransaction(whenCommit = { _ => onUpdate }))
- def useCase3(onUpdate: ⇒ Unit): PlayJdbcContext = new PlayJdbcContext(
+ def useCase3(onUpdate: => Unit): PlayJdbcContext = new PlayJdbcContext(
AcolyteDSL.handleStatement.withUpdateHandler {
- case UpdateExecution("insert into foo values (1, 'foo value')", Nil) ⇒
+ case UpdateExecution("insert into foo values (1, 'foo value')", Nil) =>
AcolyteDSL.updateResult(1, RowLists.longList.append(1L))
- case UpdateExecution("insert into bar values (1, 'bar value')", Nil) ⇒
+ case UpdateExecution("insert into bar values (1, 'bar value')", Nil) =>
throw new SQLException("Simulating on error.")
- case u ⇒ throw new SQLException(s"Unexpected update: $u")
+ case u => throw new SQLException(s"Unexpected update: $u")
},
- AcolyteDSL.handleTransaction(whenRollback = { _ ⇒ onUpdate }))
+ AcolyteDSL.handleTransaction(whenRollback = { _ => onUpdate }))
}
diff --git a/project/Compiler.scala b/project/Compiler.scala
index 33cc3bd1..5df0e5b3 100644
--- a/project/Compiler.scala
+++ b/project/Compiler.scala
@@ -9,7 +9,7 @@ object Compiler extends AutoPlugin {
"-unchecked",
"-deprecation",
"-feature",
- //"-Xfatal-warnings",
+ "-Xfatal-warnings",
"-Xlint",
"-Ywarn-numeric-widen",
"-Ywarn-dead-code",
diff --git a/project/Format.scala b/project/Format.scala
index 659155dc..dc5efe17 100644
--- a/project/Format.scala
+++ b/project/Format.scala
@@ -22,7 +22,6 @@ object Format {
setPreference(SpaceBeforeColon, false).
setPreference(SpaceInsideBrackets, false).
setPreference(SpacesAroundMultiImports, true).
- setPreference(SpacesWithinPatternBinders, true).
- setPreference(RewriteArrowSymbols, true)
+ setPreference(SpacesWithinPatternBinders, true)
)
}
diff --git a/project/PlayJdbc.scala b/project/PlayJdbc.scala
index 35bfd8af..b3079a3b 100644
--- a/project/PlayJdbc.scala
+++ b/project/PlayJdbc.scala
@@ -8,21 +8,21 @@ class PlayJdbc(
import Dependencies._
import Format._
+ val playVersion = settingKey[String]("Playframework version")
+
lazy val project =
Project(id = "play-jdbc", base = file("play-jdbc")).
settings(formatSettings ++ Seq(
name := "play-jdbc",
scalacOptions in Test ++= {
val v = (version in ThisBuild).value
- val sv = (scalaVersion in ThisBuild).value
+ val sv = (scalaVersion in Test).value
val b = (baseDirectory in (scalacPlugin, Compile)).value
val n = (name in (scalacPlugin, Compile)).value
- val msv = {
- if (sv startsWith "2.10") "2.10"
- else if (sv startsWith "2.11") "2.11"
- else if (sv startsWith "2.12") "2.12"
- else sv
+ val msv = CrossVersion.partialVersion(sv) match {
+ case Some((maj, min)) => s"${maj}.${min}"
+ case _ => sv
}
val td = b / "target" / s"scala-$msv"
@@ -30,21 +30,38 @@ class PlayJdbc(
Seq("-feature", "-deprecation", s"-Xplugin:${j.getAbsolutePath}")
},
+ playVersion := {
+ val scalaVer = scalaVersion.value
+
+ if (scalaVer startsWith "2.11.") "2.5.8"
+ else if (scalaVer startsWith "2.12.") "2.6.7"
+ else if (scalaVer startsWith "2.13.") "2.7.3"
+ else "2.4.8"
+ },
+ unmanagedSourceDirectories in Compile += {
+ val base = (sourceDirectory in Compile).value
+
+ CrossVersion.partialVersion(playVersion.value) match {
+ case Some((maj, min)) => base / s"play-${maj}.${min}"
+ case _ => base / "play"
+ }
+ },
compile in Test := (compile in Test).
dependsOn(compile in (scalacPlugin, Test)).value,
// make sure plugin is there
libraryDependencies ++= {
- val (playVer, anormVer) = {
- if (scalaVersion.value startsWith "2.11") "2.5.8" -> "2.5.2"
- else if (scalaVersion.value startsWith "2.12") "2.6.7" -> "2.5.0"
- else if (scalaVersion.value startsWith "2.13") "2.7.3" -> "2.5.0"
- else "2.4.8" -> "2.5.0"
+ val anorm = {
+ if (scalaVersion.value startsWith "2.10.") {
+ "com.typesafe.play" %% "anorm" % "2.5.0"
+ } else {
+ "org.playframework.anorm" %% "anorm" % "2.6.3"
+ }
}
Seq(
"org.eu.acolyte" % "jdbc-driver" % (version in ThisBuild).value,
- "com.typesafe.play" %% "play-jdbc-api" % playVer % "provided",
- "com.typesafe.play" %% "anorm" % anormVer % Test,
+ "com.typesafe.play" %% "play-jdbc-api" % playVersion.value % "provided",
+ anorm % Test,
"org.specs2" %% "specs2-core" % specsVer.value % Test)
}
)).dependsOn(scalacPlugin, jdbcScala)
diff --git a/project/ReactiveMongo.scala b/project/ReactiveMongo.scala
index 0d53cabf..fb5ed540 100644
--- a/project/ReactiveMongo.scala
+++ b/project/ReactiveMongo.scala
@@ -13,20 +13,19 @@ class ReactiveMongo(scalacPlugin: Project) { self =>
lazy val generatedClassDirectory = settingKey[File](
"Directory where classes get generated")
- val reactiveMongoVer = "0.18.0"
+ val reactiveMongoVer = "0.18.1"
lazy val project =
Project(id = "reactive-mongo", base = file("reactive-mongo")).
settings(formatSettings ++ Set(
name := "reactive-mongo",
fork in Test := true,
- javacOptions in Test ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
resolvers ++= reactiveResolvers,
libraryDependencies ++= Seq(
"org.reactivemongo" %% "reactivemongo" % reactiveMongoVer % "provided",
- "com.jsuereth" %% "scala-arm" % "2.0",
+ "com.jsuereth" %% "scala-arm" % "2.1-SNAPSHOT",
"org.slf4j" % "slf4j-simple" % "1.7.13" % Provided,
- "com.chuusai" %% "shapeless" % "2.3.2",
+ "com.chuusai" %% "shapeless" % "2.3.3",
"org.specs2" %% "specs2-core" % specsVer.value % Test)
))//.dependsOn(scalacPlugin)
@@ -35,17 +34,20 @@ class ReactiveMongo(scalacPlugin: Project) { self =>
settings(formatSettings ++ Set(
name := "play-reactive-mongo",
crossScalaVersions ~= { _.filterNot(_ startsWith "2.10") },
- javacOptions in Test ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
+ sourceDirectory := {
+ if (scalaVersion.value startsWith "2.10.") {
+ new java.io.File("/no/sources")
+ } else sourceDirectory.value
+ },
scalacOptions ++= {
val v = version.value
val sv = scalaVersion.value
val b = (baseDirectory in (scalacPlugin, Compile)).value
val n = (name in (scalacPlugin, Compile)).value
- val msv = {
- if (sv startsWith "2.12") "2.12"
- else if (sv startsWith "2.11") "2.11"
- else "2.10"
+ val msv = CrossVersion.partialVersion(sv) match {
+ case Some((maj, min)) => s"${maj}.${min}"
+ case _ => sv
}
val td = b / "target" / s"scala-$msv"
@@ -54,22 +56,46 @@ class ReactiveMongo(scalacPlugin: Project) { self =>
Seq("-feature", "-deprecation", s"-Xplugin:${j.getAbsolutePath}")
},
resolvers ++= reactiveResolvers,
- libraryDependencies ++= {
- val (playVer, playVar) = if (scalaVersion.value startsWith "2.12") {
- "2.6.3" -> "play26"
- } else {
- "2.5.13" -> "play25"
+ publish := (Def.taskDyn {
+ val p = publish.value
+ val ver = scalaVersion.value
+
+ Def.task[Unit] {
+ if (ver startsWith "2.10.") ({})
+ else p
}
+ }).value,
+ publishTo := (Def.taskDyn {
+ val p = publishTo.value
+ val ver = scalaVersion.value
- val playRmVer = reactiveMongoVer.span(_ != '-') match {
- case (v, m) => s"${v}-${playVar}${m}"
+ Def.task {
+ if (ver startsWith "2.10.") None
+ else p
}
+ }).value,
+ libraryDependencies ++= {
+ val sv = scalaVersion.value
+
+ if (sv startsWith "2.10.") {
+ Seq.empty[ModuleID]
+ } else {
+ val (playVer, playVar) = {
+ if (sv startsWith "2.12.") "2.6.3" -> "play26"
+ else if (sv startsWith "2.13.") "2.7.3" -> "play27"
+ else "2.5.13" -> "play25"
+ }
- Seq(
- "com.typesafe.play" %% "play" % playVer % Provided,
- "org.reactivemongo" %% "play2-reactivemongo" % playRmVer % Provided,
- "org.specs2" %% "specs2-core" % specsVer.value % Test
- )
+ val playRmVer = reactiveMongoVer.span(_ != '-') match {
+ case (v, m) => s"${v}-${playVar}${m}"
+ }
+
+ Seq(
+ "com.typesafe.play" %% "play" % playVer % Provided,
+ "org.reactivemongo" %% "play2-reactivemongo" % playRmVer % Provided,
+ "org.specs2" %% "specs2-core" % specsVer.value % Test
+ )
+ }
}
)).dependsOn(scalacPlugin, self.project)
diff --git a/project/deploy.sh b/project/deploy.sh
index 40f18aaa..175559e4 100755
--- a/project/deploy.sh
+++ b/project/deploy.sh
@@ -46,7 +46,7 @@ if [ "_$JAVA_MODULES" = "_" ]; then
JAVA_MODULES="jdbc-driver"
fi
-#EXTRA_JAVA_MODULES="jdbc-java8"
+EXTRA_JAVA_MODULES="jdbc-java8"
if [ "_$SCALA_MODULES" = "_" ]; then
SCALA_MODULES="jdbc-scala scalac-plugin reactive-mongo play-jdbc play-reactive-mongo"
diff --git a/reactive-mongo/src/main/scala/Akka.scala b/reactive-mongo/src/main/scala/Akka.scala
index a80d8c5f..87e7f80a 100644
--- a/reactive-mongo/src/main/scala/Akka.scala
+++ b/reactive-mongo/src/main/scala/Akka.scala
@@ -36,7 +36,7 @@ private[reactivemongo] class Actor(handler: ConnectionHandler)
val name = "AcolyteConnection"
lazy val seeds = Seq.empty[String]
- val options = reactivemongo.api.MongoConnectionOptions()
+ lazy val options = reactivemongo.api.MongoConnectionOptions()
protected def sendAuthenticate(connection: Connection, authentication: Authenticate): Connection = connection
@@ -154,7 +154,7 @@ private[reactivemongo] class Actor(handler: ConnectionHandler)
}
case msg ⇒
- println(s"message = $msg")
+ //println(s"message = $msg")
//next forward msg
()
diff --git a/studio/pom.xml b/studio/pom.xml
index cf5add8d..b8460093 100644
--- a/studio/pom.xml
+++ b/studio/pom.xml
@@ -4,7 +4,7 @@
studio
jar
Acolyte Studio
- 1.0.45-SNAPSHOT
+ 1.0.52
https://github.com/cchantep/acolyte/