forked from windpiger/connectors
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
333 lines (313 loc) · 13.6 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
/*
* Copyright (2020) The Delta Lake Project Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ReleaseTransformations._
parallelExecution in ThisBuild := false
scalastyleConfig in ThisBuild := baseDirectory.value / "scalastyle-config.xml"
crossScalaVersions in ThisBuild := Seq("2.12.8", "2.11.12")
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
val sparkVersion = "2.4.3"
val hadoopVersion = "2.7.2"
val hiveVersion = "2.3.7"
val deltaVersion = "0.5.0"
lazy val commonSettings = Seq(
organization := "io.delta",
scalaVersion := "2.12.8",
fork := true,
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
scalacOptions += "-target:jvm-1.8",
// Configurations to speed up tests and reduce memory footprint
javaOptions in Test ++= Seq(
"-Dspark.ui.enabled=false",
"-Dspark.ui.showConsoleProgress=false",
"-Dspark.databricks.delta.snapshotPartitions=2",
"-Dspark.sql.shuffle.partitions=5",
"-Ddelta.log.cacheSize=3",
"-Dspark.sql.sources.parallelPartitionDiscovery.parallelism=5",
"-Xmx1024m"
),
compileScalastyle := scalastyle.in(Compile).toTask("").value,
(compile in Compile) := ((compile in Compile) dependsOn compileScalastyle).value,
testScalastyle := scalastyle.in(Test).toTask("").value,
(test in Test) := ((test in Test) dependsOn testScalastyle).value
)
lazy val releaseSettings = Seq(
publishMavenStyle := true,
releaseCrossBuild := true,
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
pomExtra :=
<url>https://github.com/delta-io/connectors</url>
<scm>
<url>[email protected]:delta-io/connectors.git</url>
<connection>scm:git:[email protected]:delta-io/connectors.git</connection>
</scm>
<developers>
<developer>
<id>tdas</id>
<name>Tathagata Das</name>
<url>https://github.com/tdas</url>
</developer>
<developer>
<id>scottsand-db</id>
<name>Scott Sandre</name>
<url>https://github.com/scottsand-db</url>
</developer>
<developer>
<id>windpiger</id>
<name>Jun Song</name>
<url>https://github.com/windpiger</url>
</developer>
<developer>
<id>zsxwing</id>
<name>Shixiong Zhu</name>
<url>https://github.com/zsxwing</url>
</developer>
</developers>,
bintrayOrganization := Some("delta-io"),
bintrayRepository := "delta",
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion
)
)
lazy val skipReleaseSettings = Seq(
publishArtifact := false,
publish := ()
)
// Don't release the root project
publishArtifact := false
publish := ()
// Looks some of release settings should be set for the root project as well.
releaseCrossBuild := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion
)
lazy val hive = (project in file("hive")) dependsOn(standalone) settings (
name := "delta-hive",
commonSettings,
releaseSettings,
// Minimal dependencies to compile the codes. This project doesn't run any tests so we don't need
// any runtime dependencies.
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion % "provided",
"org.apache.parquet" % "parquet-hadoop" % "1.10.1" % "provided",
"org.apache.hive" % "hive-exec" % hiveVersion % "provided" classifier "core" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm"),
ExclusionRule(organization = "com.google.protobuf")
),
"org.apache.hive" % "hive-metastore" % hiveVersion % "provided" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("org.apache.hive", "hive-exec")
),
"org.apache.hive" % "hive-cli" % hiveVersion % "test" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("ch.qos.logback", "logback-classic"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm"),
ExclusionRule("org.apache.hive", "hive-exec"),
ExclusionRule(organization = "com.google.protobuf")
),
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"io.delta" %% "delta-core" % deltaVersion % "test",
"org.apache.spark" %% "spark-sql" % sparkVersion % "test",
"org.apache.spark" %% "spark-catalyst" % sparkVersion % "test" classifier "tests",
"org.apache.spark" %% "spark-core" % sparkVersion % "test" classifier "tests",
"org.apache.spark" %% "spark-sql" % sparkVersion % "test" classifier "tests"
),
/** Hive assembly jar. Build with `assembly` command */
logLevel in assembly := Level.Info,
test in assembly := {},
assemblyJarName in assembly := s"${name.value}-assembly_${scalaBinaryVersion.value}-${version.value}.jar",
// default merge strategy
assemblyShadeRules in assembly := Seq(
/**
* Hive 2.3.7 uses an old paranamer version that doesn't support Scala 2.12
* (https://issues.apache.org/jira/browse/SPARK-22128), so we need to shade our own paranamer
* version to avoid conflicts.
*/
ShadeRule.rename("com.thoughtworks.paranamer.**" -> "shadedelta.@0").inAll
)
)
lazy val hiveMR = (project in file("hive-mr")) dependsOn(hive % "test->test") settings (
name := "hive-mr",
commonSettings,
skipReleaseSettings,
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion % "provided",
"org.apache.hive" % "hive-exec" % hiveVersion % "provided" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm")
),
"org.apache.hadoop" % "hadoop-common" % hadoopVersion % "test" classifier "tests",
"org.apache.hadoop" % "hadoop-mapreduce-client-hs" % hadoopVersion % "test",
"org.apache.hadoop" % "hadoop-mapreduce-client-jobclient" % hadoopVersion % "test" classifier "tests",
"org.apache.hadoop" % "hadoop-yarn-server-tests" % hadoopVersion % "test" classifier "tests",
"org.apache.hive" % "hive-cli" % hiveVersion % "test" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("ch.qos.logback", "logback-classic"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm")
),
// TODO Figure out how this fixes some bad dependency
"org.apache.spark" %% "spark-core" % sparkVersion % "test" classifier "tests",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"io.delta" %% "delta-core" % deltaVersion % "test" excludeAll ExclusionRule("org.apache.hadoop")
)
)
lazy val hiveTez = (project in file("hive-tez")) dependsOn(hive % "test->test") settings (
name := "hive-tez",
commonSettings,
skipReleaseSettings,
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion % "provided" excludeAll (
ExclusionRule(organization = "com.google.protobuf")
),
"org.apache.parquet" % "parquet-hadoop" % "1.10.1" excludeAll(
ExclusionRule("org.apache.hadoop", "hadoop-client")
),
"com.google.protobuf" % "protobuf-java" % "2.5.0",
"org.apache.hive" % "hive-exec" % hiveVersion % "provided" classifier "core" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm"),
ExclusionRule(organization = "com.google.protobuf")
),
"org.jodd" % "jodd-core" % "3.5.2",
"org.apache.hive" % "hive-metastore" % hiveVersion % "provided" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("org.apache.hive", "hive-exec")
),
"org.apache.hadoop" % "hadoop-common" % hadoopVersion % "test" classifier "tests",
"org.apache.hadoop" % "hadoop-mapreduce-client-hs" % hadoopVersion % "test",
"org.apache.hadoop" % "hadoop-mapreduce-client-jobclient" % hadoopVersion % "test" classifier "tests",
"org.apache.hadoop" % "hadoop-yarn-server-tests" % hadoopVersion % "test" classifier "tests",
"org.apache.hive" % "hive-cli" % hiveVersion % "test" excludeAll(
ExclusionRule(organization = "org.apache.spark"),
ExclusionRule(organization = "org.apache.parquet"),
ExclusionRule("ch.qos.logback", "logback-classic"),
ExclusionRule("org.pentaho", "pentaho-aggdesigner-algorithm"),
ExclusionRule("org.apache.hive", "hive-exec"),
ExclusionRule(organization = "com.google.protobuf")
),
"org.apache.hadoop" % "hadoop-yarn-common" % hadoopVersion % "test",
"org.apache.hadoop" % "hadoop-yarn-api" % hadoopVersion % "test",
"org.apache.tez" % "tez-mapreduce" % "0.8.4" % "test",
"org.apache.tez" % "tez-dag" % "0.8.4" % "test",
"org.apache.tez" % "tez-tests" % "0.8.4" % "test" classifier "tests",
// TODO Figure out how this fixes some bad dependency
"org.apache.spark" %% "spark-core" % sparkVersion % "test" classifier "tests",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"io.delta" %% "delta-core" % deltaVersion % "test" excludeAll ExclusionRule("org.apache.hadoop")
)
)
lazy val standalone = (project in file("standalone"))
.settings(
name := "delta-standalone",
commonSettings,
unmanagedResourceDirectories in Test += file("golden-tables/src/test/resources"),
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-client" % hadoopVersion % "provided",
"org.apache.parquet" % "parquet-hadoop" % "1.10.1" % "provided",
"com.github.mjakubowski84" %% "parquet4s-core" % "1.2.1" excludeAll (
ExclusionRule("org.slf4j", "slf4j-api"),
ExclusionRule("org.apache.parquet", "parquet-hadoop")
),
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.7.1",
"org.json4s" %% "json4s-jackson" % "3.5.3" excludeAll (
ExclusionRule("com.fasterxml.jackson.core"),
ExclusionRule("com.fasterxml.jackson.module")
),
"org.scalatest" %% "scalatest" % "3.0.5" % "test"
))
/**
* Unidoc settings
* Generate javadoc with `unidoc` command, outputs to `standalone/target/javaunidoc`
*/
.enablePlugins(GenJavadocPlugin, JavaUnidocPlugin)
.settings(
javacOptions in (JavaUnidoc, unidoc) := Seq(
"-public",
"-windowtitle", "Delta Standalone Reader " + version.value.replaceAll("-SNAPSHOT", "") + " JavaDoc",
"-noqualifier", "java.lang",
"-tag", "return:X",
// `doclint` is disabled on Circle CI. Need to enable it manually to test our javadoc.
"-Xdoclint:all"
),
unidocAllSources in(JavaUnidoc, unidoc) := {
(unidocAllSources in(JavaUnidoc, unidoc)).value
// ignore any internal Scala code
.map(_.filterNot(_.getName.contains("$")))
.map(_.filterNot(_.getCanonicalPath.contains("/internal/")))
// ignore project `hive` which depends on this project
.map(_.filterNot(_.getCanonicalPath.contains("/hive/")))
},
// Ensure unidoc is run with tests. Must be cleaned before test for unidoc to be generated.
(test in Test) := ((test in Test) dependsOn unidoc.in(Compile)).value
)
.settings(releaseSettings)
lazy val goldenTables = (project in file("golden-tables")) settings (
name := "golden-tables",
commonSettings,
skipReleaseSettings,
libraryDependencies ++= Seq(
// Test Dependencies
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.apache.spark" % "spark-sql_2.12" % "3.0.0" % "test",
"io.delta" % "delta-core_2.12" % "0.7.0" % "test",
"commons-io" % "commons-io" % "2.8.0" % "test",
"org.apache.spark" % "spark-catalyst_2.12" % "3.0.0" % "test" classifier "tests",
"org.apache.spark" % "spark-core_2.12" % "3.0.0" % "test" classifier "tests",
"org.apache.spark" % "spark-sql_2.12" % "3.0.0" % "test" classifier "tests"
)
)
lazy val sqlDeltaImport = (project in file("sql-delta-import"))
.settings (
name := "sql-delta-import",
commonSettings,
publishArtifact := scalaBinaryVersion.value == "2.12",
publishArtifact in Test := false,
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided",
"io.delta" % "delta-core_2.12" % "0.7.0" % "provided",
"org.rogach" %% "scallop" % "3.5.1",
"org.scalatest" %% "scalatest" % "3.1.1" % "test",
"com.h2database" % "h2" % "1.4.200" % "test",
"org.apache.spark" % "spark-catalyst_2.12" % "3.0.0" % "test",
"org.apache.spark" % "spark-core_2.12" % "3.0.0" % "test",
"org.apache.spark" % "spark-sql_2.12" % "3.0.0" % "test"
)
)
.settings(releaseSettings)