forked from h2oai/h2o-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
273 lines (237 loc) · 7.85 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
//
// 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-assembly 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'
// The build script settings to fetch plugins and put them on
// classpath
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1'
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1'
classpath 'com.github.townsfolk:gradle-release:1.2'
classpath 'de.undercouch:gradle-download-task:1.1'
classpath 'joda-time:joda-time:2.3'
classpath 'com.adaptc.gradle:nexus-workflow:0.6'
classpath 'org.testng:testng:6.8'
classpath "be.insaneprogramming.gradle:animalsniffer-gradle-plugin:+"
}
}
//
// 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'),
project(':h2o-persist-hdfs'),
project(':h2o-genmodel'),
project(':h2o-java-rest-bindings')
]
javaProjects = [
project(':h2o-core'),
project(':h2o-algos'),
project(':h2o-web'),
project(':h2o-app'),
project(':h2o-persist-hdfs'),
project(':h2o-test-integ'),
project(':h2o-testng'),
project(':h2o-genmodel'),
project(':h2o-java-rest-bindings'),
]
scalaProjects = [
project(':h2o-scala')
]
rProjects = [
project(':h2o-r')
]
pythonProjects = [
project(':h2o-py')
]
//
// Versions of libraries shared cross all projects
//
junitVersion = '4.11'
jets3tVersion = '0.7.1'
awsJavaSdkVersion = '1.8.3'
//
// H2O's REST API version
//
h2oRESTApiVersion = '3'
}
//
// For all projects (this and all subprojects) specify common properties and tasks
//
allprojects {
group = 'ai.h2o'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply from: "$rootDir/gradle/artifacts.gradle"
ext {
isRelease = rootProject.hasProperty("doRelease")
}
}
// 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"
}
}
// Configure Scala projects
if (project in scalaProjects) {
apply from: "$rootDir/gradle/scala.gradle"
apply from: "$rootDir/gradle/cp.gradle"
}
if (project in rProjects) {
apply from: "$rootDir/gradle/r.gradle"
}
if (project in pythonProjects) {
apply from: "$rootDir/gradle/r.gradle" // same plugins
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.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"