diff --git a/.travis.yml b/.travis.yml index 7c96295a1f..b4a39701f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,16 +10,15 @@ git: depth: 9999 scala: - - 2.10.7 - 2.11.12 - - 2.13.0-M3 + - 2.13.0-M4 - 2.12.6 matrix: allow_failures: # There are known issues in this scala milestone release that prevent the tests to compile. # But we want to enable the build to facilitate debuging, esp on the community build. - - scala: 2.13.0-M3 + - scala: 2.13.0-M4 jdk: - oraclejdk8 @@ -61,4 +60,4 @@ cache: - $HOME/.coursier # Pants cache - $HOME/.cache - + diff --git a/build.sbt b/build.sbt index 25e08a3772..e8fa17bf43 100644 --- a/build.sbt +++ b/build.sbt @@ -1,27 +1,19 @@ import microsites._ import ReleaseTransformations._ import scala.xml.transform.{RewriteRule, RuleTransformer} -import org.scalajs.sbtplugin.cross.CrossProject +import sbtcrossproject.CrossProject +import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} lazy val scoverageSettings = Seq( coverageMinimum := 60, coverageFailOnMinimum := false, - //https://github.com/scoverage/sbt-scoverage/issues/72 - coverageHighlighting := { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, 10)) => false - case _ => true - } - } + coverageHighlighting := true ) organization in ThisBuild := "org.typelevel" -val CompileTime = config("compile-time").hide - lazy val kernelSettings = Seq( - // don't warn on value discarding because it's broken on 2.10 with @sp(Unit) - scalacOptions ++= commonScalacOptions.filter(_ != "-Ywarn-value-discard"), + scalacOptions ++= commonScalacOptions, resolvers ++= Seq( Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")), @@ -39,23 +31,25 @@ lazy val commonSettings = Seq( Resolver.sonatypeRepo("snapshots") ), libraryDependencies ++= Seq( - "com.github.mpilquist" %%% "simulacrum" % "0.12.0" % CompileTime, + "com.github.mpilquist" %%% "simulacrum" % "0.12.0" % Provided, "org.typelevel" %%% "machinist" % "0.6.4", compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.patch), compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.6") ), + 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 == "com.github.mpilquist") && + e.child.exists(child => child.label == "artifactId" && child.text.startsWith("simulacrum_")) => Nil + case _ => Seq(node) + } + }).transform(node).head + }, fork in test := true, parallelExecution in Test := false, - scalacOptions in (Compile, doc) := (scalacOptions in (Compile, doc)).value.filter(_ != "-Xfatal-warnings"), - ivyConfigurations += CompileTime, - unmanagedClasspath in Compile ++= update.value.select(configurationFilter(CompileTime.name)), - unmanagedSourceDirectories in Test ++= { - val bd = baseDirectory.value - if (CrossVersion.partialVersion(scalaVersion.value) exists (_._2 >= 11)) - CrossType.Pure.sharedSrcDir(bd, "test").toList map (f => file(f.getPath + "-2.11+")) - else - Nil - } + scalacOptions in (Compile, doc) := (scalacOptions in (Compile, doc)).value.filter(_ != "-Xfatal-warnings") ) ++ warnUnusedImport ++ update2_12 ++ xlint @@ -99,7 +93,7 @@ lazy val includeGeneratedSrc: Setting[_] = { } } -lazy val catsSettings = commonSettings ++ publishSettings ++ scoverageSettings ++ javadocSettings +lazy val catsSettings = commonSettings ++ publishSettings ++ scoverageSettings lazy val scalaCheckVersion = "1.13.5" // 2.13.0-M3 workaround @@ -125,26 +119,6 @@ lazy val testingDependencies = Seq( // libraryDependencies += "org.scalatest" %%% "scalatest" % scalaTestVersion % "test") libraryDependencies += "org.scalatest" %%% "scalatest" % scalatestVersion(scalaVersion.value) % "test") -/** - * Remove 2.10 projects from doc generation, as the macros used in the projects - * cause problems generating the documentation on scala 2.10. As the APIs for 2.10 - * and 2.11 are the same this has no effect on the resultant documentation, though - * it does mean that the scaladocs cannot be generated when the build is in 2.10 mode. - */ -def docsSourcesAndProjects(sv: String): (Boolean, Seq[ProjectReference]) = - CrossVersion.partialVersion(sv) match { - case Some((2, 10)) => (false, Nil) - case _ => (true, Seq(kernelJVM, coreJVM, freeJVM)) - } - -lazy val javadocSettings = Seq( - sources in (Compile, doc) := { - val docSource = (sources in (Compile, doc)).value - if (docsSourcesAndProjects(scalaVersion.value)._1) docSource else Nil - } -) - - lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs") lazy val docSettings = Seq( @@ -185,8 +159,7 @@ lazy val docSettings = Seq( "gray-lighter" -> "#F4F3F4", "white-color" -> "#FFFFFF"), autoAPIMappings := true, - unidocProjectFilter in (ScalaUnidoc, unidoc) := - inProjects(docsSourcesAndProjects(scalaVersion.value)._2:_*), + unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(kernelJVM, coreJVM, freeJVM), docsMappingsAPIDir := "api", addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), docsMappingsAPIDir), ghpagesNoJekyll := false, @@ -210,10 +183,10 @@ def mimaSettings(moduleName: String) = { def semverBinCompatVersions(major: Int, minor: Int, patch: Int): Set[(Int, Int, Int)] = { val majorVersions: List[Int] = List(major) - val minorVersions : List[Int] = + val minorVersions : List[Int] = if (major >= 1) Range(0, minor).inclusive.toList else List(minor) - def patchVersions(currentMinVersion: Int): List[Int] = + def patchVersions(currentMinVersion: Int): List[Int] = if (minor == 0 && patch == 0) List.empty[Int] else if (currentMinVersion != minor) List(0) else Range(0, patch - 1).inclusive.toList @@ -246,7 +219,7 @@ def mimaSettings(moduleName: String) = { .filterNot(excludedVersions.contains(_)) .map(v => "org.typelevel" %% moduleName % v) ) -} +} lazy val docs = project .enablePlugins(MicrositesPlugin) @@ -283,7 +256,8 @@ lazy val catsJS = project.in(file(".catsJS")) .enablePlugins(ScalaJSPlugin) -lazy val macros = crossProject.crossType(CrossType.Pure) +lazy val macros = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .settings(moduleName := "cats-macros", name := "Cats macros") .settings(catsSettings) .jsSettings(commonJsSettings) @@ -295,7 +269,8 @@ lazy val macrosJVM = macros.jvm lazy val macrosJS = macros.js -lazy val kernel = crossProject.crossType(CrossType.Pure) +lazy val kernel = crossProject(JSPlatform, JVMPlatform, NativePlatform) + .crossType(CrossType.Pure) .in(file("kernel")) .settings(moduleName := "cats-kernel", name := "Cats kernel") .settings(kernelSettings) @@ -309,8 +284,10 @@ lazy val kernel = crossProject.crossType(CrossType.Pure) lazy val kernelJVM = kernel.jvm lazy val kernelJS = kernel.js +lazy val kernelNative = kernel.native -lazy val kernelLaws = crossProject.crossType(CrossType.Pure) +lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .in(file("kernel-laws")) .settings(moduleName := "cats-kernel-laws", name := "Cats kernel laws") .settings(kernelSettings) @@ -326,7 +303,8 @@ lazy val kernelLaws = crossProject.crossType(CrossType.Pure) lazy val kernelLawsJVM = kernelLaws.jvm lazy val kernelLawsJS = kernelLaws.js -lazy val core = crossProject.crossType(CrossType.Pure) +lazy val core = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .dependsOn(macros, kernel) .settings(moduleName := "cats-core", name := "Cats core") .settings(catsSettings) @@ -341,7 +319,8 @@ lazy val core = crossProject.crossType(CrossType.Pure) lazy val coreJVM = core.jvm lazy val coreJS = core.js -lazy val laws = crossProject.crossType(CrossType.Pure) +lazy val laws = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .dependsOn(macros, kernel, core, kernelLaws) .settings(moduleName := "cats-laws", name := "Cats laws") .settings(catsSettings) @@ -355,7 +334,8 @@ lazy val laws = crossProject.crossType(CrossType.Pure) lazy val lawsJVM = laws.jvm lazy val lawsJS = laws.js -lazy val free = crossProject.crossType(CrossType.Pure) +lazy val free = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .dependsOn(macros, core, tests % "test-internal -> test") .settings(moduleName := "cats-free", name := "Cats Free") .settings(catsSettings) @@ -365,7 +345,8 @@ lazy val free = crossProject.crossType(CrossType.Pure) lazy val freeJVM = free.jvm lazy val freeJS = free.js -lazy val tests = crossProject.crossType(CrossType.Pure) +lazy val tests = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .dependsOn(testkit % "test") .settings(moduleName := "cats-tests") .settings(catsSettings) @@ -377,7 +358,8 @@ lazy val testsJVM = tests.jvm lazy val testsJS = tests.js -lazy val testkit = crossProject.crossType(CrossType.Pure) +lazy val testkit = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .dependsOn(macros, core, laws) .settings(moduleName := "cats-testkit") .settings(catsSettings) @@ -391,7 +373,8 @@ lazy val testkit = crossProject.crossType(CrossType.Pure) lazy val testkitJVM = testkit.jvm lazy val testkitJS = testkit.js -lazy val alleycatsCore = crossProject.crossType(CrossType.Pure) +lazy val alleycatsCore = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .in(file("alleycats-core")) .dependsOn(core) .settings(moduleName := "alleycats-core", name := "Alleycats core") @@ -410,7 +393,8 @@ lazy val alleycatsCore = crossProject.crossType(CrossType.Pure) lazy val alleycatsCoreJVM = alleycatsCore.jvm lazy val alleycatsCoreJS = alleycatsCore.js -lazy val alleycatsLaws = crossProject.crossType(CrossType.Pure) +lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .in(file("alleycats-laws")) .dependsOn(alleycatsCore, laws) .settings(moduleName := "alleycats-laws", name := "Alleycats laws") @@ -427,7 +411,8 @@ lazy val alleycatsLaws = crossProject.crossType(CrossType.Pure) lazy val alleycatsLawsJVM = alleycatsLaws.jvm lazy val alleycatsLawsJS = alleycatsLaws.js -lazy val alleycatsTests = crossProject.crossType(CrossType.Pure) +lazy val alleycatsTests = crossProject(JSPlatform, JVMPlatform) + .crossType(CrossType.Pure) .in(file("alleycats-tests")) .dependsOn(alleycatsLaws, testkit % "test") .settings(moduleName := "alleycats-tests") @@ -608,22 +593,6 @@ lazy val crossVersionSharedSources: Seq[Setting[_]] = } } -lazy val scalaMacroDependencies: Seq[Setting[_]] = Seq( - libraryDependencies += scalaOrganization.value %%% "scala-reflect" % scalaVersion.value % "provided", - libraryDependencies ++= { - CrossVersion.partialVersion(scalaVersion.value) match { - // if scala 2.11+ is used, quasiquotes are merged into scala-reflect - case Some((2, scalaMajor)) if scalaMajor >= 11 => Seq() - // in Scala 2.10, quasiquotes are provided by macro paradise - case Some((2, 10)) => - Seq( - compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.patch), - "org.scalamacros" %% "quasiquotes" % "2.1.0" cross CrossVersion.binary - ) - } - } -) - lazy val commonScalacOptions = Seq( "-deprecation", "-encoding", "UTF-8", diff --git a/project/plugins.sbt b/project/plugins.sbt index 69c3b2f477..87b23127d6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,16 +1,19 @@ addSbtCoursier -addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1") -addSbtPlugin("com.github.gseitz" %% "sbt-release" % "1.0.8") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0") -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3") -addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0-M3") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") -addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.8.0") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") -addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.20") -addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1") -addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.1") -addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.4") +addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1") +addSbtPlugin("com.github.gseitz" %% "sbt-release" % "1.0.8") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3") +addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0-M3") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") +addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.8.0") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") +addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.20") +addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1") +addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.1") +addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.4") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.5.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.7") diff --git a/tests/src/test/scala-2.11+/cats/tests/ExtraRegressionSuite.scala b/tests/src/test/scala/cats/tests/ExtraRegressionSuite.scala similarity index 100% rename from tests/src/test/scala-2.11+/cats/tests/ExtraRegressionSuite.scala rename to tests/src/test/scala/cats/tests/ExtraRegressionSuite.scala diff --git a/version.sbt b/version.sbt index ab920457d3..bab1d6515c 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "1.1.1-SNAPSHOT" +version in ThisBuild := "1.2.1-SNAPSHOT"