Skip to content

Commit

Permalink
Backport build system fixes from upstream datastax#1361
Browse files Browse the repository at this point in the history
  • Loading branch information
eappere committed Dec 6, 2024
1 parent 04489b7 commit e16fc54
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
15 changes: 11 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import sbt.{Compile, moduleFilter, _}
import sbtassembly.AssemblyPlugin.autoImport.assembly

lazy val scala212 = "2.12.11"
lazy val supportedScalaVersions = List(scala212)
lazy val scala213 = "2.13.11"
lazy val supportedScalaVersions = List(scala212, scala213)

// factor out common settings
ThisBuild / scalaVersion := scala212
Expand Down Expand Up @@ -60,16 +61,18 @@ lazy val commonSettings = Seq(
fork := true,
parallelExecution := true,
testForkedParallel := false,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v"),
)


val annotationProcessor = Seq(
"-processor", "com.datastax.oss.driver.internal.mapper.processor.MapperProcessor"
)

def scalacVersionDependantOptions(scalaBinary: String): Seq[String] = scalaBinary match {
case "2.11" => Seq()
case "2.12" => Seq("-no-java-comments") //Scala Bug on inner classes, CassandraJavaUtil,
case "2.13" => Seq("-no-java-comments") //Scala Bug on inner classes, CassandraJavaUtil,
}

lazy val root = (project in file("."))
Expand All @@ -81,6 +84,7 @@ lazy val root = (project in file("."))
publish / skip := true
)


lazy val connector = (project in file("connector"))
.configs(IntegrationTest)
.settings(Defaults.itSettings: _*) //This and above enables the "it" suite
Expand All @@ -105,6 +109,7 @@ lazy val connector = (project in file("connector"))
Global / concurrentRestrictions := Seq(Tags.limitAll(Testing.parallelTasks)),

libraryDependencies ++= Dependencies.Spark.dependencies
++ Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.TestConnector.dependencies
++ Dependencies.Jetty.dependencies,

Expand All @@ -121,7 +126,8 @@ lazy val testSupport = (project in file("test-support"))
.settings(
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector-test-support",
libraryDependencies ++= Dependencies.TestSupport.dependencies
libraryDependencies ++= Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.TestSupport.dependencies
)

lazy val driver = (project in file("driver"))
Expand All @@ -131,7 +137,8 @@ lazy val driver = (project in file("driver"))
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector-driver",
assembly /test := {},
libraryDependencies ++= Dependencies.Driver.dependencies
libraryDependencies ++= Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.Driver.dependencies
++ Dependencies.TestDriver.dependencies
:+ ("org.scala-lang" % "scala-reflect" % scalaVersion.value)
)
Expand Down
13 changes: 13 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,22 @@ object Dependencies
val commonsLang3 = "org.apache.commons" % "commons-lang3" % Versions.CommonsLang3
val paranamer = "com.thoughtworks.paranamer" % "paranamer" % Versions.Paranamer


val dependencies = Seq(driverCore, driverMapper, commonsLang3, paranamer)
}

object Compatibility {
val scalaCompat = "org.scala-lang.modules" %% "scala-collection-compat" % Versions.ScalaCompat
val parallelCollections = "org.scala-lang.modules" %% "scala-parallel-collections" % Versions.ParallelCollections

def dependencies(version: String): Seq[ModuleID] = {
CrossVersion.partialVersion(version) match {
case Some((2, scalaMajor)) if scalaMajor == 13 => Seq(scalaCompat, parallelCollections)
case _ => Seq(scalaCompat)
}
}
}

object TestDriver {
val dependencies = Seq(
TestCommon.scalaTest % "test",
Expand Down
12 changes: 2 additions & 10 deletions project/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ object Versions {
val SparkJetty = "9.3.27.v20190418"
val SolrJ = "8.3.0"

/*
val status = (versionInReapply: String, binaryInReapply: String) =>
println(s"""
| Scala: $versionInReapply
| Scala Binary: $binaryInReapply
| Java: target=$JDK user=${Properties.javaVersion}
| Cassandra version for testing: ${Testing.cassandraTestVersion} [can be overridden by specifying '-Dtest.cassandra.version=<version>']
""".stripMargin)
*/
val ScalaCompat = "2.11.0"
val ParallelCollections = "1.0.4"
}

0 comments on commit e16fc54

Please sign in to comment.