forked from azkaban/azkaban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
296 lines (265 loc) · 11.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
/*
* Copyright 2018 LinkedIn Corp.
*
* 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.
*/
buildscript {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.cinnober.gradle:semver-git:2.2.3'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.14'
}
}
plugins {
id 'com.gradle.build-scan' version '3.2'
id 'com.github.kt3k.coveralls' version '2.6.3'
id 'jacoco'
id 'idea'
}
// https://docs.gradle.com/enterprise/gradle-plugin/#connecting_to_scans_gradle_com
gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
apply plugin: 'com.cinnober.gradle.semver-git'
apply plugin: 'compare-gradle-builds'
compareGradleBuilds {
targetBuild.gradleVersion = "4.0"
}
allprojects {
apply plugin: 'jacoco'
repositories {
mavenCentral()
mavenLocal()
// need this for rest.li/pegasus 28.* artifacts until they are in Maven Central:
maven {
url 'https://linkedin.jfrog.io/artifactory/open-source/'
}
}
}
ext.versions = [hadoop: '2.10.0',
hive : '1.1.0',
pig : '0.11.0',
restli: '29.16.0',
slf4j : '1.7.18',]
ext.deps = [
// External dependencies
// restli 1.* had this one included transitively. restli 28.* doesn't. But we still need it:
json : 'org.json:json:20170516',
assertj : 'org.assertj:assertj-core:3.8.0',
awaitility : 'org.awaitility:awaitility:3.0.0',
collections : 'commons-collections:commons-collections:3.2.2',
commonsCli : 'commons-cli:commons-cli:1.3.1',
commonsLang : 'commons-lang:commons-lang:2.6',
commonsCodec : 'commons-codec:commons-codec:1.13',
commonsCompress : 'org.apache.commons:commons-compress:1.16.1',
dbcp2 : 'org.apache.commons:commons-dbcp2:2.7.0',
dbutils : 'commons-dbutils:commons-dbutils:1.5',
fileupload : 'commons-fileupload:commons-fileupload:1.2.1',
gson : 'com.google.code.gson:gson:2.8.1',
guava : 'com.google.guava:guava:21.0',
guice : 'com.google.inject:guice:4.1.0',
h2 : 'com.h2database:h2:1.4.193',
hadoopAnnotations : "org.apache.hadoop:hadoop-annotations:" + versions.hadoop,
hadoopAuth : "org.apache.hadoop:hadoop-auth:" + versions.hadoop,
hadoopCommon : "org.apache.hadoop:hadoop-common:" + versions.hadoop,
hadoopHdfs : "org.apache.hadoop:hadoop-hdfs:" + versions.hadoop,
hadoopMRClientCommon : "org.apache.hadoop:hadoop-mapreduce-client-common:" + versions.hadoop,
hadoopMRClientCore : "org.apache.hadoop:hadoop-mapreduce-client-core:" + versions.hadoop,
hiveCli : "org.apache.hive:hive-cli:" + versions.hive,
hiveExecCore : "org.apache.hive:hive-exec:" + versions.hive + ":core",
hiveMetastore : "org.apache.hive:hive-metastore:" + versions.hive,
httpclient : 'org.apache.httpcomponents:httpclient:4.5.3',
io : 'commons-io:commons-io:2.4',
jacksonCoreAsl : 'org.codehaus.jackson:jackson-core-asl:1.9.5',
jacksonMapperAsl : 'org.codehaus.jackson:jackson-mapper-asl:1.9.5',
javaxElApi : 'javax.el:javax.el-api:3.0.0',
javaxEl : 'org.glassfish:javax.el:3.0.0',
jetty : 'org.mortbay.jetty:jetty:6.1.26',
jettyUtil : 'org.mortbay.jetty:jetty-util:6.1.26',
jexl : 'org.apache.commons:commons-jexl:2.1.1',
jodaTime : 'joda-time:joda-time:2.0',
jopt : 'net.sf.jopt-simple:jopt-simple:5.0.3',
jsr305 : 'com.google.code.findbugs:jsr305:3.0.2',
junit : 'junit:junit:4.12',
kafkaLog4jAppender : 'org.apache.kafka:kafka-log4j-appender:0.10.0.0',
k8sClient : 'io.kubernetes:client-java:15.0.1',
k8sClientFluent : 'io.kubernetes:client-java-api-fluent:15.0.1',
log4j : 'log4j:log4j:1.2.16',
mail : 'com.sun.mail:javax.mail:1.6.2',
math3 : 'org.apache.commons:commons-math3:3.0',
metricsCore : 'io.dropwizard.metrics:metrics-core:3.2.6',
metricsJvm : 'io.dropwizard.metrics:metrics-jvm:3.2.6',
mockito : 'org.mockito:mockito-core:2.28.2',
mongoDriver : 'org.mongodb:mongo-java-driver:2.14.0',
mysqlConnector : 'mysql:mysql-connector-java:8.0.20',
pig : 'org.apache.pig:pig:' + versions.pig,
parquetAvro : 'com.twitter:parquet-avro:1.6.0',
parquetBundle : 'com.twitter:parquet-hadoop-bundle:1.3.2',
powermock : 'org.powermock:powermock-api-mockito2:2.0.2',
powermockmodulejunit4: 'org.powermock:powermock-module-junit4:2.0.2',
quartz : 'org.quartz-scheduler:quartz:2.2.1',
restliGenerator : 'com.linkedin.pegasus:generator:' + versions.restli,
restliServer : 'com.linkedin.pegasus:restli-server:' + versions.restli,
restliTools : 'com.linkedin.pegasus:restli-tools:' + versions.restli,
slf4j : 'org.slf4j:slf4j-api:' + versions.slf4j,
slf4jLog4j : 'org.slf4j:slf4j-log4j12:' + versions.slf4j,
sparkCore : 'org.apache.spark:spark-core_2.12:3.3.0',
springTest : 'org.springframework:spring-test:3.2.18.RELEASE',
snakeyaml : 'org.yaml:snakeyaml:1.18',
velocity : 'org.apache.velocity:velocity-engine-core:2.3',
velocityTools : 'org.apache.velocity.tools:velocity-tools-generic:3.1',
bcprov : 'org.bouncycastle:bcprov-jdk15on:1.54',
jacksonAnnotation : 'com.fasterxml.jackson.core:jackson-annotations:2.7.4',
jacksonDatabind : 'com.fasterxml.jackson.core:jackson-databind:2.7.4',
jasypt : 'org.jasypt:jasypt:1.9.2',
jacksonCore : 'com.fasterxml.jackson.core:jackson-core:2.9.2',
jsonassert : 'org.skyscreamer:jsonassert:1.5.0',
systemRules : 'com.github.stefanbirkner:system-rules:1.19.0',
javaxValidation : 'javax.validation:validation-api:2.0.1.Final',
hibernateValidator : 'org.hibernate:hibernate-validator:6.1.5.Final',
failsafe : 'dev.failsafe:failsafe:3.2.4']
subprojects {
apply plugin: 'java'
apply plugin: 'net.ltgt.errorprone'
// Set the same version for all sub-projects to root project version
version = rootProject.version
configurations.errorprone {
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.1.0'
}
}
plugins.withType(JavaPlugin) {
sourceCompatibility = JavaVersion.VERSION_1_8
/*
TODO remove afterEvaluate block
After Evaluate block was added to do a lazy evaluation. This piece of code gets executed by gradle in the
configuration phase. However, for some reason the version field was not updated by the LinkedIn build
infrastructure. Thus, using afterEvaluate to do a lazy evaluation of this code block.
More specifically afterEvaluate kicks in after the rest of the project is configured
See: http://stackoverflow.com/questions/16218888/can-gradle-extensions-handle-lazy-evaluation-of-a-property
See: http://stackoverflow.com/questions/16070567/difference-between-gradles-terms-evaluation-and-execution
*/
project.afterEvaluate {
// Set the Title and Version fields in the jar
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}
}
dependencies {
compile deps.log4j
compile deps.guice
compile deps.slf4j
runtime deps.slf4jLog4j
testCompile deps.assertj
testCompile deps.junit
testCompile deps.mockito
testCompile deps.powermock
testCompile deps.powermockmodulejunit4
testCompile deps.jsonassert
testCompile deps.awaitility
testCompile deps.springTest
}
test {
// Set maxParallelForks to a large number and let gradle to force it to a the
// max-workers number when needed.
// NOTE! For some reason anything more than 1 doesn't work well for azkaban build:
// any maxParallelForks > 1 seems to make `./gradlew cleanTest test` ~4 times slower
maxParallelForks = 1
}
}
// Common distribution plugin settings for sub-modules
plugins.withType(DistributionPlugin) {
distTar {
compression = Compression.GZIP
extension = 'tar.gz'
}
}
/**
* Terminate compilation if warnings occur.*/
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Werror"]
}
/**
* Print test execution summary when informational logging is enabled.*/
test {
testLogging {
exceptionFormat = 'full'
afterSuite { desc, result ->
if (desc.getParent()) {
logger.info desc.getName()
} else {
logger.info "Overall"
}
logger.info " ${result.resultType} (" + "${result.testCount} tests, " +
"${result.successfulTestCount} passed, " + "${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped)"
}
}
}
}
/**
* Gradle wrapper task.
* https://docs.gradle.org/5.2.1/userguide/gradle_wrapper.html#customizing_wrapper
* https://stackoverflow.com/questions/53709282/cannot-add-task-wrapper-as-a-task-with-that-name-already-exists
**/
wrapper {
distributionType('ALL')
}
if (System.env.TRAVIS == 'true') {
allprojects {
tasks.withType(Test) {
// Reduce the memory pressure on the Travis CI to reduce build failures.
maxParallelForks = 2
minHeapSize = '512m'
maxHeapSize = '4g'
outputs.upToDateWhen { false }
}
}
}
def publishedProjects = subprojects.findAll()
// Aggregate all subproject reports into one.
task jacocoAggregateReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn(publishedProjects.test)
// JacocoReport-type task requires users to specify which classes to be covered
// See details in
// https://docs.gradle.org/current/dsl/org.gradle.testing.jacoco.tasks.JacocoReport.html
sourceDirectories = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(publishedProjects.sourceSets.main.output)
executionData = files(publishedProjects.jacocoTestReport.executionData)
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}
coveralls {
sourceDirs = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoAggregateReport/jacocoAggregateReport.xml"
}
tasks.coveralls {
dependsOn jacocoAggregateReport
}