forked from apache/iceberg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
437 lines (367 loc) · 13.4 KB
/
build.gradle
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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
buildscript {
repositories {
jcenter()
gradlePluginPortal()
maven { url "http://palantir.bintray.com/releases" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.0.0'
classpath 'com.palantir.baseline:gradle-baseline-java:0.55.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.14.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:2.1.0'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.4.8'
classpath 'com.netflix.nebula:nebula-publishing-plugin:9.5.0'
}
}
plugins {
id 'nebula.netflixoss' version '4.1.0'
id 'com.palantir.git-version' version '0.9.1'
id 'com.palantir.consistent-versions' version '1.9.2'
}
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This build must be run with Java 8")
}
allprojects {
group = "org.apache.iceberg"
apply plugin: 'com.palantir.baseline-idea'
version = gitVersion()
repositories {
maven { url "http://palantir.bintray.com/releases" }
mavenCentral()
mavenLocal()
}
}
apply plugin: 'com.palantir.baseline-config'
subprojects {
apply plugin: 'nebula.javadoc-jar'
apply plugin: 'nebula.source-jar'
apply plugin: 'java'
apply plugin: 'maven' // make pom files for deployment
apply plugin: 'nebula.maven-base-publish'
compileJava {
options.encoding = "UTF-8"
}
compileTestJava {
options.encoding = "UTF-8"
}
configurations {
testCompile.extendsFrom compileOnly
all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}
ext {
jmhVersion = '1.21'
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
dependencies {
compile 'org.slf4j:slf4j-api'
compile 'com.google.guava:guava'
testCompile 'junit:junit'
testCompile 'org.slf4j:slf4j-simple'
testCompile 'org.mockito:mockito-core'
}
publishing {
publications {
nebula(MavenPublication) {
from components.java
versionMapping {
allVariants {
fromResolutionResult()
}
}
}
}
}
}
task aggregateJavadoc(type: Javadoc) {
// use the branch name in place of version in Javadoc
project.rootProject.version = versionDetails().branchName
dependsOn subprojects.javadoc
source subprojects.javadoc.source
destinationDir project.rootProject.file("site/docs/javadoc/${versionDetails().branchName}")
classpath = project.rootProject.files(subprojects.javadoc.classpath)
}
task removeJavadoc(type: Exec) {
commandLine 'rm', '-rf', "site/docs/javadoc/${versionDetails().branchName}"
}
task refreshJavadoc(type: Exec) {
dependsOn aggregateJavadoc
dependsOn removeJavadoc
aggregateJavadoc.mustRunAfter removeJavadoc
commandLine 'git', 'add', "site/docs/javadoc/${versionDetails().branchName}"
}
task deploySite(type: Exec) {
workingDir 'site'
commandLine 'mkdocs', 'gh-deploy'
}
// The following code is temporary to allow for incrementally migrating projects to use Baseline.
// We enable baseline-idea everywhere so that everyone can use IntelliJ to build code against the
// Baseline style guide.
def baselineProjects = [ project("iceberg-api"), project("iceberg-common"), project("iceberg-core"),
project("iceberg-data"), project("iceberg-orc"), project("iceberg-spark"),
project("iceberg-hive") ]
configure(subprojects - baselineProjects) {
// error-prone is brought in with baseline-idea, but we're not prepared to handle error-prone
// linting errors everywhere yet.
pluginManager.withPlugin("com.palantir.baseline-error-prone") {
tasks.withType(JavaCompile).configureEach { task ->
options.errorprone.enabled = false
}
}
}
configure(baselineProjects) {
// Currently, if any subproject applies the blanket Baseline plugin, it forces the Baseline plugin
// to be applied to ALL projects. And we are not prepared to address all of the build errors that
// occur as a result at this time. Furthermore, baseline-format will not work out of the box for
// us - see below.
// Thus we concede to applying all of the Baseline plugins individually on all the projects we are
// ready to enforce linting on.
apply plugin: 'org.inferred.processors'
apply plugin: 'com.palantir.baseline-checkstyle'
apply plugin: 'com.palantir.baseline-error-prone'
apply plugin: 'com.palantir.baseline-scalastyle'
apply plugin: 'com.palantir.baseline-class-uniqueness'
apply plugin: 'com.palantir.baseline-reproducibility'
apply plugin: 'com.palantir.baseline-exact-dependencies'
apply plugin: 'com.palantir.baseline-release-compatibility'
// Can't use the built-in Baseline spotless format because it's opinionated about the import
// order of having static imports after non-static imports, and this cannot be overridden.
// So we apply Spotless manually to get a similar effect to baseline-format, but change the
// import order.
pluginManager.withPlugin('com.diffplug.gradle.spotless') {
spotless {
java {
target 'src/main/java/**/*.java', 'src/main/test/**/*.java'
removeUnusedImports()
importOrder(['', 'static '])
trimTrailingWhitespace()
indentWithSpaces 2
endWithNewline()
}
}
}
}
def jmhProjects = [ project("iceberg-spark") ]
configure(jmhProjects) {
apply plugin: 'me.champeau.gradle.jmh'
jmh {
jmhVersion = jmhVersion
failOnError = true
forceGC = true
includeTests = true
humanOutputFile = file(jmhOutputPath)
include = [jmhIncludeRegex]
}
}
project(':iceberg-api') {
dependencies {
testCompile "org.apache.avro:avro"
testCompile 'joda-time:joda-time'
}
}
project(':iceberg-common') {}
project(':iceberg-core') {
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-common')
compile("org.apache.avro:avro") {
exclude group: 'org.tukaani' // xz compression is not supported
}
compile "com.fasterxml.jackson.core:jackson-databind"
compile "com.fasterxml.jackson.core:jackson-core"
compile "com.github.ben-manes.caffeine:caffeine"
compileOnly("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}
}
project(':iceberg-data') {
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-core')
compileOnly project(':iceberg-parquet')
testCompile("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}
test {
// Only for TestSplitScan as of Gradle 5.0+
maxHeapSize '1500m'
}
}
project(':iceberg-hive') {
dependencies {
compile project(':iceberg-core')
compileOnly "org.apache.avro:avro"
compileOnly("org.apache.hive:hive-metastore") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
}
// By default, hive-exec is a fat/uber jar and it exports a guava library
// that's really old. We use the core classifier to be able to override our guava
// version. Luckily, hive-exec seems to work okay so far with this version of guava
// See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context.
testCompile("org.apache.hive:hive-exec::core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
}
testCompile("org.apache.hive:hive-metastore") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
}
compileOnly("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}
task testJar(type: Jar){
archiveClassifier = 'tests'
from sourceSets.test.output
}
configurations {
testArtifacts
}
artifacts {
testArtifacts testJar
}
}
project(':iceberg-orc') {
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-core')
compile("org.apache.orc:orc-core::nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'org.apache.hive', module: 'hive-storage-api'
}
compileOnly("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
}
}
}
project(':iceberg-parquet') {
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-core')
compile("org.apache.parquet:parquet-avro") {
exclude group: 'org.apache.avro', module: 'avro'
// already shaded by Parquet
exclude group: 'it.unimi.dsi'
exclude group: 'org.codehaus.jackson'
}
compileOnly "org.apache.avro:avro"
compileOnly("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
}
}
}
project(':iceberg-spark') {
apply plugin: 'scala'
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-common')
compile project(':iceberg-core')
compile project(':iceberg-orc')
compile project(':iceberg-parquet')
compile project(':iceberg-hive')
compileOnly "org.apache.avro:avro"
compileOnly("org.apache.spark:spark-hive_2.11") {
exclude group: 'org.apache.avro', module: 'avro'
}
testCompile "org.apache.hadoop:hadoop-hdfs::tests"
testCompile "org.apache.hadoop:hadoop-common::tests"
testCompile("org.apache.hadoop:hadoop-minicluster") {
exclude group: 'org.apache.avro', module: 'avro'
}
testCompile project(path: ':iceberg-hive', configuration: 'testArtifacts')
}
}
project(':iceberg-pig') {
dependencies {
compile project(':iceberg-api')
compile project(':iceberg-common')
compile project(':iceberg-core')
compile project(':iceberg-parquet')
compileOnly("org.apache.pig:pig") {
exclude group: "junit", module: "junit"
}
compileOnly("org.apache.hadoop:hadoop-mapreduce-client-core")
compileOnly("org.apache.hadoop:hadoop-client") {
exclude group: 'org.apache.avro', module: 'avro'
}
testCompile "org.apache.hadoop:hadoop-hdfs::tests"
testCompile "org.apache.hadoop:hadoop-common::tests"
testCompile("org.apache.hadoop:hadoop-minicluster") {
exclude group: 'org.apache.avro', module: 'avro'
}
}
}
// the runtime jar is a self-contained artifact for testing in a notebook
project(':iceberg-spark-runtime') {
apply plugin: 'com.github.johnrengelman.shadow'
tasks.build.dependsOn tasks.shadowJar
tasks.install.dependsOn tasks.shadowJar
tasks.javadocJar.dependsOn tasks.shadowJar
configurations {
compile {
// included in Spark
exclude group: 'org.slf4j'
exclude group: 'org.apache.commons'
exclude group: 'commons-pool'
exclude group: 'commons-codec'
exclude group: 'org.xerial.snappy'
exclude group: 'javax.xml.bind'
}
}
dependencies {
compileOnly project(':iceberg-spark')
}
shadowJar {
// shade compileOnly dependencies to avoid including in transitive dependencies
configurations = [project.configurations.compileOnly]
zip64 true
// Relocate dependencies to avoid conflicts
relocate 'com.google', 'org.apache.iceberg.shaded.com.google'
relocate 'com.fasterxml', 'org.apache.iceberg.shaded.com.fasterxml'
relocate 'com.github.benmanes', 'org.apache.iceberg.shaded.com.github.benmanes'
relocate 'org.checkerframework', 'org.apache.iceberg.shaded.org.checkerframework'
relocate 'org.apache.avro', 'org.apache.iceberg.shaded.org.apache.avro'
relocate 'avro.shaded', 'org.apache.iceberg.shaded.org.apache.avro.shaded'
relocate 'com.thoughtworks.paranamer', 'org.apache.iceberg.shaded.com.thoughtworks.paranamer'
relocate 'org.apache.parquet', 'org.apache.iceberg.shaded.org.apache.parquet'
relocate 'shaded.parquet', 'org.apache.iceberg.shaded.org.apache.parquet.shaded'
// relocate Avro's jackson dependency to share parquet-jackson locations
relocate 'org.codehaus.jackson', 'org.apache.iceberg.shaded.org.apache.parquet.shaded.org.codehaus.jackson'
relocate 'org.apache.orc', 'org.apache.iceberg.shaded.org.apache.orc'
relocate 'io.airlift', 'org.apache.iceberg.shaded.io.airlift'
archiveName = "iceberg-spark-runtime-${version}.${extension}"
}
}