Skip to content

Commit

Permalink
Scala 2.13.0-M4
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Aug 4, 2018
1 parent 00d4473 commit a021d5e
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -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=
Expand Down
112 changes: 89 additions & 23 deletions build.sbt
Expand Up @@ -18,27 +18,66 @@ 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"
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")

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),

Expand Down Expand Up @@ -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._
Expand Down Expand Up @@ -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",
Expand All @@ -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))
Expand All @@ -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: _*)
Expand All @@ -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)
Expand Down Expand Up @@ -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 ++= {
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/cats/effect/Sync.scala
Expand Up @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions project/plugins.sbt
Expand Up @@ -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")

0 comments on commit a021d5e

Please sign in to comment.