forked from h2oai/h2o-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
348 lines (303 loc) · 10.6 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
import org.apache.tools.ant.taskdefs.condition.Os
// The build script settings to fetch plugins and put them on
// classpath
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
jcenter()
}
//noinspection GroovyAssignabilityCheck
dependencies {
classpath 'org.ow2.asm:asm:5.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1'
classpath 'com.github.townsfolk:gradle-release:1.2'
classpath 'com.adaptc.gradle:nexus-workflow:0.6'
classpath 'org.testng:testng:6.8'
classpath "be.insaneprogramming.gradle:animalsniffer-gradle-plugin:+"
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.3.1'
// Note: Analyze unused/undefined dependencies for each module - good for debugging
// However, later it should be enabled by default
//classpath 'ca.cutterslade.gradle:gradle-dependency-analyze:1.1.0'
}
}
plugins {
id "java"
}
//
// The top-level h2o-3 project does not have any java pieces itself, but
// apply from the standard java.gradle so that 'gradle idea' generates IDE
// files with the right settings.
//
// The top-level jar file that gets produced is empty and not usable
// for anything. Use the jar file produced by the :h2o-assemblies:main subproject.
//
apply from: 'gradle/java.gradle'
// For multiproject setup we have to apply release plugin here (we share same release number cross all modules)
if (project.hasProperty("doRelease")) {
apply from: 'gradle/release.gradle'
}
// Print out time taken for each task so we find things that are slow.
apply from: 'gradle/timing.gradle'
//
// Common configuration
//
ext {
//
// All published projects - their artifacts are going to Maven central
publishedProjects = [
project(':h2o-core'),
project(':h2o-algos'),
project(':h2o-web'),
project(':h2o-app'),
project(':h2o-scala_2.10'),
project(':h2o-scala_2.11'),
project(':h2o-persist-hdfs'),
project(':h2o-persist-s3'),
project(':h2o-genmodel'),
project(':h2o-bindings'),
project(':h2o-avro-parser'),
project(':h2o-orc-parser'),
project(':h2o-parquet-parser'),
project(':h2o-jaas-pam')
]
javaProjects = [
project(':h2o-core'),
project(':h2o-algos'),
project(':h2o-web'),
project(':h2o-app'),
project(':h2o-persist-hdfs'),
project(':h2o-persist-s3'),
project(':h2o-test-integ'),
project(':h2o-test-accuracy'),
project(':h2o-genmodel'),
project(':h2o-bindings'),
project(':h2o-avro-parser'),
project(':h2o-orc-parser'),
project(':h2o-parquet-parser'),
project(':h2o-jaas-pam')
]
scalaProjects = [
project(':h2o-scala_2.10'),
project(':h2o-scala_2.11'),
]
rProjects = [
project(':h2o-r')
]
pythonProjects = [
project(':h2o-py')
]
// The project which need to be run under CI only
testNeedsCiProject = [
// The S3 tests needs credentials which are provided by test environment.
// Because of restrictions of Amazon they cannot be stored in repository.
project(':h2o-persist-s3'),
]
// Projects with micro-benchmarks
ubenchProjects = [
project(':h2o-core')
]
//
// Versions of libraries shared cross all projects
// The version of protoc must match protobuf-java. If you don't depend on
// protobuf-java directly, you will be transitively depending on the
// protobuf-java version that grpc depends on.
//
junitVersion = '4.12'
jets3tVersion = '0.7.1'
awsJavaSdkVersion = '1.8.3'
//
// H2O's REST API version
//
h2oRESTApiVersion = '3'
getOsSpecificCommandLine = { List<GString> args ->
return Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c'] + args : args
}
}
//
// For all projects (this and all subprojects) specify common properties and tasks
//
allprojects {
group = 'ai.h2o'
// By default inject debugging support
apply plugin: 'project-report'
apply from: "$rootDir/gradle/debug.gradle"
// Support different IDEs
apply plugin: 'idea'
apply plugin: 'eclipse'
apply from: "$rootDir/gradle/artifacts.gradle"
ext {
isRelease = rootProject.hasProperty("doRelease")
isCi = (System.getProperty("user.name").equals("jenkins")
|| System.getenv("CI") != null
|| (rootProject.hasProperty("doCI") && rootProject.doCI == "true"))
}
}
// Compute applyFindbugsPlugin property
// Gradle by default interpret boolean properties setup in config file as strings.
// Hence we need here string toBoolean call
def applyFindbugsPlugin = rootProject.hasProperty("runFindbugs") ? rootProject.runFindbugs.toBoolean() : false
//
// Common configuration for all subprojects
//
subprojects {
// All project inherits the same versioning number
version = rootProject.version
repositories {
mavenCentral()
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos/"
}
maven {
url "http://repo.hortonworks.com/content/repositories/releases/"
}
maven {
url "http://repo.hortonworks.com/content/repositories/jetty-hadoop/"
}
maven {
url "http://repository.mapr.com/maven/"
}
// mavenLocal()
}
// Publish artifacts - we should filter subproject in future but now apply publisher plugin
// to all projects
if (project in publishedProjects) {
apply from: "$rootDir/gradle/publish.gradle"
// Generate Java6 bytecode only if specified
if (project.hasProperty("doJava6Bytecode")) {
if (project.doJava6Bytecode == "true"
|| (project.doJava6Bytecode == "auto"
&& System.getProperty("user.name").equals("jenkins")
&& System.getenv("JAVA_6_HOME"))) {
apply from: "$rootDir/gradle/java6bytecode.gradle"
// Always do animal sniffing for java6
ext.doAnimalSniffer = "true"
}
}
}
apply from: "$rootDir/gradle/makeSupport.gradle"
//
// Early configuration of projects simplifies build resolution
//
// Configure Java projects
if (project in javaProjects) {
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/cp.gradle"
// Include Findbugs only if the property is specified
if (applyFindbugsPlugin) {
apply from: "$rootDir/gradle/findbugs.gradle"
}
if (project.hasProperty("doCheckStyle")) {
apply from: "$rootDir/gradle/checkstyle.gradle"
}
if (project.hasProperty("doAnimalSniffer") && project.doAnimalSniffer == "true") {
apply from: "$rootDir/gradle/animalSniffer.gradle"
}
if (testNeedsCiProject.contains(project)) {
logger.warn("The project $project needs CI for running tests! You can pass `-PdoCI=true` to force CI behaviour.")
project.testMultiNode.enabled = project.ext.isCi
}
// Analyze dependencies
//apply plugin: 'ca.cutterslade.analyze'
}
// Configure Scala projects
if (project in scalaProjects) {
apply from: "$rootDir/gradle/scala.gradle"
apply from: "$rootDir/gradle/cp.gradle"
if (testNeedsCiProject.contains(project)) {
logger.warn("The project $project needs CI for running tests! You can pass `-PdoCI=true` to force CI behaviour.")
project.testMultiNode.enabled = project.ext.isCi
}
}
if (project in rProjects) {
apply from: "$rootDir/gradle/r.gradle"
}
if (project in pythonProjects) {
apply from: "$rootDir/gradle/r.gradle" // same plugins
}
if (project in ubenchProjects) {
if (project.hasProperty("doUBench") && project.doUBench == "true") {
apply from: "$rootDir/gradle/ubench.gradle"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
//
// Setup global properties shared by all projects
//
ext {
// Collect all artifacts produced by all projects in this project - all "archives" artifacts
allArchives = subprojects.findAll().inject(
files(), { acc, pj ->
if (pj in publishedProjects)
acc + pj.configurations.archives.allArtifacts.getFiles()
else
acc
})
// Collect all test artifacts
allTestArchives = files() // filed lazily below
}
// After evaluation of all projects collect all artifacts produced by testArchives configuration
subprojects {
afterEvaluate( { pj ->
def testCnf = pj.configurations.findAll().find({ it.getName().equals("testArchives") })
if (testCnf != null) allTestArchives = allTestArchives + testCnf.allArtifacts.getFiles()
} )
}
// Include support for S3 syncing
apply from: "gradle/s3sync.gradle"
// This task is used by the Jenkins on test.h2o.ai.
//
// It creates a directory called 'target', copies everything to be released
// there, and everything in that directory gets uploaded to S3.
//
// See ~jenkins/bin/buildh2odev.sh.
task buildH2oDevDist(type: Exec) {
group='Dist'
H2OBuildVersion bv = new H2OBuildVersion(rootDir, version);
def buildTimeMillis = System.currentTimeMillis();
def buildTimeIso8601 = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
def buildTimeLocal = new Date()
def projectVersion = bv.getProjectVersion()
def branchName = bv.getBranch()
def buildNumber = bv.getBuildNumber()
def lastCommitHash = bv.getLastCommitHash()
def java6home = System.getenv("JAVA_6_HOME")
environment['BUILD_TIME_MILLIS'] = buildTimeMillis
environment['BUILD_TIME_ISO8601'] = buildTimeIso8601
environment['BUILD_TIME_LOCAL'] = buildTimeLocal
environment['PROJECT_VERSION'] = projectVersion
environment['BRANCH_NAME'] = branchName
environment['BUILD_NUMBER'] = buildNumber
environment['LAST_COMMIT_HASH'] = lastCommitHash
if (java6home != null) {
environment['JAVA_6_HOME'] = java6home
}
commandLine './make-dist.sh'
}
task dist(dependsOn: buildH2oDevDist)
//
// Additional clean tasks to get squeaky clean.
//
task cleanH2oDistTmp(type: Delete) {
delete "$rootDir/h2o-dist/tmp"
}
task cleanTarget(type: Delete) {
delete "$rootDir/target"
}
clean.dependsOn cleanH2oDistTmp
clean.dependsOn cleanTarget
//
// Import project development profiles
//
apply from: "gradle/profiles.gradle"
//
// Import jacoco plugin if needed
//
if (project.hasProperty("jacocoCoverage")) {
apply from: "$rootDir/gradle/jacoco.gradle"
build.finalizedBy jacocoAgentLink
}