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

Merge 1.2.x back into master #2340

Merged
merged 6 commits into from
Jul 27, 2018
Merged
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
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,4 +60,4 @@ cache:
- $HOME/.coursier
# Pants cache
- $HOME/.cache

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ scalacOptions += "-Ypartial-unification"
**Or**, if you need to support older versions of Scala you can use the [sbt-partial-unification](https://github.com/fiadliel/sbt-partial-unification#sbt-partial-unification) plugin which extends support back through **Scala 2.10.6 or later**, to add it, simply add this line to your `plugins.sbt`:

```scala
addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.0")
addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.2.0")
```

And then create the Cats dependency, by adding the following to your `build.sbt`:

```scala
libraryDependencies += "org.typelevel" %% "cats-core" % "1.1.0"
libraryDependencies += "org.typelevel" %% "cats-core" % "1.2.0"
```

This will pull in the cats-core module. If you require some other
Expand Down
121 changes: 45 additions & 76 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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")),
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -246,7 +219,7 @@ def mimaSettings(moduleName: String) = {
.filterNot(excludedVersions.contains(_))
.map(v => "org.typelevel" %% moduleName % v)
)
}
}

lazy val docs = project
.enablePlugins(MicrositesPlugin)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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",
Expand Down
33 changes: 18 additions & 15 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "1.1.1-SNAPSHOT"
version in ThisBuild := "1.2.1-SNAPSHOT"