-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
666 lines (585 loc) · 25 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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/**
* Copyright (c) 2017 Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
// Apply the java plugin to add support for Java
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: 'com.google.protobuf', name:'protobuf-gradle-plugin', version: protobufGradlePlugin
classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.0"
}
}
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
if (file("src/main/java").isDirectory()) {
apply plugin: 'java'
}
// Plugin configurations
apply from: "$rootDir/gradle/application.gradle"
apply from: "$rootDir/gradle/checkstyle.gradle"
apply from: "$rootDir/gradle/eclipse.gradle"
apply from: "$rootDir/gradle/findbugs.gradle"
apply from: "$rootDir/gradle/idea.gradle"
apply from: "$rootDir/gradle/jacoco.gradle"
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/maven.gradle"
apply from: "$rootDir/gradle/protobuf.gradle"
apply from: "$rootDir/gradle/rat.gradle"
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
version = pravegaVersion
group = "io.pravega"
}
project('common') {
dependencies {
testCompile project(':test:testcommon')
testCompile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
compile group: 'org.apache.curator', name: 'curator-recipes', version: apacheCuratorVersion
compile group: 'commons-io', name: 'commons-io', version: commonsioVersion
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
compile group: 'commons-lang', name: 'commons-lang', version: commonsLangVersion
compile group: 'com.google.code.findbugs', name: 'jsr305', version: googleCodeFindBugsJsr305Version
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'io.netty', name: 'netty-all', version: nettyVersion
}
javadoc {
title = "Pravega Common Libraries"
failOnError = false
source {
project(':common').sourceSets.main.java
project(':shared:protocol').sourceSets.main.java
}
}
}
project ('shared') {
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
}
javadoc {
exclude 'io/pravega/shared/*'
}
}
project ('shared:metrics') {
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'com.readytalk', name :'metrics3-statsd', version : metrics3StatsdVersion
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-core
compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: metricsVersion
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-jvm
compile group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: metricsVersion
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-graphite
compile group: 'io.dropwizard.metrics', name: 'metrics-graphite', version: metricsVersion
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-ganglia
compile group: 'io.dropwizard.metrics', name: 'metrics-ganglia', version: metricsVersion
// https://mvnrepository.com/artifact/info.ganglia.gmetric4j/gmetric4j
compile group: 'info.ganglia.gmetric4j', name: 'gmetric4j', version: metricsGangliaVersion
compile project(':common')
}
javadoc {
exclude 'io/pravega/shared/*'
}
}
project('shared:protocol') {
dependencies {
compile group: 'io.netty', name: 'netty-all', version: nettyVersion
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
compile group: 'com.google.code.findbugs', name: 'jsr305', version: googleCodeFindBugsJsr305Version
}
}
project('client') {
dependencies {
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
compile group: 'com.google.code.findbugs', name: 'jsr305', version: googleCodeFindBugsJsr305Version
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'io.netty', name: 'netty-all', version: nettyVersion
compile project(':common')
compile project(':shared')
compile project(':shared:protocol')
compile project(":shared:controller-api")
testCompile project(':test:testcommon')
}
javadoc {
title = "Pravega Client API"
failOnError = false
exclude "**/impl/**";
}
}
project('test:testcommon') {
dependencies {
compile group: 'junit', name :'junit', version: junitVersion
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
compile group: 'commons-lang', name: 'commons-lang', version: commonsLangVersion
compile group: 'com.google.code.findbugs', name: 'jsr305', version: googleCodeFindBugsJsr305Version
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'commons-io', name: 'commons-io', version: commonsioVersion
compile group: 'io.netty', name: 'netty-all', version: nettyVersion
compile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
}
}
project('segmentstore:contracts') {
dependencies {
compile project(':common')
testCompile project(':test:testcommon')
}
}
project('segmentstore:storage') {
dependencies {
compile project(':common')
compile project(':segmentstore:contracts')
compile project(':shared:metrics')
testCompile project(':test:testcommon')
}
}
project('segmentstore:storage:impl') {
dependencies {
compile (group: 'org.apache.bookkeeper', name: 'bookkeeper-server', version: bookKeeperVersion) {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
compile group: 'org.rocksdb', name: 'rocksdbjni', version: rocksdbjniVersion
// https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common
compile group: 'org.apache.hadoop', name: 'hadoop-common', version:hadoopVersion
// https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common
compile group: 'org.apache.hadoop', name: 'hadoop-hdfs', version: hadoopVersion
testCompile group: 'org.apache.hadoop', name: 'hadoop-minicluster', version: hadoopVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
compile project(':common')
compile project(':segmentstore:storage')
compile project(':shared:metrics')
testCompile project(':test:testcommon')
testCompile project(path:':segmentstore:storage', configuration:'testRuntime')
}
}
project('segmentstore:server') {
dependencies {
compile project(':common')
compile project(':segmentstore:contracts')
compile project(':segmentstore:storage')
compile project(':shared:metrics')
testCompile project(':test:testcommon')
}
}
project('segmentstore:server:host') {
apply plugin: 'application'
applicationName = "pravega-segmentstore"
mainClassName = "io.pravega.segmentstore.server.host.ServiceStarter"
applicationDefaultJvmArgs = ["-server", "-Xms512m", "-XX:+HeapDumpOnOutOfMemoryError",
"-Dlog.dir=PRAVEGA_APP_HOME/logs",
"-Dlog.name=segmentstore",
"-Dpravega.configurationFile=PRAVEGA_APP_HOME/conf/config.properties",
"-Dlogback.configurationFile=PRAVEGA_APP_HOME/conf/logback.xml"]
applicationDistribution.from('src/config') {
into "conf"
}
dependencies {
compile project(':common')
compile project(':segmentstore:contracts')
compile project(':client')
compile project(':segmentstore:storage')
compile project(':segmentstore:storage:impl')
compile project(':segmentstore:server')
compile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile project(':test:testcommon')
testCompile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
testCompile project(path:':segmentstore:server', configuration:'testRuntime')
testCompile group: 'org.apache.hadoop', name: 'hadoop-minicluster', version: hadoopVersion
testCompile project(path:':segmentstore:storage:impl', configuration:'testRuntime')
}
}
project('test:integration') {
dependencies {
compile project(':common')
compile project(':client')
compile project(':segmentstore:server')
compile project(':segmentstore:server:host')
compile project(':controller')
compile project(':test:testcommon')
compile group: 'junit', name:'junit', version: junitVersion
compile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'org.apache.commons', name: 'commons-csv', version: apacheCommonsCsvVersion
testCompile project(path:':common', configuration:'testRuntime')
testCompile project(path:':shared:protocol', configuration:'testRuntime')
testCompile project(path:':segmentstore:server', configuration:'testRuntime')
testCompile project(path:':segmentstore:server:host', configuration:'testRuntime')
// Workaround for intellij issue, since we cannot add both the compile dependency and the testRuntime
// dependency of the client project into the compile scope of the integration tests
compile files(project(':client').sourceSets.test.output)
}
task startServer(type: JavaExec) {
main = "io.pravega.segmentstore.server.host.ServiceStarter"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startServerInteractive(type: JavaExec) {
main = "io.pravega.segmentstore.server.host.InteractiveStreamSegmentStoreTester"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startBenchmark(type: JavaExec) {
main = "io.pravega.segmentstore.server.host.ServiceBenchmark"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startLocalService(type: JavaExec) {
main = "io.pravega.test.integration.demo.StartLocalService"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startWriter(type: JavaExec) {
main = "io.pravega.test.integration.demo.StartWriter"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startReader(type: JavaExec) {
main = "io.pravega.test.integration.demo.StartReader"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startController(type: JavaExec) {
main = "io.pravega.controller.server.Main"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startScaleTest(type: JavaExec) {
main = "io.pravega.test.integration.demo.ScaleTest"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startEndToEndTransactionTest(type: JavaExec) {
main = "io.pravega.test.integration.demo.EndToEndTransactionTest"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task startEventProcessorTest(type: JavaExec) {
main = "io.pravega.test.integration.demo.EventProcessorTest"
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
}
project('shared:controller-api') {
apply plugin: 'com.google.protobuf'
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: commonsLang3ControllerContractVersion
compile group: 'commons-lang', name: 'commons-lang', version: commonsLangVersion
compile group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'commons-io', name: 'commons-io', version: commonsioVersion
compile group: 'io.netty', name: 'netty-all', version: nettyVersion
}
javadoc {
exclude 'io/pravega/controller/*'
}
}
project('controller') {
sourceSets {
main.resources.srcDirs += "$projectDir/src/conf"
}
apply plugin: 'application'
applicationName = "pravega-controller"
mainClassName = "io.pravega.controller.server.Main"
applicationDefaultJvmArgs = ["-server", "-Xms128m", "-XX:+HeapDumpOnOutOfMemoryError",
"-Dconfig.file=PRAVEGA_APP_HOME/conf/controller.conf",
"-Dlogback.configurationFile=PRAVEGA_APP_HOME/conf/logback.xml",
"-Dlog.dir=PRAVEGA_APP_HOME/logs",
"-Dlog.name=controller"]
applicationDistribution.from('src/conf') {
into "conf"
rename "application.conf", "controller.conf"
}
dependencies {
compile project(':common')
compile project(":shared:controller-api")
compile project(":client")
compile project(":shared:metrics")
runtime group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
compile group: 'javax.servlet', name: 'servlet-api', version: javaxServletApiVersion
compile(group: 'io.swagger', name : 'swagger-jersey2-jaxrs', version :swaggerJersey2JaxrsVersion) {
exclude group: 'com.google.guava', module: 'guava'
}
compile group: 'com.typesafe', name: 'config', version: typesafeConfigVersion
compile group: 'org.apache.curator', name: 'curator-framework', version: apacheCuratorVersion
compile group: 'org.apache.curator', name: 'curator-recipes', version: apacheCuratorVersion
compile group: 'org.apache.curator', name: 'curator-client', version: apacheCuratorVersion
compile group: 'org.apache.commons', name: 'commons-lang3', version: commonsLang3Version
compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-netty-http', version: jerseyVersion
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: jerseyVersion
testCompile project(':test:testcommon')
testCompile group: 'org.glassfish.jersey.test-framework.providers', name: 'jersey-test-framework-provider-netty', version: jerseyVersion
testCompile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
}
}
project('standalone') {
apply plugin: 'application'
applicationName = "pravega-standalone"
mainClassName = "io.pravega.local.LocalPravegaEmulator"
applicationDefaultJvmArgs = ["-server", "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError",
"-Dlogback.configurationFile=PRAVEGA_APP_HOME/conf/logback.xml",
"-Dlog.dir=PRAVEGA_APP_HOME/logs",
"-Dlog.name=pravega"]
dependencies {
compile project(':common')
compile project(':client')
compile project(':segmentstore:server')
compile project(':segmentstore:server:host')
compile project(':controller')
compile project(':segmentstore:contracts')
compile project(':segmentstore:storage')
compile project(':segmentstore:storage:impl')
runtime group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
compile group: 'org.apache.curator', name: 'curator-test', version: apacheCuratorVersion
// https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common
compile group: 'org.apache.hadoop', name: 'hadoop-common', version: hadoopVersion
compile group: 'org.apache.hadoop', name: 'hadoop-hdfs', version: hadoopVersion
compile group: 'org.apache.hadoop', name: 'hadoop-minicluster', version: hadoopVersion
testCompile project(':test:testcommon')
testCompile project(path:':common', configuration:'testRuntime')
testCompile project(path:':segmentstore:server', configuration:'testRuntime')
testCompile project(path:':segmentstore:server:host', configuration:'testRuntime')
}
task startStandalone(type: JavaExec) {
main = "io.pravega.local.LocalPravegaEmulator"
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
systemProperties 'logback.configurationFile' : new File('config/logback.xml').absolutePath
jvmArgs "-Xdebug", "-Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n"
}
}
project('test:system') {
// Specifically publish this test project
apply plugin: 'maven'
dependencies {
// https://mvnrepository.com/artifact/com.mesosphere/marathon-client
runtime group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
compile group: 'com.mesosphere', name: 'marathon-client', version: marathonClientVersion
compile project(':controller')
compile project(":client")
compile project(":test:testcommon")
compile group: 'junit', name: 'junit', version: junitVersion
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: javaxwsrsApiVersion
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: jerseyVersion
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: jerseyVersion
}
//disable the default test task.
test {
exclude 'io/pravega/**'
}
jar { //create a fat jar
archiveName = "test-collection.jar"
from {
(configurations.runtime).collect {
it.isDirectory() ? it : zipTree(it)
}
}
from sourceSets.test.output
}
//This is used to invoke systemTests
task startSystemTests(type: Test) {
ext.dockerRegistryUrl = project.hasProperty("dockerRegistryUrl") ? project.dockerRegistryUrl : ""
ext.repoUrl = project.hasProperty("repoUrl") ? project.repoUrl : ""
description 'Used to invoke system tests, example usage: gradle startSystemTests -DmasterIP=xx.xx.xx.xx'
testClassesDir = sourceSets.test.output.classesDir
classpath = sourceSets.test.runtimeClasspath
systemProperty "test_collection_jar_path", "$jar.archivePath.path"
systemProperty "execType", System.getProperty("execType")
systemProperty "masterIP", System.getProperty("masterIP")
systemProperty "imageVersion", System.getProperty("imageVersion")
systemProperty "skipServiceInstallation", System.getProperty("skipServiceInstallation")
if (System.getProperty("execType") == null) {
systemProperty "execType", "REMOTE_SEQUENTIAL"
}
if (System.getProperty("masterIP") == null) {
systemProperty "masterIP", "INVALID_MASTER_IP"
}
if (System.getProperty("imageVersion") == null) {
systemProperty "imageVersion", "INVALID_IMAGE_VERSION"
}
if (System.getProperty("skipServiceInstallation") == null) {
//skipServiceInstallation by default.
systemProperty "skipServiceInstallation", "true"
}
maxParallelForks = 1
systemProperty "dockerImageRegistry", "${dockerRegistryUrl}"
systemProperty "testVersion", pravegaVersion
systemProperty "testArtifactUrl", "${repoUrl}/io/pravega/pravega-test-system/" +
pravegaVersion+"/pravega-test-system-"+ pravegaVersion + ".jar"
onlyIf { dockerRegistryUrl && repoUrl }
}
}
subprojects {
task allDeps(type: DependencyReportTask) {}
}
task publishAllJars() {
dependsOn ':client:publish'
dependsOn ':common:publish'
dependsOn ':shared:publish'
dependsOn ':shared:protocol:publish'
dependsOn ':segmentstore:contracts:publish'
dependsOn ':segmentstore:storage:publish'
dependsOn ':segmentstore:storage:impl:publish'
dependsOn ':segmentstore:server:publish'
dependsOn ':segmentstore:server:host:publish'
dependsOn ':shared:metrics:publish'
dependsOn ':shared:controller-api:publish'
dependsOn ':controller:publish'
dependsOn ':standalone:publish'
dependsOn ':test:system:publish'
}
task sourceCopy(type: Copy) {
from rootDir
into 'source'
}
task sourceTar(type: Tar) {
dependsOn 'sourceCopy'
from 'source'
destinationDir = file('sourceArtifacts')
extension = 'tgz'
compression = Compression.GZIP
}
task javadocs(type: Javadoc) {
description = "Generate main pravega javadoc"
// Include names of any project that is to be included in the javadoc distribution
ext.projects = [':client']
options.links("http://docs.oracle.com/javase/8/docs/api/");
title = "Pravega API"
destinationDir = file("${buildDir}/javadocs")
source = files(projects.collect {
project(it).sourceSets.main.allJava
})
classpath = files(projects.collect {
project(it).sourceSets.main.output + project(it).sourceSets.main.compileClasspath
})
failOnError = false
exclude "**/impl/**"
}
apply plugin: 'distribution'
distributions {
main {
baseName = "pravega"
contents {
duplicatesStrategy = "exclude"
from ("dist/conf") {
into "conf"
}
from ("config") {
into "conf"
}
from (project(":controller").installDist) {
exclude "logback.xml"
}
from (project(":segmentstore:server:host").installDist) {
exclude "logback.xml"
}
from (project(":standalone").installDist)
}
}
client {
baseName = "pravega-client"
contents {
from { project(":client").configurations.runtime }
from { project(":client").configurations.runtime.allArtifacts.files }
}
}
javadoc {
baseName = "pravega-javadoc"
contents {
from (javadocs)
}
}
}
tasks.withType(Tar) {
compression = Compression.GZIP
}
task preparePravegaImage(type: Copy) {
into "${buildDir}/docker/pravega"
from "docker/pravega"
from (installDist) {
into "pravega"
exclude "**/*.bat"
}
}
task buildPravegaImage(type: DockerBuildTask, dependsOn: preparePravegaImage) {
baseTag = pravegaBaseTag
dockerDir = preparePravegaImage.destinationDir.absolutePath
}
task buildBookkeeperImage(type: DockerBuildTask) {
baseTag = bookkeeperBaseTag
dockerDir = "docker/bookkeeper"
}
task docker(dependsOn: [buildPravegaImage, buildBookkeeperImage]) {
description = "Builds all docker images"
}
task pushPravegaImage(type: DockerPushTask) {
// No explicit dependency on building the pravega image
mustRunAfter buildPravegaImage
tag = "${pravegaBaseTag}:${version}"
}
task pushBookkeeperImage(type: DockerPushTask) {
// No explicit dependency on building the bookkeeper image
mustRunAfter buildBookkeeperImage
tag = "${bookkeeperBaseTag}:${version}"
}
task dockerPush(dependsOn: [pushPravegaImage, pushBookkeeperImage]) {
description = "Push all docker images"
}
task distribution(dependsOn: [assembleDist, assembleClientDist, assembleJavadocDist]) {
description = "Builds a distribution package"
}
/**
* Task for building a docker image
*/
class DockerBuildTask extends Exec {
String baseTag
String dockerDir
DockerBuildTask() {
executable project.dockerExecutable
args "build"
args "-t", "${->baseTag}:${project.version}"
args "-t", "${->baseTag}:latest"
args "${->dockerDir}"
}
}
/**
* Task for pushing an image, which can either push to dockerhub or to a private registry.
* If pushing to dockerhub, you must be logged using using `docker login` before running.
*/
class DockerPushTask extends Exec {
String tag
DockerPushTask() {
executable project.dockerExecutable
args "push", "${->getRemoteTag()}"
}
protected void exec() {
// Tag the image with the remote image name first
if (project.hasProperty('dockerRegistry')) {
project.exec {
commandLine project.dockerExecutable, "tag", tag, getRemoteTag()
}
}
super.exec()
}
String getRemoteTag() {
if (project.hasProperty('dockerRegistry')) {
return "${project.property('dockerRegistry')}/${tag}"
}
else {
return tag
}
}
}