diff --git a/.travis.yml b/.travis.yml index 8cca23069a..077c05a674 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,9 @@ matrix: - jdk: oraclejdk8 scala: 2.12.6 env: COVERAGE= + - jdk: oraclejdk8 + scala: 2.13.0-M4 + env: COVERAGE= - jdk: oraclejdk10 scala: 2.12.6 env: COVERAGE= diff --git a/build.sbt b/build.sbt index 930e43e660..3cb912c586 100644 --- a/build.sbt +++ b/build.sbt @@ -18,6 +18,7 @@ import microsites.ExtraMdFileConfig import scala.sys.process._ import scala.xml.Elem import scala.xml.transform.{RewriteRule, RuleTransformer} +import sbtcrossproject.crossProject organization in ThisBuild := "org.typelevel" organizationName in ThisBuild := "Typelevel" @@ -25,12 +26,33 @@ startYear in ThisBuild := Some(2017) val CompileTime = config("CompileTime").hide -val CatsVersion = "1.1.0" -val SimulacrumVersion = "0.11.0" +val CatsVersion = "1.2.0" +val SimulacrumVersion = "0.13.0" -val ScalaTestVersion = "3.0.5" -val ScalaCheckVersion = "1.13.5" -val DisciplineVersion = "0.8" +val ScalaTestVersion = Def.setting{ + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + "3.0.5" + case _ => + "3.0.6-SNAP1" + } +} +val ScalaCheckVersion = Def.setting{ + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + "1.13.5" + case _ => + "1.14.0" + } +} +val DisciplineVersion = Def.setting{ + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + "0.9.0" + case _ => + "0.10.0" + } +} addCommandAlias("ci", ";test ;mimaReportBinaryIssues; doc") addCommandAlias("release", ";project root ;reload ;+publishSigned ;sonatypeReleaseAll ;microsite/publishMicrosite") @@ -38,7 +60,24 @@ addCommandAlias("release", ";project root ;reload ;+publishSigned ;sonatypeRelea val commonSettings = Seq( scalaVersion := "2.12.6", - crossScalaVersions := Seq("2.11.12", "2.12.6"), + crossScalaVersions := Seq("2.11.12", "2.12.6", "2.13.0-M4"), + + //todo: re-enable disable scaladoc on 2.13 due to https://github.com/scala/bug/issues/11045 + sources in (Compile, doc) := ( + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + (sources in (Compile, doc)).value + case _ => + Nil + } + ), + + scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)) { + case Some((2, n)) if n >= 13 => + Seq( + "-Ymacro-annotations" + ) + }.toList.flatten, scalacOptions in (Compile, console) ~= (_ filterNot Set("-Xfatal-warnings", "-Ywarn-unused-import").contains), @@ -136,11 +175,18 @@ val commonSettings = Seq( }).transform(node).head }, - addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.5" cross CrossVersion.binary) + addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.7" cross CrossVersion.binary) ) val mimaSettings = Seq( - mimaPreviousArtifacts := Set(organization.value %% name.value % "0.10"), + mimaPreviousArtifacts := { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + Set(organization.value %% name.value % "0.10") + case _ => + Set.empty + } + }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ import com.typesafe.tools.mima.core.ProblemFilters._ @@ -337,7 +383,7 @@ lazy val root = project.in(file(".")) .configure(profile) .settings(skipOnPublishSettings) -lazy val core = crossProject.in(file("core")) +lazy val core = crossProject(JSPlatform, JVMPlatform).in(file("core")) .settings(commonSettings: _*) .settings( name := "cats-effect", @@ -346,12 +392,23 @@ lazy val core = crossProject.in(file("core")) "org.typelevel" %%% "cats-core" % CatsVersion, "com.github.mpilquist" %%% "simulacrum" % SimulacrumVersion % CompileTime, - "org.typelevel" %%% "cats-laws" % CatsVersion % "test", - "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test", - "org.scalacheck" %%% "scalacheck" % ScalaCheckVersion % "test", - "org.typelevel" %%% "discipline" % DisciplineVersion % "test"), - - addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)) + "org.typelevel" %%% "cats-laws" % CatsVersion % "test", + "org.scalatest" %%% "scalatest" % ScalaTestVersion.value % "test", + "org.scalacheck" %%% "scalacheck" % ScalaCheckVersion.value % "test", + "org.typelevel" %%% "discipline" % DisciplineVersion.value % "test"), + + libraryDependencies ++= { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + Seq( + compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) + ) + case _ => + // if scala 2.13.0-M4 or later, macro annotations merged into scala-reflect + // https://github.com/scala/scala/pull/6606 + Nil + } + }) .jvmConfigure(_.enablePlugins(AutomateHeaderPlugin)) .jvmConfigure(_.settings(mimaSettings)) .jsConfigure(_.enablePlugins(AutomateHeaderPlugin)) @@ -361,7 +418,7 @@ lazy val core = crossProject.in(file("core")) lazy val coreJVM = core.jvm lazy val coreJS = core.js -lazy val laws = crossProject +lazy val laws = crossProject(JSPlatform, JVMPlatform) .in(file("laws")) .dependsOn(core % "compile->compile;test->test") .settings(commonSettings: _*) @@ -370,10 +427,10 @@ lazy val laws = crossProject libraryDependencies ++= Seq( "org.typelevel" %%% "cats-laws" % CatsVersion, - "org.scalacheck" %%% "scalacheck" % ScalaCheckVersion, - "org.typelevel" %%% "discipline" % DisciplineVersion, + "org.scalacheck" %%% "scalacheck" % ScalaCheckVersion.value, + "org.typelevel" %%% "discipline" % DisciplineVersion.value, - "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test")) + "org.scalatest" %%% "scalatest" % ScalaTestVersion.value % "test")) .jvmConfigure(_.enablePlugins(AutomateHeaderPlugin)) .jsConfigure(_.enablePlugins(AutomateHeaderPlugin)) .jvmConfigure(profile) @@ -499,10 +556,19 @@ scalacOptions in ThisBuild ++= Seq( "-encoding", "UTF-8", // yes, this is 2 args "-feature", "-unchecked", - "-Xfatal-warnings", - "-Yno-adapted-args", - "-Ywarn-dead-code", - "-Ypartial-unification" + "-Ywarn-dead-code" +) + +scalacOptions in ThisBuild ++= ( + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => Seq( + "-Xfatal-warnings", + "-Yno-adapted-args", + "-Ypartial-unification" + ) + case _ => + Nil + } ) scalacOptions in ThisBuild ++= { diff --git a/core/shared/src/main/scala/cats/effect/Sync.scala b/core/shared/src/main/scala/cats/effect/Sync.scala index a6fc26f694..8d2416f469 100644 --- a/core/shared/src/main/scala/cats/effect/Sync.scala +++ b/core/shared/src/main/scala/cats/effect/Sync.scala @@ -155,7 +155,7 @@ object Sync { fa.flatMap(f) def tailRecM[A, B](a: A)(f: A => OptionT[F, Either[A, B]]): OptionT[F, B] = - OptionT.catsDataMonadForOptionT[F].tailRecM(a)(f) + OptionT.catsDataMonadErrorForOptionT[F, Throwable].tailRecM(a)(f) def suspend[A](thunk: => OptionT[F, A]): OptionT[F, A] = OptionT(F.suspend(thunk.value)) diff --git a/project/plugins.sbt b/project/plugins.sbt index c6cbe68ba6..770138271e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,9 +4,10 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.0.0") addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0") -addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.16") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")