-
Notifications
You must be signed in to change notification settings - Fork 395
/
build.gradle
390 lines (350 loc) · 14.3 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
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'org.github.ngbinh.scalastyle:gradle-scalastyle-plugin_2.11:1.0.1'
classpath 'com.commercehub.gradle.plugin:gradle-avro-plugin:0.16.0'
}
}
plugins {
id 'org.scoverage' version '2.5.0'
id 'net.minecrell.licenser' version '0.4.1'
id 'com.github.jk1.dependency-license-report' version '0.5.0'
id 'com.github.johnrengelman.shadow' version '5.0.0'
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
apply from: 'gradle/version-properties.gradle'
def allProjs = allprojects - project(':templates').subprojects
def subProjs = subprojects - project(':templates').subprojects
// distribute to all projects
ext.subProjs = subProjs
configure(allProjs) {
apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'scala'
// apply plugin: 'findbugs'
apply plugin: 'org.scoverage'
apply plugin: 'scalaStyle'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'project-report'
apply plugin: 'com.commercehub.gradle.plugin.avro'
apply plugin: 'net.minecrell.licenser'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.8
targetCompatibility = 1.8
// The main class for the application plugin and is currently unused. Setting a dummy one.
mainClassName = "please.set.main.class.in.build.gradle"
ext {
scalaVersion = '2.11'
scalaVersionRevision = '12'
scalaTestVersion = '3.0.5'
scalaCheckVersion = '1.14.0'
junitVersion = '4.12'
avroVersion = '1.8.2'
sparkVersion = '2.4.5'
scalaGraphVersion = '1.12.5'
scalafmtVersion = '1.5.1'
hadoopVersion = 'hadoop2'
json4sVersion = '3.5.3' // matches Spark dependency version
jodaTimeVersion = '2.9.4'
jodaConvertVersion = '1.8.1'
algebirdVersion = '0.13.4'
jacksonVersion = '2.7.3'
luceneVersion = '7.3.0'
enumeratumVersion = '1.4.12'
scoptVersion = '3.5.0'
googleLibPhoneNumberVersion = '8.8.5'
googleGeoCoderVersion = '2.82'
googleCarrierVersion = '1.72'
chillVersion = '0.9.3'
reflectionsVersion = '0.9.11'
collectionsVersion = '3.2.2'
optimaizeLangDetectorVersion = '0.0.1'
tikaVersion = '1.22'
sparkTestingBaseVersion = '2.4.3_0.12.0'
sourceCodeVersion = '0.1.3'
pegdownVersion = '1.4.2'
commonsValidatorVersion = '1.6'
commonsIOVersion = '2.6'
scoveragePluginVersion = '1.3.1'
xgboostVersion = '0.90'
akkaSlf4jVersion = '2.3.11'
mleapVersion = '0.16.0'
memoryFilesystemVersion = '2.1.0'
}
configurations {
scalaLibrary
scalaCompiler
}
dependencies {
// Scala
zinc 'com.typesafe.zinc:zinc:0.3.15'
scoverage "org.scoverage:scalac-scoverage-plugin_$scalaVersion:$scoveragePluginVersion"
scoverage "org.scoverage:scalac-scoverage-runtime_$scalaVersion:$scoveragePluginVersion"
scalaLibrary "org.scala-lang:scala-library:$scalaVersion.$scalaVersionRevision"
scalaCompiler "org.scala-lang:scala-compiler:$scalaVersion.$scalaVersionRevision"
compile "org.scala-lang:scala-library:$scalaVersion.$scalaVersionRevision"
// Spark
compileOnly "org.apache.spark:spark-core_$scalaVersion:$sparkVersion"
testCompile "org.apache.spark:spark-core_$scalaVersion:$sparkVersion"
compileOnly "org.apache.spark:spark-mllib_$scalaVersion:$sparkVersion"
testCompile "org.apache.spark:spark-mllib_$scalaVersion:$sparkVersion"
compileOnly "org.apache.spark:spark-sql_$scalaVersion:$sparkVersion"
testCompile "org.apache.spark:spark-sql_$scalaVersion:$sparkVersion"
// Test
compileOnly "org.scalatest:scalatest_$scalaVersion:$scalaTestVersion"
testCompile "org.scalatest:scalatest_$scalaVersion:$scalaTestVersion"
compileOnly "org.scalacheck:scalacheck_$scalaVersion:$scalaCheckVersion"
testCompile "org.scoverage:scalac-scoverage-plugin_$scalaVersion:$scoveragePluginVersion"
testCompile "org.scoverage:scalac-scoverage-runtime_$scalaVersion:$scoveragePluginVersion"
testCompile "org.scalacheck:scalacheck_$scalaVersion:$scalaCheckVersion"
testCompile ("com.holdenkarau:spark-testing-base_$scalaVersion:$sparkTestingBaseVersion") { transitive = false }
testCompile "junit:junit:$junitVersion"
testRuntime "org.pegdown:pegdown:$pegdownVersion"
}
configurations.all {
resolutionStrategy {
force "commons-collections:commons-collections:$collectionsVersion",
"org.scala-lang:scala-library:$scalaVersion.$scalaVersionRevision",
"org.scala-lang:scala-reflect:$scalaVersion.$scalaVersionRevision"
}
}
configurations.zinc {
resolutionStrategy {
force 'org.scala-lang:scala-library:2.10.6', 'org.scala-lang:scala-reflect:2.10.6'
}
}
tasks.withType(ScalaCompile) {
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
jvmArgs = ['-XX:MaxMetaspaceSize=256m']
}
scalaCompileOptions.additionalParameters = [
"-Yrangepos", "-feature",
"-language:implicitConversions", "-language:existentials", "-language:postfixOps"
]
}
compileScala.scalaCompileOptions.additionalParameters += "-optimize"
[compileJava, compileTestJava]*.options.collect { options -> options.encoding = 'UTF-8' }
jar {
manifest.attributes "Main-Class": "$mainClassName"
baseName = "$rootProject.name"
}
if (System.getenv("CI") != 'true') {
jar.dependsOn(createVersionProperties)
}
scalaStyle {
configLocation = "$rootProject.rootDir/gradle/scalastyle-config.xml"
includeTestSourceDirectory = true
source = "src/main/scala"
testSource = "src/test/scala"
}
if (System.getenv("CI") != 'true') {
compileScala.dependsOn(scalaStyle)
}
avro {
createSetters = true
fieldVisibility = "PUBLIC_DEPRECATED"
outputCharacterEncoding = "UTF-8"
stringType = "String"
}
sourceSets {
main {
java {
srcDir 'build/generated-main-avro-java'
}
}
scoverage {
runtimeClasspath += sourceSets.main.output
compileClasspath += sourceSets.main.output
}
testScoverage {
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
compileClasspath += sourceSets.main.output + sourceSets.test.output
}
}
license {
header = rootProject.file('LICENSE')
ignoreFailures = true
include '**/*.java', '**/*.scala'
exclude '**/org/apache/spark/ml/SparkDefaultParamsReadWrite.scala',
'**/com/salesforce/op/test/TestSparkContext.scala',
'**/com/salesforce/op/test/TempDirectoryTest.scala',
'**/com/salesforce/op/stages/impl/tuning/OpCrossValidation.scala',
'**/com/salesforce/op/stages/impl/tuning/OpTrainValidationSplit.scala',
'**/com/salesforce/op/test/*.java',
'**/com/fasterxml/jackson/module/scala/**',
'**/com/salesforce/op/utils/stats/StreamingHistogram.java',
'**/com/salesforce/app/schema/PassengerDataAll.java',
'**/templates/**', '**/resources/**'
}
scoverage {
coverageOutputCobertura = false
}
licenseReport {
renderer = new com.github.jk1.license.render.MultiReportRenderer(
new com.github.jk1.license.render.CsvReportRenderer(),
new com.github.jk1.license.render.InventoryHtmlReportRenderer()
)
}
shadowJar {
zip64 = true
exclude 'META-INF/**'
baseName = jar.baseName
}
shadowJar.dependsOn(createVersionProperties)
/* findbugs {
toolVersion = '3.0.1'
sourceSets = [sourceSets.main]
ignoreFailures = true
reportsDir = file("$project.buildDir/reports/findbugs")
effort = 'max'
reportLevel = 'low'
includeFilter = file("$rootProject.projectDir/gradle/findbugs-include.xml")
excludeFilter = file("$rootProject.projectDir/gradle/findbugs-exclude.xml")
} */
task runMain(type: JavaExec) {
description 'Run a main class, i.e.: runMain -Dmain=MyMainClass -Dargs="arg1 arg2 arg3"'
main = System.getProperty("main")
classpath = sourceSets.main.runtimeClasspath
systemProperties = System.getProperties()
args = System.getProperty("args", "") == "" ? new LinkedList<String>() : Arrays.asList(System.getProperty("args").split(" "))
}
task repl(type: JavaExec) {
description 'Start Scala repl.'
main = "scala.tools.nsc.MainGenericRunner"
classpath = sourceSets.main.runtimeClasspath + configurations.scalaCompiler
standardInput System.in
args '-usejavacp'
}
task classpath {
doLast {
description 'Print project classpath.'
println sourceSets.main.runtimeClasspath.asPath
}
}
if (System.getenv("TEST_FILES") != null) {
testScoverage.setIncludes(Arrays.asList(System.getenv("TEST_FILES").split('\n')))
}
}
wrapper {
gradleVersion = '5.2'
distributionType = Wrapper.DistributionType.BIN
distributionSha256Sum = 'ff322863250159595e93b5a4d17a6f0d21c59a1a0497c1e1cf1d53826485503f'
}
task aggregateScoverage(type: org.scoverage.ScoverageAggregate) {
description 'Aggregates scoverage reports of all subprojects.'
}
configure(subProjs) {
apply from: "$rootProject.projectDir/gradle/tests.gradle"
apply from: "$rootProject.projectDir/gradle/spark.gradle"
jar.baseName = "$rootProject.name-$project.name"
// ignore link warning in scaladoc
scaladoc.scalaDocOptions.additionalParameters = ['-no-link-warnings']
task scaladocJar(type: Jar, dependsOn: scaladoc) {
classifier = 'javadoc'
from scaladoc.destinationDir
}
scaladocJar.baseName = jar.baseName
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
sourcesJar.baseName = jar.baseName
artifacts {
archives jar, sourcesJar, scaladocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar { classifier 'sources' }
artifact scaladocJar { classifier 'javadoc' }
afterEvaluate {
artifactId = "${jar.baseName}_$scalaVersion"
}
pom {
name = 'TransmogrifAI'
description = 'AutoML library for building modular, reusable, strongly typed machine learning workflows on Spark with minimal hand tuning'
url = 'https://github.com/salesforce/TransmogrifAI'
scm {
connection = 'scm:git:https://github.com/salesforce/TransmogrifAI.git'
developerConnection = 'scm:git:https://github.com/salesforce/TransmogrifAI.git'
url = 'https://github.com/salesforce/TransmogrifAI'
}
licenses {
license {
name = 'BSD-3-Clause'
url = 'https://github.com/salesforce/TransmogrifAI/blob/master/LICENSE'
distribution = 'repo'
}
}
developers {
developer {
id = 'tovbinm'
name = 'Matthew Tovbin'
email = 'tovbinm@gmail.com'
}
developer {
id = 'leahmcguire'
name = 'Leah McGuire'
email = 'lmcguire@salesforce.com'
}
}
}
}
}
repositories {
// Disable Sonatype publication for now
// maven {
// // Note: requires 'nexusUsername' and 'nexusPassword' to be set in ~/.gradle/gradle.properties file
// url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
// credentials {
// username nexusUsername
// password nexusPassword
// }
// }
// Disable Bintray publication for now
// maven {
// // Note: requires 'bintrayUsername' and 'bintrayPassword' to be set in ~/.gradle/gradle.properties file
// url "https://api.bintray.com/maven/salesforce/maven/TransmogrifAI/;publish=1"
// credentials {
// username bintrayUsername
// password bintrayPassword
// }
// }
}
}
if (System.getenv("SIGN_RELEASE") == 'true') {
signing {
// For signing to work read - https://docs.gradle.org/current/userguide/signing_plugin.html
// Most importantly:
// 1. Install & configure GPGTools - https://gpgtools.org
// 2. Copy the full 40 character key id from the output of the command: gpg2 -K
// 3. Set 'signing.gnupg.keyName=<key id>' in ~/.gradle/gradle.properties file
// 4. If you protect your key with a passphrase add 'signing.password=<secret>' in ~/.gradle/gradle.properties file
useGpgCmd()
sign publishing.publications.mavenJava
}
}
}
task allScaladoc(type: ScalaDoc) {
group 'Documentation'
description 'Generates Scaladoc for the main source code of all subprojects.'
title 'TransmogrifAI'
source subProjs.collect { it.sourceSets.main.allJava + it.sourceSets.main.allScala }
classpath = files(subProjs.collect { it.sourceSets.main.compileClasspath })
destinationDir = file("build/scaladoc")
}
// run by Heroku to build docs
task stage(dependsOn: ':allScaladoc')