Permalink
Browse files

Compile and publish almond-spark module in 2.12 too (#310)

For spark 2.4.0
  • Loading branch information...
alexarchambault committed Feb 1, 2019
1 parent 752dc8a commit b1c240239c14a961d68c4d93958c0cc6c917430a
Showing with 19 additions and 22 deletions.
  1. +2 −3 build.sbt
  2. +10 −1 project/Deps.scala
  3. +7 −18 project/Settings.scala
@@ -152,9 +152,8 @@ lazy val `almond-spark` = project
Deps.ammoniteRepl % "provided",
Deps.ammoniteSpark,
Deps.argonautShapeless,
Deps.sparkSql % "provided"
),
disableScalaVersion("2.12")
Deps.sparkSql.value % "provided"
)
)

lazy val `almond-rx` = project
@@ -23,7 +23,16 @@ object Deps {
def scalaRx = "com.lihaoyi" %% "scalarx" % "0.4.0"
def scalatags = "com.lihaoyi" %% "scalatags" % "0.6.7"
def slf4jNop = "org.slf4j" % "slf4j-nop" % "1.7.25"
def sparkSql = "org.apache.spark" %% "spark-sql" % "2.0.2"

def sparkSql20 = "org.apache.spark" %% "spark-sql" % "2.0.2" // no need to bump that version much, to ensure we don't rely on too new stuff
def sparkSql24 = "org.apache.spark" %% "spark-sql" % "2.4.0" // that version's required for scala 2.12
def sparkSql = setting {
if (Settings.isAtLeast212.value)
sparkSql24
else
sparkSql20
}

def utest = "com.lihaoyi" %% "utest" % "0.6.6"

}
@@ -10,6 +10,13 @@ object Settings {
private val scala211 = "2.11.12"
private val scala212 = "2.12.8"

lazy val isAtLeast212 = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 12 => true
case _ => false
}
}

lazy val shared = Seq(
scalaVersion := scala212,
crossScalaVersions := Seq(scala212, "2.12.7", "2.12.6", scala211),
@@ -38,24 +45,6 @@ object Settings {
publishArtifact := false
)

def disableScalaVersion(sbv: String*) = Seq(
baseDirectory := {
if (sbv.contains(scalaBinaryVersion.value))
baseDirectory.value / "target" / "dummy"
else
baseDirectory.value
},
libraryDependencies := {
if (sbv.contains(scalaBinaryVersion.value))
Nil
else
libraryDependencies.value
},
publishArtifact := {
!sbv.contains(scalaBinaryVersion.value) && publishArtifact.value
}
)

def generatePropertyFile(path: String) =
resourceGenerators.in(Compile) += Def.task {
import sys.process._

0 comments on commit b1c2402

Please sign in to comment.