forked from h2oai/h2o-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
400 lines (357 loc) · 13.2 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
import org.apache.tools.ant.taskdefs.condition.Os
// The build script settings to fetch plugins and put them on
// classpath
buildscript {
ext {
isCi = (!rootProject.hasProperty("forcePublic")) && (System.getProperty("user.name").equals("jenkins")
|| System.getenv("CI") != null
|| (rootProject.hasProperty("doCI") && rootProject.doCI == "true"))
}
repositories {
if (isCi) {
maven {
allowInsecureProtocol = true
url "${localNexusLocation}/public"
}
} else {
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
}
//noinspection GroovyAssignabilityCheck
dependencies {
classpath 'org.ow2.asm:asm:5.1'
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1'
classpath 'org.testng:testng:6.8'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.2'
// 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-library"
id "com.github.hierynomus.license" version "0.16.1"
}
//
// 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'
// 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-test-support'),
project(':h2o-algos'),
project(':h2o-web'),
project(':h2o-app'),
project(':h2o-persist-gcs'),
project(':h2o-persist-hdfs'),
project(':h2o-persist-s3'),
project(':h2o-persist-http'),
project(':h2o-genmodel'),
project(':h2o-bindings'),
project(':h2o-avro-parser'),
project(':h2o-orc-parser'),
project(':h2o-parquet-parser'),
project(':h2o-jaas-pam'),
project(':h2o-automl'),
project(':h2o-admissibleml'),
project(':h2o-genmodel-ext-xgboost'),
project(':h2o-ext-xgboost'),
project(':h2o-ext-krbstandalone'),
project(':h2o-ext-mojo-pipeline'),
project(':h2o-ext-steam'),
project(':h2o-ext-target-encoder'),
project(':h2o-webserver-iface'),
project(':h2o-jetty-8'),
project(':h2o-jetty-9'),
project(':h2o-jetty-9-ext'),
project(':h2o-jetty-9-minimal'),
project(':h2o-ext-jython-cfunc'),
project(':h2o-hive'),
project(':h2o-security'),
project(':h2o-logger'),
project(':h2o-logging-impl-classic'),
project(':h2o-logging-impl-log4j2'),
project(':h2o-logging-safe4j'),
project(':h2o-genmodel-ext-jgrapht'),
project(':h2o-k8s'),
project(':h2o-k8s-int'),
project(':h2o-genmodel-ext-deepwater'),
project(':h2o-genmodel-ext-mojo-pipeline'),
project(':h2o-clustering')
]
javaProjects = [
project(':h2o-core'),
project(':h2o-test-support'),
project(':h2o-algos'),
project(':h2o-web'),
project(':h2o-app'),
project(':h2o-persist-gcs'),
project(':h2o-persist-hdfs'),
project(':h2o-persist-s3'),
project(':h2o-persist-http'),
project(':h2o-test-accuracy'),
project(':h2o-genmodel'),
project(':h2o-bindings'),
project(':h2o-avro-parser'),
project(':h2o-orc-parser'),
project(':h2o-parquet-parser'),
project(':h2o-parquet-parser-tests'),
project(':h2o-parquet-v17-compat'),
project(':h2o-jaas-pam'),
project(':h2o-automl'),
project(':h2o-admissibleml'),
project(':h2o-genmodel-ext-xgboost'),
project(':h2o-ext-xgboost'),
project(':h2o-ext-krbstandalone'),
project(':h2o-ext-mojo-pipeline'),
project(':h2o-ext-steam'),
project(':h2o-ext-target-encoder'),
project(':h2o-ext-example'),
project(':h2o-webserver-iface'),
project(':h2o-jetty-8'),
project(':h2o-jetty-9'),
project(':h2o-jetty-9-ext'),
project(':h2o-jetty-9-minimal'),
project(':h2o-ext-jython-cfunc'),
project(':h2o-hive'),
project(':h2o-security'),
project(':h2o-logger'),
project(':h2o-logging-impl-classic'),
project(':h2o-logging-impl-log4j2'),
project(':h2o-logging-safe4j'),
project(':h2o-genmodel-ext-jgrapht'),
project(':h2o-k8s'),
project(':h2o-k8s-int'),
project(':h2o-k8s-comp'),
project(':h2o-genmodel-ext-deepwater'),
project(':h2o-genmodel-ext-mojo-pipeline'),
project(':h2o-clustering')
]
rProjects = [
project(':h2o-r')
]
pythonProjects = [
project(':h2o-py'),
project(':h2o-py-cloud-extensions')
]
// 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'),
// MOJO2 tests need DAI license
//project(':h2o-ext-mojo-pipeline'),
]
// Projects with micro-benchmarks
ubenchProjects = [
project(':h2o-core'),
project(':h2o-algos'),
project(':h2o-ext-target-encoder')
]
//
// Versions of libraries shared cross all projects
//
junitVersion = '4.12'
awsJavaSdkVersion = '1.12.268'
//
// Optional H2O modules which can be included h2o.jar assembly
// They can be enabled by passing parameter "-Pwith{componentName}=true"
// For example, `-PwithXgboost=true -PxgboostVersion=1.2.0.16`
//
optionalComponents = [
// NAME | VERSION | IS ENABLED? | HAS GENMODEL PART ?
[name: "xgboost", version: "$version", enabled: true, genmodel: true ],
[name: "jython-cfunc", version: "$version", enabled: true, genmodel: false],
[name: "jgrapht", version: "$version", enabled: true, genmodel: true],
[name: "mojo-pipeline", version: "$version", enabled: true, genmodel: true],
]
//
// H2O's REST API version
//
h2oRESTApiVersion = '3'
getOsSpecificCommandLine = { List<GString> args ->
return Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c'] + args : ['/usr/bin/env'] + 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"
apply from: "$rootDir/gradle/artifacts.gradle"
ext {
isRelease = rootProject.hasProperty("doRelease")
validateRelease = rootProject.hasProperty("validateRelease")
isCi = isCi
}
}
// 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 {
if (project.hasProperty("enableMavenLocal")) { // useful for development
mavenLocal()
}
if (isCi) {
maven {
allowInsecureProtocol = true
url "${localNexusLocation}/public"
}
maven {
url "https://oss.sonatype.org/content/groups/staging/"
}
} else {
mavenCentral()
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos/"
}
maven {
url "https://repo.hortonworks.com/content/repositories/releases/"
}
maven {
url "https://repo.hortonworks.com/content/repositories/jetty-hadoop/"
}
maven {
url "https://repository.mapr.com/maven/"
}
maven {
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/"
}
}
}
// 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"
}
// Copy all jars and remove version number from the name
apply from: "$rootDir/gradle/copyJars.gradle"
//
// Early configuration of projects simplifies build resolution
//
// Configure Java projects
if (project in javaProjects) {
apply from: "$rootDir/gradle/java.gradle"
// Include Findbugs only if the property is specified
if (project.hasProperty("doFindbugs") && project.doFindbugs == "true") {
apply from: "$rootDir/gradle/findbugs.gradle"
}
if (project.hasProperty("doCheckStyle") && project.doCheckStyle == "true") {
apply from: "$rootDir/gradle/checkstyle.gradle"
}
if (project.hasProperty("doAnimalSniffer") && project.doAnimalSniffer == "true") {
apply from: "$rootDir/gradle/animalSniffer.gradle"
}
if (testNeedsCiProject.contains(project)) {
if (isCi) {
logger.info("Running in CI mode, tests for $project will be enabled.")
} else {
logger.warn("The project $project needs CI for running tests! You can pass `-PdoCI=true` to force CI behaviour.")
}
project.testSingleNode.enabled = isCi
project.testMultiNode.enabled = isCi
}
// Analyze dependencies
//apply plugin: 'ca.cutterslade.analyze'
}
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"
}
}
}
// Include support for S3 syncing
apply from: "gradle/s3sync.gradle"
// Include support for Pull Request validator
apply from: "gradle/prCheck.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()
if (validateRelease) {
def middleNumber = Integer.parseInt(projectVersion.split("\\.")[1])
def lastNumber = Integer.parseInt(projectVersion.split("\\.")[3])
def isBleedingEdge = middleNumber % 2 == 1
if (isBleedingEdge && branchName != "master") {
throw new Exception("The version ${projectVersion} is corresponding to nightly release but the branch you are releasing from is not master but ${branchName}")
} else if (!isBleedingEdge && !branchName.startsWith("rel-")) {
throw new Exception("The version ${projectVersion} is corresponding to the release but the branch you are releasing from not match release branch but ${branchName}")
} else if (lastNumber == 99999) {
throw new Exception("The version ${projectVersion} is a developer version and should not be released.")
}
}
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
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
}