Skip to content

Commit

Permalink
Update to Scala 2.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guersam committed Nov 13, 2016
1 parent d10a81f commit 5da0a07
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jdk:
scala:
- 2.10.6
- 2.11.8
- 2.12.0-RC2
- 2.12.0

env:
global:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ libraryDependencies += "org.tpolecat" %% "doobie-core" % "0.3.0" // or any suppo
If you are using Scala 2.10 you must also add the paradise compiler plugin.

```scala
addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full)
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
```

It is likely that you will want one or more add-on libraries. **doobie** provides the following, which have the same version as `doobie-core` and are released together.
Expand All @@ -73,7 +73,7 @@ The current development milestone is **0.3.1-M1**, and the changing version is *

### Cats Support

The `0.3.1-SNAPSHOT` release is [also] compiled for [Cats 0.7.2](http://typelevel.org/cats/) with [FS2 0.9.0](https://github.com/functional-streams-for-scala/fs2) for **2.11 only** (FS2 isn't available for 2.10 and Cats isn't available for 2.12).
The `0.3.1-SNAPSHOT` release is [also] compiled for [Cats 0.8.1](http://typelevel.org/cats/) with [FS2 0.9.2](https://github.com/functional-streams-for-scala/fs2) for 2.11 and 2.12 (FS2 isn't available for 2.10).

Doc links for Cats artifacts (no unidoc yet, sorry):
[core](https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/tpolecat/doobie-core_2.11/0.3.1-SNAPSHOT/doobie-core_2.11-0.3.1-SNAPSHOT-javadoc.jar/!/index.html)
Expand Down
62 changes: 26 additions & 36 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lazy val buildSettings = Seq(
organization := "org.tpolecat",
licenses ++= Seq(("MIT", url("http://opensource.org/licenses/MIT"))),
scalaVersion := "2.11.8",
crossScalaVersions := Seq(scalaVersion.value, "2.12.0-RC2")
crossScalaVersions := Seq(scalaVersion.value, "2.12.0")
)

lazy val scalazCrossSettings = Seq(
Expand Down Expand Up @@ -41,11 +41,11 @@ lazy val commonSettings = Seq(
"-skip-packages", "scalaz"
),
libraryDependencies ++= macroParadise(scalaVersion.value) ++ Seq(
"org.scalacheck" %% "scalacheck" % "1.13.3" % "test",
"org.specs2" %% "specs2-core" % "3.8.5.1" % "test",
"org.specs2" %% "specs2-scalacheck" % "3.8.5.1" % "test"
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test",
"org.specs2" %% "specs2-core" % "3.8.6" % "test",
"org.specs2" %% "specs2-scalacheck" % "3.8.6" % "test"
),
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.2")
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")
)

lazy val publishSettings = osgiSettings ++ Seq(
Expand Down Expand Up @@ -126,30 +126,14 @@ lazy val doobie = project.in(file("."))
}
)

// Temporarily skip tut for Scala 2.12
// TODO remove after tut-core and argonaut for Scala 2.12 is released
lazy val docSkipScala212Settings = Seq(
libraryDependencies ++= {
val circeVersion = "0.6.0-RC1"
Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser"
).map(_ % circeVersion) ++ (
if (scalaVersion.value startsWith "2.12") Nil
else Seq("io.argonaut" %% "argonaut" % "6.2-M3")
)
}
)

lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)

def macroParadise(v: String): List[ModuleID] =
if (v.startsWith("2.10")) List(compilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full))
if (v.startsWith("2.10")) List(compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full))
else Nil

lazy val ctut = taskKey[Unit]("Copy tut output to blog repo nearby.")
Expand All @@ -168,7 +152,6 @@ def coreSettings(mod: String) =
"com.chuusai" %% "shapeless" % "2.3.2"
),
scalacOptions += "-Yno-predef",
resolvers += Resolver.sonatypeRepo("snapshots"),
sourceGenerators in Compile += Def.task {
val outDir = (sourceManaged in Compile).value / "doobie"
val outFile = new File(outDir, "buildinfo.scala")
Expand Down Expand Up @@ -196,27 +179,27 @@ lazy val core = project.in(file("modules/core"))
yax(file("yax/core"), "scalaz"),
coreSettings("core"),
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.2.6",
"org.scalaz" %% "scalaz-effect" % "7.2.6",
"org.scalaz.stream" %% "scalaz-stream" % "0.8.5a",
"com.h2database" % "h2" % "1.4.192" % "test"
"org.scalaz" %% "scalaz-core" % "7.2.7",
"org.scalaz" %% "scalaz-effect" % "7.2.7",
"org.scalaz.stream" %% "scalaz-stream" % "0.8.6a",
"com.h2database" % "h2" % "1.4.193" % "test"
),
scalazCrossSettings
)

val catsVersion = "0.8.0"
val catsVersion = "0.8.1"
lazy val core_cats = project.in(file("modules-cats/core"))
.enablePlugins(SbtOsgi)
.settings(
yax(file("yax/core"), "cats", "fs2"),
coreSettings("core-cats"),
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "0.9.1",
"co.fs2" %% "fs2-cats" % "0.1.1-SNAPSHOT",
"co.fs2" %% "fs2-core" % "0.9.2",
"co.fs2" %% "fs2-cats" % "0.2.0",
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-free" % catsVersion,
"org.typelevel" %% "cats-laws" % catsVersion % "test",
"com.h2database" % "h2" % "1.3.170" % "test"
"com.h2database" % "h2" % "1.4.193" % "test"
)
)

Expand Down Expand Up @@ -289,7 +272,7 @@ def h2Settings(mod: String): Seq[Setting[_]] =
publishSettings ++ Seq(
name := "doobie-" + mod,
description := "H2 support for doobie.",
libraryDependencies += "com.h2database" % "h2" % "1.3.170"
libraryDependencies += "com.h2database" % "h2" % "1.4.193"
)

lazy val h2 = project.in(file("modules/h2"))
Expand Down Expand Up @@ -417,11 +400,18 @@ lazy val bench_cats = project.in(file("modules-cats/bench"))
/// DOCS
///

val circeVersion = "0.6.0"

def docsSettings(token: String, tokens: String*): Seq[Setting[_]] =
doobieSettings ++
noPublishSettings ++
tutSettings ++
docSkipScala212Settings ++ Seq(
doobieSettings ++
noPublishSettings ++
tutSettings ++ Seq(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.argonaut" %% "argonaut" % "6.2-RC1"
),
ctut := {
val src = crossTarget.value / "tut"
val dst = file("../tpolecat.github.io/_doobie-" + token + "-" + version.value + "/")
Expand Down
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ resolvers += Resolver.url(
url("http://dl.bintray.com/content/tpolecat/sbt-plugin-releases"))(
Resolver.ivyStylePatterns)

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.5")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.6")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.5.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.8.0")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14-6")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14-7")
2 changes: 1 addition & 1 deletion project/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14-6")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14-7")
6 changes: 3 additions & 3 deletions sbt
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ declare -r default_jvm_opts_common="-Xms512m -Xmx1536m -Xss2m $jit_opts $cms_opt
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
declare -r latest_28="2.8.2"
declare -r latest_29="2.9.3"
declare -r latest_210="2.10.5"
declare -r latest_211="2.11.7"
declare -r latest_212="2.12.0-M3"
declare -r latest_210="2.10.6"
declare -r latest_211="2.11.8"
declare -r latest_212="2.12.0"

declare -r script_path="$(get_script_path "$BASH_SOURCE")"
declare -r script_name="${script_path##*/}"
Expand Down
7 changes: 1 addition & 6 deletions yax/core/src/main/scala/doobie/hi/preparedstatement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ object preparedstatement {

/** @group Batching */
val executeBatch: PreparedStatementIO[List[Int]] =
PS.executeBatch.map(arr =>
// `Predef.intArrayOps` is not implicit as of Scala 2.12.0-M3
// https://github.com/scala/scala/blob/v2.12.0-M3/src/library/scala/Predef.scala#L336
// TODO replace with `_.toList` after it gets back
intArrayOps(arr).toList
)
PS.executeBatch.map(_.toList)

/** @group Batching */
val addBatch: PreparedStatementIO[Unit] =
Expand Down
7 changes: 1 addition & 6 deletions yax/core/src/main/scala/doobie/hi/statement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ object statement {

/** @group Execution */
val executeBatch: StatementIO[List[Int]] =
S.executeBatch.map(arr =>
// `Predef.intArrayOps` is not implicit as of Scala 2.12.0-M3
// https://github.com/scala/scala/blob/v2.12.0-M3/src/library/scala/Predef.scala#L336
// TODO replace with `_.toList` after it gets back
intArrayOps(arr).toList
)
S.executeBatch.map(_.toList)

/** @group Execution */
def executeQuery[A](sql: String)(k: ResultSetIO[A]): StatementIO[A] =
Expand Down
4 changes: 2 additions & 2 deletions yax/docs/src/main/tut/10-Custom-Mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ The examples in this chapter require the `postgres` add-on, as well as the [circ

```scala
#+scalaz
libraryDependencies += "io.argonaut" %% "argonaut" % "6.2-M3" // as of date of publication
libraryDependencies += "io.argonaut" %% "argonaut" % "6.2-RC1" // as of date of publication
#-scalaz
#+cats
val circeVersion = "0.5.3"
val circeVersion = "0.6.0"

libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
Expand Down

0 comments on commit 5da0a07

Please sign in to comment.