forked from azkaban/azkaban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
403 lines (344 loc) · 10.1 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
400
401
402
403
apply plugin: 'java'
apply plugin: 'eclipse'
defaultTasks 'dist'
/**
* Helper that calls a command and returns the output
*/
def cmdCaller = { commandln ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine commandln
standardOutput = stdout
}
return stdout.toString().trim()
}
/**
* Git version name from git tag
*/
def getVersionName = { ->
return cmdCaller(['git', 'describe', '--tags', '--abbrev=0'])
}
version = getVersionName()
archivesBaseName = 'azkaban'
check.dependsOn.remove(test)
repositories {
mavenCentral()
mavenLocal()
}
configurations {
all {
// We don't want the kitchen sink for dependencies. Only the ones we
// know we need for compile and ones we need to package.
transitive = false
}
compile {
description = 'compile classpath'
}
test {
extendsFrom compile
}
}
configurations.compile {
description = 'compile classpath'
}
dependencies {
compile (
[group: 'commons-collections', name:'commons-collections', version: '3.2.1'],
[group: 'commons-configuration', name:'commons-configuration', version: '1.8'],
[group: 'commons-dbcp', name:'commons-dbcp', version: '1.4'],
[group: 'commons-dbutils', name:'commons-dbutils', version: '1.5'],
[group: 'org.apache.commons', name:'commons-email', version: '1.2'],
[group: 'commons-fileupload', name:'commons-fileupload', version: '1.2.1'],
[group: 'commons-io', name:'commons-io', version: '2.4'],
[group: 'org.apache.commons', name:'commons-jexl', version: '2.1.1'],
[group: 'commons-lang', name:'commons-lang', version: '2.6'],
[group: 'commons-logging', name:'commons-logging', version: '1.1.1'],
[group: 'commons-pool', name:'commons-pool', version: '1.6'],
[group: 'com.google.guava', name:'guava', version: '13.0.1'],
[group: 'com.h2database', name:'h2', version: '1.3.170'],
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.1'],
[group: 'org.apache.httpcomponents', name:'httpcore', version: '4.2.1'],
[group: 'org.codehaus.jackson', name:'jackson-core-asl', version: '1.9.5'],
[group: 'org.codehaus.jackson', name:'jackson-mapper-asl',version: '1.9.5'],
[group: 'org.codehaus.jackson', name:'jackson-core-asl', version: '1.9.5'],
[group: 'org.mortbay.jetty', name:'jetty', version: '6.1.26'],
[group: 'org.mortbay.jetty', name:'jetty-util', version: '6.1.26'],
[group: 'joda-time', name:'joda-time', version: '2.0'],
[group: 'net.sf.jopt-simple', name:'jopt-simple', version: '4.3'],
[group: 'log4j', name:'log4j', version: '1.2.16'],
[group: 'javax.mail', name:'mail', version: '1.4.5'],
[group: 'mysql', name:'mysql-connector-java', version: '5.1.28'],
[group: 'javax.servlet', name:'servlet-api', version: '2.5'],
[group: 'org.slf4j', name:'slf4j-api', version: '1.6.1'],
[group: 'org.apache.velocity', name:'velocity', version: '1.7']
)
testCompile (
[group: 'junit', name:'junit', version: '4.11']
)
}
jar {
baseName = 'azkaban'
manifest {
attributes(
'Implementation-Title': 'Azkaban',
'Implementation-Version': version
)
}
}
eclipse.classpath.file {
// Erase the whole classpath
beforeMerged {
classpath -> classpath.entries.removeAll { entry -> true }
}
// We want to make sure that if there is an entry for src, that it doesn't
// have any include parameters
whenMerged { classpath ->
classpath.entries.findAll { entry -> entry.kind == 'src' }*.includes = []
}
}
/**
* Invokes a makefile target that will compile less files
*/
task compileLess(type:Exec) {
workingDir 'src/main/less'
commandLine 'make', '-e'
environment (
OBJ_DIR : file(new File(buildDir,'/less'))
)
}
/**
* Invokes a makefile target that will compile dust files
*/
task compileDust(type:Exec) {
workingDir 'src/main/tl'
commandLine 'make', '-e'
environment (
OBJ_DIR : file(new File(buildDir,'/dust'))
)
}
/**
* Copies web files to a build directory
*/
task web(dependsOn: ['compileLess', 'compileDust']) << {
println 'Copying web files'
copy {
from('src/web')
into('build/web')
}
copy {
from('build/dust')
into('build/web/js')
}
copy {
from('build/less')
into('build/web/css')
}
}
/*
* Gets the version name from the latest Git tag
*/
task createVersionFile() << {
String gitCommitHash = cmdCaller(['git', 'rev-parse', 'HEAD']);
String gitRepo = cmdCaller(['git', 'config', '--get', 'remote.origin.url']);
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd hh:mm zzz')
String versionStr = version + '\n' +
gitCommitHash + '\n' +
gitRepo + '\n' +
formattedDate + '\n'
File versionFile = file('build/package/version.file')
versionFile.parentFile.mkdirs()
versionFile.write(versionStr)
}
/**
* Packages the SoloServer version of Azkaban
*/
task packageSolo(type: Tar, dependsOn: [jar, 'web', 'createVersionFile']) {
appendix = 'solo-server'
packageDir = 'build/package/' + baseName + '-' + appendix
println 'Creating Azkaban Solo Server Package into ' + packageDir
mkdir packageDir
mkdir packageDir + '/extlib'
mkdir packageDir + '/plugins'
println 'Copying Soloserver bin & conf'
copy {
from('src/package/soloserver')
into(packageDir)
}
println 'Copying Azkaban lib'
copy {
from('build/libs')
into(packageDir + '/lib')
}
println 'Copying web'
copy {
from('build/web')
into(packageDir + '/web')
}
println 'Copying sql'
copy {
from('src/sql')
into(packageDir + '/sql')
}
println 'Copying dependency jars'
copy {
into packageDir + '/lib'
from configurations.compile
}
copy {
into packageDir
from 'build/package/version.file'
}
println 'Tarballing Solo Package'
extension = 'tar.gz'
compression = Compression.GZIP
basedir = baseName + '-' + appendix + '-' + version
println 'Source is in ' + packageDir
into(basedir) {
from packageDir
exclude 'bin'
}
dst_bin = basedir + '/bin'
src_bin = packageDir + '/bin'
from(src_bin) {
into dst_bin
fileMode = 0755
}
}
/**
* Packages the Sql Scripts for Azkaban DB
*/
task packageSql(type: Tar) {
String packageDir = 'build/package/sql'
println 'Creating Azkaban SQL Scripts into ' + packageDir
mkdir packageDir
println 'Copying SQL files'
copy {
from('src/sql')
into(packageDir)
}
String destFile = packageDir + '/create-all-sql-' + version + '.sql';
println('Concating create scripts to ' + destFile)
ant.concat(destfile:destFile, fixlastline:'yes') {
fileset(dir: 'src/sql') {
exclude(name: 'update.*.sql')
exclude(name: 'database.properties')
}
}
println 'Tarballing SQL Package'
extension = 'tar.gz'
compression = Compression.GZIP
appendix = 'sql'
basedir = baseName + '-' + appendix + '-' + version
packageDir = 'build/package/sql'
println 'Source is in ' + packageDir
into(basedir) {
from packageDir
}
}
/**
* Packages the Azkaban Executor Server
*/
task packageExec(type: Tar, dependsOn: [jar, 'createVersionFile']) {
appendix = 'exec-server'
String packageDir = 'build/package/' + baseName + '-' + appendix
println 'Creating Azkaban Executor Server Package into ' + packageDir
mkdir packageDir
mkdir packageDir + '/extlib'
mkdir packageDir + '/plugins'
println 'Copying Exec server bin & conf'
copy {
from('src/package/execserver')
into(packageDir)
}
println 'Copying Azkaban lib'
copy {
from('build/libs')
into(packageDir + '/lib')
}
println 'Copying dependency jars'
copy {
into packageDir + '/lib'
from configurations.compile
}
copy {
into packageDir
from 'build/package/version.file'
}
println 'Tarballing Web Package'
extension = 'tar.gz'
compression = Compression.GZIP
basedir = baseName + '-' + appendix + '-' + version
packageDir = 'build/package/' + baseName + '-' + appendix
println 'Source is in ' + packageDir
into(basedir) {
from packageDir
exclude 'bin'
}
dst_bin = basedir + '/bin'
src_bin = packageDir + '/bin'
from(src_bin) {
into dst_bin
fileMode = 0755
}
}
/**
* Packages the Azkaban Web Server
*/
task packageWeb(type: Tar, dependsOn: [jar, 'web', 'createVersionFile']) {
appendix = 'web-server'
String packageDir = 'build/package/' + baseName + '-' + appendix
println 'Creating Azkaban Web Server Package into ' + packageDir
mkdir packageDir
mkdir packageDir + '/extlib'
mkdir packageDir + '/plugins'
println 'Copying Web server bin & conf'
copy {
from('src/package/webserver')
into(packageDir)
}
println 'Copying Azkaban lib'
copy {
from('build/libs')
into(packageDir + '/lib')
}
println 'Copying web'
copy {
from('build/web')
into(packageDir + '/web')
}
println 'Copying dependency jars'
copy {
into packageDir + '/lib'
from configurations.compile
}
copy {
into packageDir
from 'build/package/version.file'
}
println 'Tarballing Web Package'
extension = 'tar.gz'
compression = Compression.GZIP
basedir = baseName + '-' + appendix + '-' + version
println 'Source is in ' + packageDir
into(basedir) {
from packageDir
exclude 'bin'
}
dst_bin = basedir + '/bin'
src_bin = packageDir + '/bin'
from(src_bin) {
into dst_bin
fileMode = 0755
}
}
task packageAll(dependsOn: ['packageWeb',
'packageExec',
'packageSolo',
'packageSql']) {
}
task dist(dependsOn: 'packageAll') {
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}