-
Notifications
You must be signed in to change notification settings - Fork 138
/
build.sbt
413 lines (368 loc) · 13 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
val sparkVersion = "3.5.3"
val spark34Version = "3.4.4"
val spark33Version = "3.3.4"
val catsCoreVersion = "2.12.0"
val catsEffectVersion = "3.5.7"
val catsMtlVersion = "1.5.0"
val scalatest = "3.2.19"
val scalatestplus = "3.1.0.0-RC2"
val shapeless = "2.3.12"
val scalacheck = "1.18.1"
val scalacheckEffect = "1.0.4"
val refinedVersion = "0.11.2"
val nakedFSVersion = "0.1.0"
val Scala212 = "2.12.19"
val Scala213 = "2.13.14"
ThisBuild / tlBaseVersion := "0.16"
ThisBuild / crossScalaVersions := Seq(Scala213, Scala212)
ThisBuild / scalaVersion := Scala212
lazy val root = project
.in(file("."))
.enablePlugins(NoPublishPlugin)
.settings(crossScalaVersions := Nil)
.aggregate(
`root-spark35`,
`root-spark34`,
`root-spark33`,
docs
)
lazy val `root-spark35` = project
.in(file(".spark35"))
.enablePlugins(NoPublishPlugin)
.aggregate(core, cats, dataset, refined, ml)
lazy val `root-spark34` = project
.in(file(".spark34"))
.enablePlugins(NoPublishPlugin)
.aggregate(
core,
`cats-spark34`,
`dataset-spark34`,
`refined-spark34`,
`ml-spark34`
)
lazy val `root-spark33` = project
.in(file(".spark33"))
.enablePlugins(NoPublishPlugin)
.aggregate(
core,
`cats-spark33`,
`dataset-spark33`,
`refined-spark33`,
`ml-spark33`
)
lazy val core =
project.settings(name := "frameless-core").settings(framelessSettings)
lazy val cats = project
.settings(name := "frameless-cats")
.settings(catsSettings)
.dependsOn(dataset % "test->test;compile->compile;provided->provided")
lazy val `cats-spark34` = project
.settings(name := "frameless-cats-spark34")
.settings(sourceDirectory := (cats / sourceDirectory).value)
.settings(catsSettings)
.settings(spark34Settings)
.dependsOn(
`dataset-spark34` % "test->test;compile->compile;provided->provided"
)
lazy val `cats-spark33` = project
.settings(name := "frameless-cats-spark33")
.settings(sourceDirectory := (cats / sourceDirectory).value)
.settings(catsSettings)
.settings(spark33Settings)
.dependsOn(
`dataset-spark33` % "test->test;compile->compile;provided->provided"
)
lazy val dataset = project
.settings(name := "frameless-dataset")
.settings(
Compile / unmanagedSourceDirectories += baseDirectory.value / "src" / "main" / "spark-3.4+"
)
.settings(
Test / unmanagedSourceDirectories += baseDirectory.value / "src" / "test" / "spark-3.3+"
)
.settings(datasetSettings)
.settings(sparkDependencies(sparkVersion))
.dependsOn(core % "test->test;compile->compile")
lazy val `dataset-spark34` = project
.settings(name := "frameless-dataset-spark34")
.settings(sourceDirectory := (dataset / sourceDirectory).value)
.settings(
Compile / unmanagedSourceDirectories += (dataset / baseDirectory).value / "src" / "main" / "spark-3.4+"
)
.settings(
Test / unmanagedSourceDirectories += (dataset / baseDirectory).value / "src" / "test" / "spark-3.3+"
)
.settings(datasetSettings)
.settings(sparkDependencies(spark34Version))
.settings(spark34Settings)
.dependsOn(core % "test->test;compile->compile")
lazy val `dataset-spark33` = project
.settings(name := "frameless-dataset-spark33")
.settings(sourceDirectory := (dataset / sourceDirectory).value)
.settings(
Compile / unmanagedSourceDirectories += (dataset / baseDirectory).value / "src" / "main" / "spark-3"
)
.settings(
Test / unmanagedSourceDirectories += (dataset / baseDirectory).value / "src" / "test" / "spark-3.3+"
)
.settings(datasetSettings)
.settings(sparkDependencies(spark33Version))
.settings(spark33Settings)
.dependsOn(core % "test->test;compile->compile")
lazy val refined = project
.settings(name := "frameless-refined")
.settings(refinedSettings)
.dependsOn(dataset % "test->test;compile->compile;provided->provided")
lazy val `refined-spark34` = project
.settings(name := "frameless-refined-spark34")
.settings(sourceDirectory := (refined / sourceDirectory).value)
.settings(refinedSettings)
.settings(spark34Settings)
.dependsOn(
`dataset-spark34` % "test->test;compile->compile;provided->provided"
)
lazy val `refined-spark33` = project
.settings(name := "frameless-refined-spark33")
.settings(sourceDirectory := (refined / sourceDirectory).value)
.settings(refinedSettings)
.settings(spark33Settings)
.dependsOn(
`dataset-spark33` % "test->test;compile->compile;provided->provided"
)
lazy val ml = project
.settings(name := "frameless-ml")
.settings(mlSettings)
.settings(sparkMlDependencies(sparkVersion))
.dependsOn(
core % "test->test;compile->compile",
dataset % "test->test;compile->compile;provided->provided"
)
lazy val `ml-spark34` = project
.settings(name := "frameless-ml-spark34")
.settings(sourceDirectory := (ml / sourceDirectory).value)
.settings(mlSettings)
.settings(sparkMlDependencies(spark34Version))
.settings(spark34Settings)
.dependsOn(
core % "test->test;compile->compile",
`dataset-spark33` % "test->test;compile->compile;provided->provided"
)
lazy val `ml-spark33` = project
.settings(name := "frameless-ml-spark33")
.settings(sourceDirectory := (ml / sourceDirectory).value)
.settings(mlSettings)
.settings(sparkMlDependencies(spark33Version))
.settings(spark33Settings)
.dependsOn(
core % "test->test;compile->compile",
`dataset-spark33` % "test->test;compile->compile;provided->provided"
)
lazy val docs = project
.in(file("mdocs"))
.settings(framelessSettings)
.settings(scalacOptions --= Seq("-Xfatal-warnings", "-Ywarn-unused-import"))
.enablePlugins(TypelevelSitePlugin)
.settings(sparkDependencies(sparkVersion, Compile))
.settings(sparkMlDependencies(sparkVersion, Compile))
.settings(
addCompilerPlugin(
"org.typelevel" % "kind-projector" % "0.13.3" cross CrossVersion.full
),
scalacOptions += "-Ydelambdafy:inline",
libraryDependencies += "org.typelevel" %% "mouse" % "1.3.2"
)
.dependsOn(dataset, cats, ml)
def sparkDependencies(
sparkVersion: String,
scope: Configuration = Provided
) = Seq(
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % scope,
"org.apache.spark" %% "spark-sql" % sparkVersion % scope
)
)
def sparkMlDependencies(sparkVersion: String, scope: Configuration = Provided) =
Seq(
libraryDependencies += "org.apache.spark" %% "spark-mllib" % sparkVersion % scope
)
lazy val catsSettings = framelessSettings ++ Seq(
addCompilerPlugin(
"org.typelevel" % "kind-projector" % "0.13.3" cross CrossVersion.full
),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsCoreVersion,
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"org.typelevel" %% "cats-mtl" % catsMtlVersion,
"org.typelevel" %% "alleycats-core" % catsCoreVersion,
"org.typelevel" %% "scalacheck-effect" % scalacheckEffect % Test
)
)
lazy val datasetSettings =
framelessSettings ++ framelessTypedDatasetREPL ++ Seq(
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
val imt = ProblemFilters.exclude[IncompatibleMethTypeProblem](_)
val mc = ProblemFilters.exclude[MissingClassProblem](_)
val dmm = ProblemFilters.exclude[DirectMissingMethodProblem](_)
// TODO: Remove have version bump
Seq(
imt("frameless.TypedEncoder.mapEncoder"),
imt("frameless.TypedEncoder.arrayEncoder"),
imt("frameless.RecordEncoderFields.deriveRecordCons"),
imt("frameless.RecordEncoderFields.deriveRecordLast"),
mc("frameless.functions.FramelessLit"),
mc(f"frameless.functions.FramelessLit$$"),
dmm("frameless.functions.package.litAggr"),
dmm("org.apache.spark.sql.FramelessInternals.column")
)
},
coverageExcludedPackages := "org.apache.spark.sql.reflection",
libraryDependencies += "com.globalmentor" % "hadoop-bare-naked-local-fs" % nakedFSVersion % Test exclude ("org.apache.hadoop", "hadoop-commons")
)
lazy val refinedSettings =
framelessSettings ++ framelessTypedDatasetREPL ++ Seq(
libraryDependencies += "eu.timepit" %% "refined" % refinedVersion
)
lazy val mlSettings = framelessSettings ++ framelessTypedDatasetREPL
lazy val scalac212Options = Seq(
"-Xlint:-missing-interpolator,-unused,_",
"-target:jvm-1.8",
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-unused-import",
"-Ywarn-value-discard",
"-language:existentials",
"-language:implicitConversions",
"-language:higherKinds",
"-Xfuture",
"-Ypartial-unification"
)
lazy val scalac213Options = {
val exclusions = Set(
"-Yno-adapted-args",
"-Ywarn-unused-import",
"-Xfuture",
// type TraversableOnce in package scala is deprecated, symbol literal is deprecated; use Symbol("a") instead
"-Xfatal-warnings",
"-Ypartial-unification"
)
// https://github.com/scala/bug/issues/12072
val options = Seq("-Xlint:-byname-implicit")
scalac212Options.filter(s => !exclusions.contains(s)) ++ options
}
lazy val scalacOptionSettings = Def.setting {
def baseScalacOptions(scalaVersion: String) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, 13)) => scalac213Options
case _ => scalac212Options
}
baseScalacOptions(scalaVersion.value)
}
lazy val framelessSettings = Seq(
scalacOptions ++= scalacOptionSettings.value,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapeless,
"org.scalatest" %% "scalatest" % scalatest % Test,
"org.scalatestplus" %% "scalatestplus-scalacheck" % scalatestplus % Test,
"org.scalacheck" %% "scalacheck" % scalacheck % Test
),
Test / javaOptions ++= Seq("-Xmx1G", "-ea"),
Test / fork := true,
Test / parallelExecution := false,
mimaPreviousArtifacts ~= {
_.filterNot(_.revision == "0.11.0") // didn't release properly
},
/**
* The old Scala XML is pulled from Scala 2.12.x.
*
* [error] (update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
* [error]
* [error] * org.scala-lang.modules:scala-xml_2.12:2.3.0 (early-semver) is selected over 1.0.6
* [error] +- org.scoverage:scalac-scoverage-reporter_2.12:2.0.7 (depends on 2.1.0)
* [error] +- org.scala-lang:scala-compiler:2.12.16 (depends on 1.0.6)
*/
libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
) ++ consoleSettings
lazy val spark34Settings = Seq[Setting[_]](
tlVersionIntroduced := Map("2.12" -> "0.14.1", "2.13" -> "0.14.1"),
mimaPreviousArtifacts := Set(
organization.value %% moduleName.value
.split("-")
.dropRight(1)
.mkString("-") % "0.14.1"
)
)
lazy val spark33Settings = Seq[Setting[_]](
tlVersionIntroduced := Map("2.12" -> "0.13.0", "2.13" -> "0.13.0"),
mimaPreviousArtifacts := Set(
organization.value %% moduleName.value
.split("-")
.dropRight(1)
.mkString("-") % "0.14.0"
)
)
lazy val consoleSettings = Seq(
Compile / console / scalacOptions ~= {
_.filterNot("-Ywarn-unused-import" == _)
},
Test / console / scalacOptions := (Compile / console / scalacOptions).value
)
lazy val framelessTypedDatasetREPL = Seq(
initialize ~= { _ => // Color REPL
val ansi = System.getProperty("sbt.log.noformat", "false") != "true"
if (ansi) System.setProperty("scala.color", "true")
},
console / initialCommands :=
"""
|import org.apache.spark.{SparkConf, SparkContext}
|import org.apache.spark.sql.SparkSession
|import frameless.functions.aggregate._
|import frameless.syntax._
|
|val conf = new SparkConf().setMaster("local[*]").setAppName("frameless repl").set("spark.ui.enabled", "false")
|implicit val spark = SparkSession.builder().config(conf).appName("REPL").getOrCreate()
|
|import spark.implicits._
|
|spark.sparkContext.setLogLevel("WARN")
|
|import frameless.TypedDataset
""".stripMargin,
console / cleanupCommands :=
"""
|spark.stop()
""".stripMargin
)
ThisBuild / organization := "org.typelevel"
ThisBuild / licenses := List(
"Apache-2.0" -> url("http://opensource.org/licenses/Apache-2.0")
)
ThisBuild / developers := List(
"OlivierBlanvillain" -> "Olivier Blanvillain",
"adelbertc" -> "Adelbert Chang",
"imarios" -> "Marios Iliofotou",
"kanterov" -> "Gleb Kanterov",
"non" -> "Erik Osheim",
"jeremyrsmith" -> "Jeremy Smith",
"cchantep" -> "Cédric Chantepie",
"pomadchin" -> "Grigory Pomadchin"
).map {
case (username, fullName) =>
tlGitHubDev(username, fullName)
}
ThisBuild / tlCiReleaseBranches := Seq("master")
ThisBuild / tlSitePublishBranch := Some("master")
val roots = List("root-spark33", "root-spark34", "root-spark35")
ThisBuild / githubWorkflowBuildMatrixAdditions += "project" -> roots
ThisBuild / githubWorkflowBuildMatrixExclusions ++= roots.init.map { project =>
MatrixExclude(Map("scala" -> "2.13", "project" -> project))
}
ThisBuild / githubWorkflowEnv += "SBT_OPTS" -> "-Xms1g -Xmx4g"