Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scala 2.12.0-RC1 #1382

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ git:
depth: 9999

scala:
- 2.10.6
- 2.11.8
- 2.10.6
- 2.11.8

jdk:
- oraclejdk7

matrix:
include:
- scala: 2.12.0-RC1
jdk: oraclejdk8

script:
- scripts/travis-publish.sh
Expand Down
124 changes: 88 additions & 36 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,20 @@ import com.typesafe.sbt.SbtSite.SiteKeys._
import com.typesafe.sbt.SbtGhPages.GhPagesKeys._
import sbtunidoc.Plugin.UnidocKeys._
import ReleaseTransformations._
import ScoverageSbtPlugin._
import scala.xml.transform.{RewriteRule, RuleTransformer}
import org.scalajs.sbtplugin.cross.CrossProject

lazy val botBuild = settingKey[Boolean]("Build by TravisCI instead of local dev environment")

lazy val scoverageSettings = Seq(
ScoverageKeys.coverageMinimum := 60,
ScoverageKeys.coverageFailOnMinimum := false,
ScoverageKeys.coverageHighlighting := scalaBinaryVersion.value != "2.10",
ScoverageKeys.coverageExcludedPackages := "cats\\.bench\\..*",
// don't include scoverage as a dependency in the pom
// see issue #980
// this code was copied from https://github.com/mongodb/mongo-spark
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(
new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] = node match {
case e: xml.Elem
if e.label == "dependency" && e.child.exists(child => child.label == "groupId" && child.text == "org.scoverage") => Nil
case _ => Seq(node)

}

}).transform(node).head
}
coverageMinimum := 60,
coverageFailOnMinimum := false
)

lazy val buildSettings = Seq(
organization := "org.typelevel",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.10.6", "2.11.8")
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0-RC1")
)

lazy val catsDoctestSettings = Seq(
Expand All @@ -48,7 +31,7 @@ lazy val kernelSettings = Seq(
Resolver.sonatypeRepo("snapshots")),
parallelExecution in Test := false,
scalacOptions in (Compile, doc) := (scalacOptions in (Compile, doc)).value.filter(_ != "-Xfatal-warnings")
) ++ warnUnusedImport
) ++ warnUnusedImport ++ update2_12

lazy val commonSettings = Seq(
incOptions := incOptions.value.withLogRecompileOnMacro(false),
Expand All @@ -59,17 +42,17 @@ lazy val commonSettings = Seq(
Resolver.sonatypeRepo("snapshots")
),
libraryDependencies ++= Seq(
"com.github.mpilquist" %%% "simulacrum" % "0.8.0",
"org.typelevel" %%% "machinist" % "0.4.1",
"com.github.mpilquist" %%% "simulacrum" % "0.9.0",
"org.typelevel" %%% "machinist" % "0.5.0",
compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full),
compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.0")
),
fork in test := true,
fork in test := false, //true,
parallelExecution in Test := false,
scalacOptions in (Compile, doc) := (scalacOptions in (Compile, doc)).value.filter(_ != "-Xfatal-warnings"),
// workaround for https://github.com/scalastyle/scalastyle-sbt-plugin/issues/47
(scalastyleSources in Compile) <++= unmanagedSourceDirectories in Compile
) ++ warnUnusedImport
) ++ warnUnusedImport ++ update2_12

lazy val tagName = Def.setting{
s"v${if (releaseUseGlobalVersion.value) (version in ThisBuild).value else version.value}"
Expand Down Expand Up @@ -117,15 +100,15 @@ lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ sc

lazy val scalaCheckVersion = "1.13.2"
lazy val scalaTestVersion = "3.0.0"
lazy val disciplineVersion = "0.6"
lazy val disciplineVersion = "0.7"

lazy val disciplineDependencies = Seq(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion,
libraryDependencies += "org.typelevel" %%% "discipline" % disciplineVersion)

lazy val testingDependencies = Seq(
libraryDependencies += "org.typelevel" %%% "catalysts-platform" % "0.0.2",
libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.2" % "test",
libraryDependencies += "org.typelevel" %%% "catalysts-platform" % "0.0.3",
libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.3" % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % "test")


Expand Down Expand Up @@ -176,6 +159,7 @@ lazy val docs = project
.settings(tutSettings)
.settings(tutScalacOptions ~= (_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-dead-code"))))
.settings(commonJvmSettings)
.settings(fix2_12:_*)
.dependsOn(coreJVM, freeJVM)

lazy val cats = project.in(file("."))
Expand All @@ -189,7 +173,7 @@ lazy val catsJVM = project.in(file(".catsJVM"))
.settings(moduleName := "cats")
.settings(catsSettings)
.settings(commonJvmSettings)
.aggregate(macrosJVM, kernelJVM, kernelLawsJVM, coreJVM, lawsJVM, freeJVM, testsJVM, jvm, docs, bench)
.aggregate(macrosJVM, kernelJVM, kernelLawsJVM, coreJVM, lawsJVM, freeJVM, testsJVM, jvm, docs) //, bench)
.dependsOn(macrosJVM, kernelJVM, kernelLawsJVM, coreJVM, lawsJVM, freeJVM, testsJVM % "test-internal -> test", jvm, bench % "compile-internal;test-internal -> test")

lazy val catsJS = project.in(file(".catsJS"))
Expand All @@ -207,6 +191,7 @@ lazy val macros = crossProject.crossType(CrossType.Pure)
.settings(catsSettings:_*)
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
.jsSettings(coverageEnabled := false)
.settings(scalacOptions := scalacOptions.value.filter(_ != "-Xfatal-warnings"))

lazy val macrosJVM = macros.jvm
Expand Down Expand Up @@ -236,8 +221,10 @@ lazy val kernelLaws = crossProject.crossType(CrossType.Pure)
.settings(scoverageSettings: _*)
.settings(disciplineDependencies: _*)
.settings(testingDependencies: _*)
.settings(fix2_12:_*)
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
.jsSettings(coverageEnabled := false)
.dependsOn(kernel)

lazy val kernelLawsJVM = kernelLaws.jvm
Expand All @@ -249,6 +236,9 @@ lazy val core = crossProject.crossType(CrossType.Pure)
.settings(catsSettings:_*)
.settings(sourceGenerators in Compile <+= (sourceManaged in Compile).map(Boilerplate.gen))
.settings(includeGeneratedSrc)
.settings(fix2_12:_*)
.configure(disableScoverage210Jvm)
.configure(disableScoverage210Js)
.settings(libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % "test")
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
Expand All @@ -261,9 +251,11 @@ lazy val laws = crossProject.crossType(CrossType.Pure)
.settings(moduleName := "cats-laws")
.settings(catsSettings:_*)
.settings(disciplineDependencies:_*)
.settings(libraryDependencies ++= Seq("org.typelevel" %%% "catalysts-platform" % "0.0.2"))
.configure(disableScoverage210Jvm)
.settings(libraryDependencies ++= Seq("org.typelevel" %%% "catalysts-platform" % "0.0.3"))
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
.jsSettings(coverageEnabled := false)

lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js
Expand All @@ -274,6 +266,7 @@ lazy val free = crossProject.crossType(CrossType.Pure)
.settings(catsSettings:_*)
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
.settings(fix2_12:_*)

lazy val freeJVM = free.jvm
lazy val freeJS = free.js
Expand All @@ -287,18 +280,21 @@ lazy val tests = crossProject.crossType(CrossType.Pure)
.settings(testingDependencies: _*)
.jsSettings(commonJsSettings:_*)
.jvmSettings(commonJvmSettings:_*)
.settings(fix2_12:_*)

lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js

// bench is currently JVM-only

lazy val bench = project.dependsOn(macrosJVM, coreJVM, freeJVM, lawsJVM)
.settings(moduleName := "cats-bench")
.settings(catsSettings)
.settings(noPublishSettings)
.settings(commonJvmSettings)
.settings(coverageEnabled := false)
.settings(libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.2.5"))
"org.scalaz" %% "scalaz-core" % "7.2.6"))
.enablePlugins(JmhPlugin)

// cats-js is JS-only
Expand All @@ -307,6 +303,7 @@ lazy val js = project
.settings(moduleName := "cats-js")
.settings(catsSettings:_*)
.settings(commonJsSettings:_*)
.configure(disableScoverage210Js)
.enablePlugins(ScalaJSPlugin)


Expand Down Expand Up @@ -402,7 +399,7 @@ lazy val publishSettings = Seq(
// These aliases serialise the build for the benefit of Travis-CI.
addCommandAlias("buildJVM", "catsJVM/test")

addCommandAlias("validateJVM", ";scalastyle;buildJVM;makeSite")
addCommandAlias("validateJVM", ";scalastyle;buildJVM") //;makeSite") <--- TODO

addCommandAlias("validateJS", ";catsJS/compile;testsJS/test;js/test")

Expand Down Expand Up @@ -444,8 +441,8 @@ lazy val scalaMacroDependencies: Seq[Setting[_]] = Seq(
// in Scala 2.10, quasiquotes are provided by macro paradise
case Some((2, 10)) =>
Seq(
compilerPlugin("org.scalamacros" %% "paradise" % "2.0.1" cross CrossVersion.full),
"org.scalamacros" %% "quasiquotes" % "2.0.1" cross CrossVersion.binary
compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full),
"org.scalamacros" %% "quasiquotes" % "2.1.0" cross CrossVersion.binary
)
}
}
Expand All @@ -462,7 +459,6 @@ lazy val commonScalacOptions = Seq(
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yinline-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
Expand Down Expand Up @@ -522,3 +518,59 @@ lazy val credentialSettings = Seq(
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)

def disableScoverage210Js(crossProject: CrossProject) =
crossProject
.jsSettings(
coverageEnabled := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => false
case _ => coverageEnabled.value
}
}
)

def disableScoverage210Js: Project ⇒ Project = p =>
p.settings(
coverageEnabled := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => false
case _ => coverageEnabled.value
}
}
)

def disableScoverage210Jvm(crossProject: CrossProject) =
crossProject
.jvmSettings(
coverageEnabled := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => false
case _ => coverageEnabled.value
}
}
)

lazy val update2_12 = Seq(
scalacOptions -= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => "-Yinline-warnings"
case _ => ""
}
}
)

lazy val fix2_12 = Seq(
scalacOptions -= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => "-Xfatal-warnings"
case _ => ""
}
},
scalacOptions in (ScalaUnidoc, unidoc) -= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => "-Xfatal-warnings"
case _ => ""
}
}
)
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/Eval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ sealed abstract class Eval[+A] extends Serializable { self =>
case c: Eval.Compute[A] =>
new Eval.Compute[B] {
type Start = c.Start
val start = c.start
val run = (s: c.Start) =>
val start: () => Eval[Start] = c.start
val run: Start => Eval[B] = (s: c.Start) =>
new Eval.Compute[B] {
type Start = A
val start = () => c.run(s)
Expand Down
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.9")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.11")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.4")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.15")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0-RC1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.11")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.4.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
9 changes: 9 additions & 0 deletions scripts/publishLocalSbtScoverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#

set -euo pipefail

cd "${TMPDIR:-/tmp}"
git clone -b topic/2-12 "https://github.com/BennyHill/sbt-scoverage.git"
( cd sbt-scoverage && sbt -sbt-version 0.13.13-M1 publishLocal)
rm -rf sbt-scoverage
10 changes: 10 additions & 0 deletions scripts/publishLocalScoverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
#

set -euo pipefail

cd "${TMPDIR:-/tmp}"
git clone -b tl-2-12 "https://github.com/BennyHill/scalac-scoverage-plugin.git"
( cd scalac-scoverage-plugin && sbt -sbt-version 0.13.13-M1 ++2.10.6 publishLocal ++2.11.8 publishLocal ++2.12.0-RC1 publishLocal )
rm -rf scalac-scoverage-plugin