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

Use portable-scala crossProject #2323

Merged
merged 2 commits into from Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
52 changes: 35 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
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,
Expand All @@ -17,8 +18,6 @@ lazy val scoverageSettings = Seq(

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"),
Expand All @@ -39,16 +38,23 @@ 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") => Nil
case _ => Seq(node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this blanket removing every dependencies under "com.github.mpilquist" for the sake of simulacrum. Is this worthwhile than just using Provided?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it just removes the simulacrum dependency the POM, a known concern, as done in the past elsewhere- eg typelevel/cats-effect#77 (comment) .

But if you would rather a more fine controlled selection, by artifact name, sure-np

Copy link
Contributor

@kailuowang kailuowang Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think artifact name would be better, but if it's trickier than group name I'd vote for just leave it as "Provdided", not ideal, but didn't cause any problems in the past before we switched to the CompileTime hack.

}
}).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))
Expand Down Expand Up @@ -283,7 +289,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 +302,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 +317,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 +336,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 +352,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 +367,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 +378,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 +391,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 +406,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 +426,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 +444,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
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")