From b5665ad0d44ffeeb0aab72712c74f89464e8e912 Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Tue, 20 Sep 2016 01:02:34 +0200 Subject: [PATCH 1/3] Add scala 2.12.0-RC1 --- .travis.yml | 6 ++ build.sbt | 118 +++++++++++++++++++--------- core/src/main/scala/cats/Eval.scala | 4 +- project/plugins.sbt | 8 +- scripts/publishLocalSbtScoverage.sh | 9 +++ scripts/publishLocalScoverage.sh | 10 +++ 6 files changed, 113 insertions(+), 42 deletions(-) create mode 100755 scripts/publishLocalSbtScoverage.sh create mode 100755 scripts/publishLocalScoverage.sh diff --git a/.travis.yml b/.travis.yml index 9232abd800..da5e0f3cc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,14 @@ git: scala: - 2.10.6 - 2.11.8 +- 2.12.0-RC1 + +jdk: + - oraclejdk8 script: + - scripts/publishLocalScoverage.sh + - scripts/publishLocalSbtScoverage.sh - scripts/travis-publish.sh # http://austinpray.com/ops/2015/09/20/change-travis-node-version.html diff --git a/build.sbt b/build.sbt index 291ad6fa7c..1ed8739ca5 100644 --- a/build.sbt +++ b/build.sbt @@ -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( @@ -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), @@ -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}" @@ -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-SNAPSHOT", + libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.3-SNAPSHOT" % "test", libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % "test") @@ -183,14 +166,14 @@ lazy val cats = project.in(file(".")) .settings(catsSettings) .settings(noPublishSettings) .aggregate(catsJVM, catsJS) - .dependsOn(catsJVM, catsJS, testsJVM % "test-internal -> test", bench % "compile-internal;test-internal -> test") + .dependsOn(catsJVM, catsJS, testsJVM % "test-internal -> test")//, bench % "compile-internal;test-internal -> test") 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) - .dependsOn(macrosJVM, kernelJVM, kernelLawsJVM, coreJVM, lawsJVM, freeJVM, testsJVM % "test-internal -> test", jvm, bench % "compile-internal;test-internal -> test") + .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")) .settings(moduleName := "cats") @@ -207,6 +190,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 @@ -236,8 +220,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 @@ -249,6 +235,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:_*) @@ -261,9 +250,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-SNAPSHOT")) .jsSettings(commonJsSettings:_*) .jvmSettings(commonJvmSettings:_*) + .jsSettings(coverageEnabled := false) lazy val lawsJVM = laws.jvm lazy val lawsJS = laws.js @@ -274,6 +265,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 @@ -287,19 +279,23 @@ 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")) .enablePlugins(JmhPlugin) + */ // cats-js is JS-only lazy val js = project @@ -307,6 +303,7 @@ lazy val js = project .settings(moduleName := "cats-js") .settings(catsSettings:_*) .settings(commonJsSettings:_*) + .configure(disableScoverage210Js) .enablePlugins(ScalaJSPlugin) @@ -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 ) } } @@ -462,7 +459,6 @@ lazy val commonScalacOptions = Seq( "-unchecked", "-Xfatal-warnings", "-Xlint", - "-Yinline-warnings", "-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", @@ -522,3 +518,53 @@ 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 _ => "" + } + } +) diff --git a/core/src/main/scala/cats/Eval.scala b/core/src/main/scala/cats/Eval.scala index 4779eb2023..b7d13b3f7e 100644 --- a/core/src/main/scala/cats/Eval.scala +++ b/core/src/main/scala/cats/Eval.scala @@ -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) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0c95ea4771..c804a12725 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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.12") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.2.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.6-SNAPSHOT") 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") diff --git a/scripts/publishLocalSbtScoverage.sh b/scripts/publishLocalSbtScoverage.sh new file mode 100755 index 0000000000..5e2056ec71 --- /dev/null +++ b/scripts/publishLocalSbtScoverage.sh @@ -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 diff --git a/scripts/publishLocalScoverage.sh b/scripts/publishLocalScoverage.sh new file mode 100755 index 0000000000..be509c825b --- /dev/null +++ b/scripts/publishLocalScoverage.sh @@ -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 + From 4bef49ccb57d7ff0d9245eee83e59461f8508efb Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Tue, 20 Sep 2016 02:17:02 +0200 Subject: [PATCH 2/3] Fix tut on 2.12.0-RC1 --- build.sbt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.sbt b/build.sbt index 1ed8739ca5..b7c43e5ae3 100644 --- a/build.sbt +++ b/build.sbt @@ -159,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(".")) @@ -566,5 +567,11 @@ lazy val fix2_12 = Seq( case Some((2, 12)) => "-Xfatal-warnings" case _ => "" } + }, + scalacOptions in (ScalaUnidoc, unidoc) -= { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 12)) => "-Xfatal-warnings" + case _ => "" + } } ) From 409e39e6a8efa3f83bf79dcca38602db3530a007 Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Thu, 29 Sep 2016 00:21:39 +0200 Subject: [PATCH 3/3] Updated new 2.12 deps --- .travis.yml | 14 ++++++++------ build.sbt | 17 ++++++++--------- project/plugins.sbt | 4 ++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index da5e0f3cc2..81613b8001 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,16 +8,18 @@ git: depth: 9999 scala: -- 2.10.6 -- 2.11.8 -- 2.12.0-RC1 + - 2.10.6 + - 2.11.8 jdk: - - oraclejdk8 + - oraclejdk7 + +matrix: + include: + - scala: 2.12.0-RC1 + jdk: oraclejdk8 script: - - scripts/publishLocalScoverage.sh - - scripts/publishLocalSbtScoverage.sh - scripts/travis-publish.sh # http://austinpray.com/ops/2015/09/20/change-travis-node-version.html diff --git a/build.sbt b/build.sbt index b7c43e5ae3..005d340567 100644 --- a/build.sbt +++ b/build.sbt @@ -107,8 +107,8 @@ lazy val disciplineDependencies = Seq( libraryDependencies += "org.typelevel" %%% "discipline" % disciplineVersion) lazy val testingDependencies = Seq( - libraryDependencies += "org.typelevel" %%% "catalysts-platform" % "0.0.3-SNAPSHOT", - libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.3-SNAPSHOT" % "test", + libraryDependencies += "org.typelevel" %%% "catalysts-platform" % "0.0.3", + libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.3" % "test", libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % "test") @@ -167,14 +167,14 @@ lazy val cats = project.in(file(".")) .settings(catsSettings) .settings(noPublishSettings) .aggregate(catsJVM, catsJS) - .dependsOn(catsJVM, catsJS, testsJVM % "test-internal -> test")//, bench % "compile-internal;test-internal -> test") + .dependsOn(catsJVM, catsJS, testsJVM % "test-internal -> test", bench % "compile-internal;test-internal -> test") 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) - .dependsOn(macrosJVM, kernelJVM, kernelLawsJVM, coreJVM, lawsJVM, freeJVM, testsJVM % "test-internal -> test", jvm) //, bench % "compile-internal;test-internal -> test") + .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")) .settings(moduleName := "cats") @@ -252,7 +252,7 @@ lazy val laws = crossProject.crossType(CrossType.Pure) .settings(catsSettings:_*) .settings(disciplineDependencies:_*) .configure(disableScoverage210Jvm) - .settings(libraryDependencies ++= Seq("org.typelevel" %%% "catalysts-platform" % "0.0.3-SNAPSHOT")) + .settings(libraryDependencies ++= Seq("org.typelevel" %%% "catalysts-platform" % "0.0.3")) .jsSettings(commonJsSettings:_*) .jvmSettings(commonJvmSettings:_*) .jsSettings(coverageEnabled := false) @@ -286,7 +286,7 @@ 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) @@ -294,9 +294,8 @@ lazy val bench = project.dependsOn(macrosJVM, coreJVM, freeJVM, lawsJVM) .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 lazy val js = project @@ -400,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") diff --git a/project/plugins.sbt b/project/plugins.sbt index c804a12725..e6ac9b3527 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,9 +5,9 @@ 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.4") -//addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.12") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.15") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.6-SNAPSHOT") +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.12") addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.4.1")