-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
126 lines (117 loc) · 4.72 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
import de.heikoseeberger.sbtheader._
import java.time.Year
val scalaVersions = Seq("2.12.15")
val catsVersion = "2.7.0"
val shapelessVersion = "2.3.3" // to be compatible with Spark 3.1.x
val scalaTestVersion = "3.2.11"
val jtsVersion = "1.18.1"
val geomesaVersion = "3.3.0"
val hivelessVersion = "0.0.12"
val geotrellisVersion = "3.6.2"
val h3Version = "4.0.0-rc1"
// GeoTrellis depends on Shapeless 2.3.7
// To maintain better compat with Spark 3.1.x and DataBricks 9.1 we need to depend on Shapeless 2.3.3
val excludedDependencies = List(
ExclusionRule("com.chuusai", "shapeless_2.12"),
ExclusionRule("com.chuusai", "shapeless_2.13")
)
def ver(for212: String, for213: String) = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) => for212
case Some((2, 13)) => for213
case _ => sys.error("not good")
}
}
def spark(module: String) = Def.setting {
"org.apache.spark" %% s"spark-$module" % ver("3.1.3", "3.2.1").value
}
// https://github.com/xerial/sbt-sonatype/issues/276
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
lazy val commonSettings = Seq(
scalaVersion := scalaVersions.head,
crossScalaVersions := scalaVersions,
organization := "com.carto.analyticstoolbox",
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-language:higherKinds",
"-language:postfixOps",
"-language:existentials",
"-feature",
"-target:jvm-1.8" // ,
// "-Xsource:3"
),
licenses := Seq("BSD-3-Clause" -> url("https://github.com/CartoDB/analytics-toolbox-databricks/blob/master/LICENSE")),
homepage := Some(url("https://github.com/CartoDB/analytics-toolbox-databricks")),
versionScheme := Some("semver-spec"),
Test / publishArtifact := false,
Test / fork := true,
developers := List(
Developer(
"pomadchin",
"Grigory Pomadchin",
"@pomadchin",
url("https://github.com/pomadchin")
)
),
headerLicense := Some(HeaderLicense.ALv2(Year.now.getValue.toString, "Azavea")),
headerMappings := Map(
FileType.scala -> CommentStyle.cStyleBlockComment.copy(
commentCreator = { (text, existingText) =>
// preserve year of old headers
val newText = CommentStyle.cStyleBlockComment.commentCreator.apply(text, existingText)
existingText.flatMap(_ => existingText.map(_.trim)).getOrElse(newText)
}
)
),
// resolver for hiveless SNAPSHOT dependencies
resolvers += "oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
libraryDependencies += "org.scalatest" %% "scalatest" % scalaTestVersion % Test,
// sonatype settings
sonatypeProfileName := "com.carto",
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
)
lazy val root = (project in file("."))
.settings(commonSettings)
.settings(name := "analyticstoolbox")
.settings(
scalaVersion := scalaVersions.head,
crossScalaVersions := Nil,
publish := {},
publishLocal := {}
)
.aggregate(core)
lazy val core = project
.settings(commonSettings)
.settings(name := "core")
.settings(
libraryDependencies ++= Seq(
"com.azavea" %% "hiveless-core" % hivelessVersion,
"com.azavea" %% "hiveless-jts" % hivelessVersion,
"org.locationtech.geomesa" %% "geomesa-spark-jts" % geomesaVersion,
"com.uber" % "h3" % h3Version,
spark("hive").value % Provided
) ++ Seq(
"org.locationtech.geotrellis" %% "geotrellis-store" % geotrellisVersion,
"org.locationtech.geotrellis" %% "geotrellis-spark-testkit" % geotrellisVersion % Test
).map(_ excludeAll (excludedDependencies: _*)),
assembly / test := {},
assembly / assemblyShadeRules := {
val shadePackage = "com.carto.analytics"
Seq(
ShadeRule.rename("shapeless.**" -> s"$shadePackage.shapeless.@1").inAll,
ShadeRule.rename("cats.kernel.**" -> s"$shadePackage.cats.kernel.@1").inAll
)
},
assembly / assemblyMergeStrategy := {
case s if s.startsWith("META-INF/services") => MergeStrategy.concat
case "reference.conf" | "application.conf" => MergeStrategy.concat
case "META-INF/MANIFEST.MF" | "META-INF\\MANIFEST.MF" => MergeStrategy.discard
case "META-INF/ECLIPSEF.RSA" | "META-INF/ECLIPSEF.SF" => MergeStrategy.discard
case _ => MergeStrategy.first
}
)