diff --git a/.ci_scripts/validate.sh b/.ci_scripts/validate.sh index 65986fd..fad50b3 100755 --- a/.ci_scripts/validate.sh +++ b/.ci_scripts/validate.sh @@ -15,4 +15,4 @@ false echo "[INFO] Running tests" >> /dev/stdout -sbt ++$TRAVIS_SCALA_VERSION testOnly +sbt ++$TRAVIS_SCALA_VERSION test diff --git a/project/scalafmt.conf b/.scalafmt.conf similarity index 100% rename from project/scalafmt.conf rename to .scalafmt.conf diff --git a/.travis.yml b/.travis.yml index 60f0b9d..d0da791 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ sudo: false language: scala +scala: + - 2.12.7 + - 2.11.12 jdk: - oraclejdk8 -scala: 2.12.4 cache: directories: - - $HOME/.ivy2 - - $HOME/.sbt -script: ./.ci_scripts/validate.sh \ No newline at end of file + - $HOME/.ivy2 + - $HOME/.sbt +script: ./.ci_scripts/validate.sh diff --git a/build.sbt b/build.sbt index a82e884..398fb2a 100644 --- a/build.sbt +++ b/build.sbt @@ -1,16 +1,12 @@ -import Dependencies._ - name := "query-monad-code" version := "1.0-SNAPSHOT" -scalaVersion in ThisBuild := "2.12.6" +ThisBuild / scalaVersion := "2.12.7" +ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.7") -// Common values -val commonSettings = Seq( - organization := "com.zengularity", - crossPaths := false, - scalacOptions ++= Seq( +def scalacOptionsVersion(scalaVersion: String) = { + val defaultOptions = Seq( "-deprecation", // Emit warning and location for usages of deprecated APIs. "-encoding", "utf-8", // Specify character encoding used by source files. @@ -23,7 +19,6 @@ val commonSettings = Seq( "-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver. "-Ypartial-unification", // Enable partial unification in type constructor inference "-Ywarn-dead-code", // Warn when dead code is identified. - "-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined. "-Ywarn-inaccessible", // Warn about inaccessible types in method signatures. "-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`. "-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. @@ -31,7 +26,25 @@ val commonSettings = Seq( "-Ywarn-numeric-widen", // Warn when numerics are widened. "-Ywarn-unused", // Warn if unused. "-Ywarn-value-discard" // Warn when non-Unit expression results are unused. - ), + ) + val v211Options = Seq( + "-Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11 + ) + val v212Options = Seq( + "-Ywarn-extra-implicit" // Warn when more than one implicit parameter section is defined. + ) + + CrossVersion.partialVersion(scalaVersion) match { + case Some((2L, 11L)) => defaultOptions ++ v211Options + case _ => defaultOptions ++ v212Options + } +} + +// Common values +def commonSettings = Seq( + organization := "com.zengularity", + crossPaths := false, + scalacOptions ++= scalacOptionsVersion(scalaVersion.value), scalacOptions in (Compile, console) ~= (_.filterNot( Set( "-Ywarn-unused:imports", @@ -51,12 +64,9 @@ val commonSettings = Seq( ) // Scalafmt -scalafmtOnCompile in ThisBuild := true -scalafmtOnCompile := true -scalafmtTestOnCompile in ThisBuild := true -scalafmtTestOnCompile := true -scalafmtConfig in ThisBuild := file("project/scalafmt.conf") +ThisBuild / scalafmtOnCompile := true +// Wartremover wartremoverErrors ++= Warts.unsafe // diff --git a/examples/todo-app/app/controller/TodoController.scala b/examples/todo-app/app/controller/TodoController.scala index 49873ec..7ab6936 100644 --- a/examples/todo-app/app/controller/TodoController.scala +++ b/examples/todo-app/app/controller/TodoController.scala @@ -91,7 +91,7 @@ class TodoController( ConnectedAction.async { implicit request => check(login) { val query = for { - - <- SqlQueryT.fromQuery[ErrorOrResult, Todo]( + _ <- SqlQueryT.fromQuery[ErrorOrResult, Todo]( todoStore .getTodo(todoId) .map(_.toRight("Todo doesn't exist")) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6ebd52e..3489b80 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,17 +5,17 @@ object Dependencies { lazy val acolytePlay = "org.eu.acolyte" %% "play-jdbc" % "1.0.51" - lazy val anorm = "org.playframework.anorm" %% "anorm" % "2.6.0" + lazy val anorm = "org.playframework.anorm" %% "anorm" % "2.6.2" - lazy val cats = "org.typelevel" %% "cats-core" % "1.0.1" + lazy val cats = "org.typelevel" %% "cats-core" % "1.4.0" - lazy val h2 = "com.h2database" % "h2" % "1.4.196" - - lazy val postgres = "org.postgresql" % "postgresql" % "42.2.2" + lazy val h2 = "com.h2database" % "h2" % "1.4.197" + + lazy val postgres = "org.postgresql" % "postgresql" % "42.2.5" lazy val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.0" - lazy val specs2 = "org.specs2" %% "specs2-core" % "4.0.2" + lazy val specs2 = "org.specs2" %% "specs2-core" % "4.3.5" lazy val jbcrypt = "org.mindrot" % "jbcrypt" % "0.4" } diff --git a/project/build.properties b/project/build.properties index 5620cc5..7c58a83 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.1 +sbt.version=1.2.6 diff --git a/project/plugins.sbt b/project/plugins.sbt index 3925da4..7d45aef 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,10 +1,5 @@ -val neoScalafmtVersion = "1.14" -addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % neoScalafmtVersion) -// addSbtPlugin("com.lucidchart" % "sbt-scalafmt-coursier" % neoScalafmtVersion) +addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1") +addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.3.7") -// The Play plugin -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.10") - -// addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13") - -addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.2.1") +// The Play plugin, used for the play-sql module +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.20")