-
Notifications
You must be signed in to change notification settings - Fork 923
/
build.sbt
155 lines (131 loc) · 5.76 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import com.timushev.sbt.updates.UpdatesPlugin.autoImport.dependencyUpdatesFilter
import sbt.Keys.parallelExecution
import sbt.{Compile, moduleFilter, _}
import sbtassembly.AssemblyPlugin.autoImport.assembly
lazy val scala212 = "2.12.19"
lazy val scala213 = "2.13.13"
lazy val supportedScalaVersions = List(scala212, scala213)
// factor out common settings
ThisBuild / scalaVersion := scala212
ThisBuild / scalacOptions ++= Seq("-target:jvm-1.8")
// Publishing Info
ThisBuild / credentials ++= Publishing.Creds
ThisBuild / homepage := Some(url("https://github.com/datastax/spark-cassandra-connector"))
ThisBuild / licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt") )
ThisBuild / organization := "com.datastax.spark"
ThisBuild / organizationName := "Datastax"
ThisBuild / organizationHomepage := Some(url("https://www.datastax.com"))
ThisBuild / pomExtra := Publishing.OurDevelopers
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishMavenStyle := true
ThisBuild / publishTo := Publishing.Repository
ThisBuild / scmInfo := Publishing.OurScmInfo
ThisBuild / version := Publishing.Version
Global / resolvers ++= Seq(
DefaultMavenRepository,
Resolver.sonatypeRepo("public")
)
lazy val IntegrationTest = config("it") extend Test
lazy val integrationTestsWithFixtures = taskKey[Map[TestDefinition, Seq[String]]]("Evaluates names of all " +
"Fixtures sub-traits for each test. Sets of fixture sub-traits names are used to form group tests.")
lazy val assemblySettings = Seq(
assembly / parallelExecution := false,
assembly / test := {},
assembly / assemblyMergeStrategy := {
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case PathList("META-INF", xs @ _*) => MergeStrategy.last
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
assembly / assemblyOption := (assemblyOption in assembly).value.copy(includeScala = false),
assembly / assemblyShadeRules := {
Seq(
ShadeRule.rename("com.typesafe.config.**" -> s"shade.com.datastax.spark.connector.@0").inAll
)
},
)
lazy val commonSettings = Seq(
// dependency updates check
dependencyUpdatesFailBuild := true,
dependencyUpdatesFilter -= moduleFilter(organization = "org.scala-lang" | "org.eclipse.jetty"),
fork := true,
parallelExecution := true,
testForkedParallel := false,
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("."))
.disablePlugins(AssemblyPlugin)
.aggregate(connector, testSupport, driver, publishableAssembly)
.settings(
// crossScalaVersions must be set to Nil on the aggregating project
crossScalaVersions := Nil,
publish / skip := true
)
lazy val connector = (project in file("connector"))
.configs(IntegrationTest)
.settings(Defaults.itSettings: _*) //This and above enables the "it" suite
.settings(commonSettings)
.settings(assemblySettings)
.settings(
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector",
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
// test grouping
integrationTestsWithFixtures := {
Testing.testsWithFixtures((testLoader in IntegrationTest).value, (definedTests in IntegrationTest).value)
},
IntegrationTest / testGrouping := Testing.makeTestGroups(integrationTestsWithFixtures.value),
IntegrationTest / testOptions += Tests.Argument("-oF"), // show full stack traces
Test / javacOptions ++= annotationProcessor ++ Seq("-d", (classDirectory in Test).value.toString),
Global / concurrentRestrictions := Seq(Tags.limitAll(Testing.parallelTasks)),
libraryDependencies ++= Dependencies.Spark.dependencies
++ Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.TestConnector.dependencies
++ Dependencies.Jetty.dependencies,
scalacOptions in (Compile, doc) ++= scalacVersionDependantOptions(scalaBinaryVersion.value)
)
.dependsOn(
testSupport % "test",
driver
)
lazy val testSupport = (project in file("test-support"))
.disablePlugins(AssemblyPlugin)
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector-test-support",
libraryDependencies ++= Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.TestSupport.dependencies
)
lazy val driver = (project in file("driver"))
.disablePlugins(AssemblyPlugin)
.settings(commonSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector-driver",
assembly /test := {},
libraryDependencies ++= Dependencies.Compatibility.dependencies(scalaVersion.value)
++ Dependencies.Driver.dependencies
++ Dependencies.TestDriver.dependencies
:+ ("org.scala-lang" % "scala-reflect" % scalaVersion.value)
)
/** The following project defines an extra artifact published alongside main 'spark-cassandra-connector'.
* It's an assembled version of the main artifact. It contains all of the dependent classes, some of them
* are shaded. */
lazy val publishableAssembly = project
.disablePlugins(AssemblyPlugin)
.settings(
crossScalaVersions := supportedScalaVersions,
name := "spark-cassandra-connector-assembly",
Compile / packageBin := (assembly in (connector, Compile)).value
)