forked from gchq/stroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
846 lines (743 loc) · 38.3 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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
import java.net.URI
import java.nio.file.Paths
buildscript {
repositories {
mavenLocal()
jcenter()
// used for
maven { url "https://dl.bintray.com/stroom/stroom" }
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// A fork of https://github.com/wfhartford/gradle-dependency-analyze that works with Java 10
classpath 'stroom:gradle-dependency-analyze:v2.2.6'
// The following are required to put JAXB on the Gradle classpath for the purpose of JOOQ code generation in J9+.
// Later versions of the JOOQ Gradle plugin should make this unnecessary.
// Using beta versions of jaxb libs as they resolve the split pkg problem between jaxb-core and jaxb-runtime
classpath 'javax.activation:activation:1.1.1'
classpath 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
classpath 'com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438'
classpath 'org.glassfish.jaxb:jaxb-runtime:2.4.0-b180830.0438'
}
}
plugins {
// Plugin for downloading content from the 'net
id "de.undercouch.download" version "3.4.3" apply false
// Plugin for producing a tree of task dependencies, run task 'taskTree'
id "com.dorongold.task-tree" version "1.3.1" apply true
id "com.github.johnrengelman.shadow" version "4.0.3" apply false
id 'nu.studer.jooq' version '4.1' apply false
id 'org.flywaydb.flyway' version '5.2.4' apply false
// id 'java-library'
// id 'nebula.lint' version '10.4.2'
// id "com.vanniktech.dependency.graph.generator" version "0.5.0"
}
wrapper {
gradleVersion = '5.6.4'
}
apply plugin: 'ca.cutterslade.analyze'
apply plugin: 'de.undercouch.download'
//apply plugin: 'com.vanniktech.dependency.graph.generator'
if (!JavaVersion.current().isJava12()) {
throw new GradleException("This build must be run with Java 12 (current = " + JavaVersion.current() + ")")
}
ext.stroomPluginsDir = System.getProperty("user.home") + "/.stroom/plugins"
ext.stroomContentImportDir = System.getProperty("user.home") + "/.stroom/contentPackImport"
//if the project has a value for the passed property (i.e from the cmd line via -PpropName=xxx)
//use that, else use a default value
ext.getPropertyOrDefault = { propName, defaultValue ->
def val;
if (project.hasProperty(propName) && project.getProperty(propName) != "unspecified" && project.getProperty(propName) != "") {
val = project.getProperty(propName)
println "Using property [$propName] with value [$val]"
} else {
val = defaultValue
println "Property [$propName] has no value, using default value [$val]"
}
return val;
}
ext.gwtCompilerProps = [
mainClass: 'stroom.gwt.GwtCompilerWrapper',
minHeap : getPropertyOrDefault('gwtCompilerMinHeap', '1G'),
maxHeap : getPropertyOrDefault('gwtCompilerMaxHeap', '4G'),
workers : getPropertyOrDefault('gwtCompilerWorkers', '5')
]
//version numbers for libs that share version numbers, e.g. dropwizard-*, or for github repo release versions
ext.versions = [
//----------Stroom-----------------
stroom : getPropertyOrDefault('version', 'SNAPSHOT'),
//------Stroom-repos---------------
// stroomProxyRepo: 'v5.1-beta.8',
eventLogging : 'v4.0.5_schema-v3.2.4',
hadoopCommonShaded: 'v2.6.4-5',
hadoopHdfsShaded : 'v2.6.4-4',
stroomAuth : 'v7.0-beta.4', // Needed for the correct version of the client API
stroomExpression : 'v3.0.3',
stroomQuery : 'v4.0-beta.73', // same version for stroom-docref, stroom-query-api and stroom-query-common
stroomStats : 'v0.6.0-alpha.2',
// NOTE: Curator relies on zookeeper and we are pegged to zookeeper 3.4.5 server by the cloudera stack.
// Curator 4 can apparently work with zk 3.4.x as long as you exclude its zk dependency
// and explicitly add your own 3.4.x dependency. See https://curator.apache.org/zk-compatibility.html
// Also curator has a dependency on guava as it uses a handful of guava classes in its api. Its
// implementation relies on a shaded guava so you should be able to use any version of guava
// to satisfy the few classes used in the curator api, see https://issues.apache.org/jira/browse/CURATOR-200
// It is not clear whether a 3.4.x zk client (where x > 5) and a 3.4.5 zk server are compatible. Given that
// CHD6.1 ships with HBase 2.1 which uses a 3.4.10 zk client against a 3.4.5 server, we should be ok.
// If the version of curator is changed then this may need to be done in tandem with stroom-stats to ensure
// both sides' curator content in zk are compatible.
// For details of cloudera maven dependencies (i.e. hbase/zookeeper versions) see:
// 5.16.x - https://www.cloudera.com/documentation/enterprise/release-notes/topics/cdh_vd_cdh5_maven_repo_516x.html
// 6.1.x - https://www.cloudera.com/documentation/enterprise/6/release-notes/topics/rg_cdh_61_maven_artifacts.html
//------------3rd-party------------
curator : '4.2.0', // Curator 4 works with ZK 3.4.x in soft compatibility mode, i.e. you must exlude its dep on ZK and explicitly add one for 3.4.x
dropwizard : '1.3.14', // used to set the dropwizard-bom version, that controls lots of dependency versions
guice4 : '4.2.2',
gwt : '2.8.2',
hikari : '3.2.0',
jooq : '3.12.3',
junit_jupiter : '5.6.0',
kafka : '2.2.1', // CDH 6.3 uses kafka 2.2.1
lucene : '5.5.3',
mockito : '2.23.4',
rxjava : '2.1.10',
swagger : '1.5.21',
unirest : '1.4.9',
zookeeper : '3.4.8', // Roughly pegged to the server version used by Cloudera, see links above. This version is forced below.
zzDUMMYzz : 'makes sorting easier'
]
// Dependency strings for use in sub projects
// If the dependency version is controlled by a BOM, e.g. dropwizard-core, then the
// dependency is specified with no version. Use of the BOMs is configured further down,
// search for 'platform'.
ext.libs = [
//------Stroom-libs---------------
eventLogging : "event-logging:event-logging:$versions.eventLogging",
hadoopCommonShaded : "stroom:hadoop-common-shaded:$versions.hadoopCommonShaded",
hadoopHdfsShaded : "stroom:hadoop-hdfs-shaded:$versions.hadoopHdfsShaded",
stroomDocRef : "stroom:stroom-docref:$versions.stroomQuery",
stroomExpression : "stroom:stroom-expression:$versions.stroomExpression",
stroomQueryApi : "stroom:stroom-query-api:$versions.stroomQuery",
stroomQueryAudit : "stroom:stroom-query-audit:$versions.stroomQuery",
stroomQueryAuthorisation : "stroom:stroom-query-authorisation:$versions.stroomQuery",
stroomQueryCommon : "stroom:stroom-query-common:$versions.stroomQuery",
stroomStatsSchema : "stroom:stroom-stats-schema:$versions.stroomStats",
//------3rd Party-libs---------------
aopalliance : "aopalliance:aopalliance:1.0",
assertj_core : "org.assertj:assertj-core:3.10.0",
bcrypt : 'de.svenkubiak:jBCrypt:0.4.1',
c3p0 : "com.mchange:c3p0:0.9.5.2",
caffeine : "com.github.ben-manes.caffeine:caffeine:2.8.0",
commons_codec : "commons-codec:commons-codec:1.11",
commons_compress : "org.apache.commons:commons-compress:1.18",
commons_csv : "org.apache.commons:commons-csv:1.7",
commons_fileupload : "commons-fileupload:commons-fileupload:1.3.3",
commons_io : "commons-io:commons-io:2.6",
commons_lang : "org.apache.commons:commons-lang3", // version controlled by DW BOM
commons_pool2 : "org.apache.commons:commons-pool2:2.6.0",
commons_text : "org.apache.commons:commons-text:1.4", // 1.4 needed by YamlUtil
classgraph : "io.github.classgraph:classgraph:4.8.64",
curator_client : "org.apache.curator:curator-client:$versions.curator",
curator_framework : "org.apache.curator:curator-framework:$versions.curator",
curator_x_discovery : "org.apache.curator:curator-x-discovery:$versions.curator",
dropwizard_assets : "io.dropwizard:dropwizard-assets", // version controlled by DW BOM
dropwizard_auth : "io.dropwizard:dropwizard-auth", // version controlled by DW BOM
dropwizard_auth_jwt : "com.github.toastshaman:dropwizard-auth-jwt:1.0.2-0",
dropwizard_bom : "io.dropwizard:dropwizard-bom:$versions.dropwizard",
dropwizard_client : "io.dropwizard:dropwizard-client", // version controlled by DW BOM
dropwizard_configuration : "io.dropwizard:dropwizard-configuration", // version controlled by DW BOM
dropwizard_core : "io.dropwizard:dropwizard-core", // version controlled by DW BOM
dropwizard_flyway : 'io.dropwizard.modules:dropwizard-flyway:1.2.0-1', // version controlled by DW BOM
dropwizard_jackson : "io.dropwizard:dropwizard-jackson", // version controlled by DW BOM
dropwizard_jersey : "io.dropwizard:dropwizard-jersey", // version controlled by DW BOM
dropwizard_jetty : "io.dropwizard:dropwizard-jetty", //was 1.0.6 now 1.1.0
dropwizard_lifecycle : "io.dropwizard:dropwizard-lifecycle", // version controlled by DW BOM
dropwizard_metrics_annotation : "io.dropwizard.metrics:metrics-annotation", // version controlled by DW BOM
dropwizard_metrics_core : "io.dropwizard.metrics:metrics-core", // version controlled by DW BOM
dropwizard_metrics_healthchecks: "io.dropwizard.metrics:metrics-healthchecks", // version controlled by DW BOM
dropwizard_servlets : "io.dropwizard:dropwizard-servlets", // version controlled by DW BOM
dropwizard_testing : "io.dropwizard:dropwizard-testing", // version controlled by DW BOM
dropwizard_validation : "io.dropwizard:dropwizard-validation", // version controlled by DW BOM
fast_infoset : "com.sun.xml.fastinfoset:FastInfoset:1.2.12",
flyway_core : "org.flywaydb:flyway-core:5.2.4", // We are stuck on 5.2.4 as newer non-enterprise versions don't support mysql 5.6
gin : "com.google.gwt.inject:gin:2.1.2",
google_findbugs : "com.google.code.findbugs:jsr305:3.0.2",
guava : "com.google.guava:guava", // version controlled by DW BOM
guice3 : "com.google.inject:guice:3.0",
guice4 : "com.google.inject:guice:$versions.guice4:no_aop",
guice_assistedinject : "com.google.inject.extensions:guice-assistedinject:$versions.guice4",
guice_extension : "name.falgout.jeffrey.testing.junit5:guice-extension:1.1.1",
guice_multibindings : "com.google.inject.extensions:guice-multibindings:$versions.guice4",
guice_grapher : "com.google.inject.extensions:guice-grapher:$versions.guice4",
gwt_dev : "com.google.gwt:gwt-dev:$versions.gwt",
gwt_servlet : "com.google.gwt:gwt-servlet:$versions.gwt",
gwt_user : "com.google.gwt:gwt-user:$versions.gwt",
gwtp_mvp_client : "com.gwtplatform:gwtp-mvp-client:0.7",
gson : 'com.google.code.gson:gson:2.6.2',
hbase : "org.apache.hbase:hbase-common:2.1.5", //should be set to be consistent with CDH version
hessian : "com.caucho:hessian:4.0.51",
hikari : "com.zaxxer:HikariCP:$versions.hikari",
hsqldb : "org.hsqldb:hsqldb", // version controlled by DW BOM
http_client : "org.apache.httpcomponents:httpclient:4.5.6",
jBCrypt : "de.svenkubiak:jBCrypt:0.4.1",
jackson_annotations : "com.fasterxml.jackson.core:jackson-annotations", // version controlled by DW BOM
jackson_core : "com.fasterxml.jackson.core:jackson-core", // version controlled by DW BOM
jackson_databind : "com.fasterxml.jackson.core:jackson-databind", // version controlled by DW BOM
jackson_dataformat_yaml : "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", // version controlled by DW BOM
jackson_datatype_jsr310 : "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", // version controlled by DW BOM
java_diff_utils : "io.github.java-diff-utils:java-diff-utils:4.5",
java_jwt : "com.auth0:java-jwt:3.1.0",
javassist : "org.javassist:javassist", // version controlled by DW BOM
javax_activation : "javax.activation:javax.activation-api:1.2.0",
javax_activation_impl : "javax.activation:activation:1.1.1",
javax_annotation : "javax.annotation:javax.annotation-api:1.3.2",
javax_el : "org.glassfish:javax.el:3.0.1-b08",
javax_el_api : "javax.el:javax.el-api:3.0.0",
javax_inject : "javax.inject:javax.inject:1",
javax_mail_api : "javax.mail:javax.mail-api:1.6.0",
javax_servlet_api : "javax.servlet:javax.servlet-api", //version controlled by DB BOM
jaxb_api : "javax.xml.bind:jaxb-api:2.4.0-b180830.0359", // Using beta versions of jaxb libs as they resolve the split pkg problem between jaxb-core and jaxb-runtime
// jaxb_core : "com.sun.xml.bind:jaxb-core:2.4.0-b180830.0438",
jaxb_impl : "com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438",
jaxb_runtime : "org.glassfish.jaxb:jaxb-runtime:2.4.0-b180830.0438",
jaxws_api : "javax.xml.ws:jaxws-api:2.2.6",
jcl_over_slf4j : "org.slf4j:jcl-over-slf4j", // version controlled by DW BOM
jcommander : 'com.beust:jcommander:1.72',
jersey_client : "org.glassfish.jersey.core:jersey-client", // version controlled by DW BOM
jersey_common : "org.glassfish.jersey.core:jersey-common", // version controlled by DW BOM
jersey_server : "org.glassfish.jersey.core:jersey-server", // version controlled by DW BOM
jersey_test_framework_grizzly2 : "org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2", // version controlled by DW BOM
jetty_http : "org.eclipse.jetty:jetty-http", // version controlled by DW BOM
jetty_server : "org.eclipse.jetty:jetty-server", // version controlled by DW BOM
jetty_servlet : "org.eclipse.jetty:jetty-servlet", // version controlled by DW BOM
jetty_servlets : "org.eclipse.jetty:jetty-servlets", // version controlled by DW BOM
joda_time : 'joda-time:joda-time:2.9.3', // TODO: auth-into-stroom - remove joda
jooq : "org.jooq:jooq:$versions.jooq",
jooq_codegen : "org.jooq:jooq-codegen:$versions.jooq",
jooq_meta : "org.jooq:jooq-meta:$versions.jooq",
jose4j : "org.bitbucket.b_c:jose4j:0.6.4",
jsr173_api : "javax.xml.bind:jsr173_api:1.0",
jul_to_slf4j : "org.slf4j:jul-to-slf4j", // version controlled by DW BOM
junit_jupiter_api : "org.junit.jupiter:junit-jupiter-api:$versions.junit_jupiter",
junit_jupiter_engine : "org.junit.jupiter:junit-jupiter-engine:$versions.junit_jupiter",
junit_jupiter_params : "org.junit.jupiter:junit-jupiter-params:$versions.junit_jupiter",
kafka_clients : "org.apache.kafka:kafka-clients:$versions.kafka",
kryo : "com.esotericsoftware:kryo-shaded:4.0.0",
lmdbjava : "org.lmdbjava:lmdbjava:0.6.3",
log4j_over_slf4j : "org.slf4j:log4j-over-slf4j", // version controlled by DW BOM
logback_classic : "ch.qos.logback:logback-classic", // version controlled by DW BOM
logback_core : "ch.qos.logback:logback-core", // version controlled by DW BOM
lucene_analyzers_common : "org.apache.lucene:lucene-analyzers-common:$versions.lucene",
lucene_backward_codecs : "org.apache.lucene:lucene-backward-codecs:$versions.lucene",
lucene_core : "org.apache.lucene:lucene-core:$versions.lucene",
lucene_queryparser : "org.apache.lucene:lucene-queryparser:$versions.lucene",
mbknor_jackson_jsonSchema : "com.kjetland:mbknor-jackson-jsonschema_2.12:1.0.36",
mockito_core : "org.mockito:mockito-core:$versions.mockito",
mockito_junit_jupiter : "org.mockito:mockito-junit-jupiter:$versions.mockito",
mysql_connector_java : "mysql:mysql-connector-java:8.0.16",
objenesis : "org.objenesis:objenesis", // version controlled by DW BOM
okhttp : "com.squareup.okhttp3:okhttp:4.3.0",
okhttp_logging_interceptor : 'com.squareup.okhttp:logging-interceptor:2.7.5',
poi : "org.apache.poi:poi:3.17",
poi_ooxml : "org.apache.poi:poi-ooxml:3.17",
reactivestreams : "org.reactivestreams:reactive-streams:1.0.2", //used by rxjava
restygwt : "org.fusesource.restygwt:restygwt:2.2.6",
rxjava : "io.reactivex.rxjava2:rxjava:$versions.rxjava",
saxon_he : "net.sf.saxon:Saxon-HE:9.7.0-21",
simple_java_mail : 'org.simplejavamail:simple-java-mail:4.3.0',
slf4j_api : "org.slf4j:slf4j-api", // version controlled by DW BOM
solrj : "org.apache.solr:solr-solrj:8.2.0",
stax_api : "stax:stax-api:1.0.1",
swagger_annotations : "io.swagger:swagger-annotations:$versions.swagger",
unirest : "com.mashape.unirest:unirest-java:$versions.unirest",
validation_api : "javax.validation:validation-api:1.0.0.GA",
//hibernate_validator : "org.hibernate:hibernate-validator", // version controlled by DW BOM
//hibernate_validator : "org.hibernate:hibernate-validator:6.1.0.Final",
hibernate_validator : "org.hibernate:hibernate-validator:5.4.3.Final",
vavr : "io.vavr:vavr:0.10.3",
wiremock : 'com.github.tomakehurst:wiremock:2.12.0',
wix_embedded_mysql : "com.wix:wix-embedded-mysql:4.6.1",
ws_rs_api : "javax.ws.rs:javax.ws.rs-api:2.1",
xml_apis : "xml-apis:xml-apis:1.0.b2",
zookeeper : "org.apache.zookeeper:zookeeper:$versions.zookeeper",
zzDUMMYzz : "makes sorting this array easier"
]
def contentPackDownloadDir = "${project.buildDir}/contentPackDownload"
ext.contentPackDownloadDir = contentPackDownloadDir
def contentPackImportDir = "${System.properties['user.home']}/.stroom/contentPackImport/"
ext.contentPackImportDir = contentPackImportDir
def contentReleasesUrl = "http://github.com/gchq/stroom-content/releases/download/"
def visualisationsContentPackVer = "v3.2.1"
def visualisationsContentPackUrl = "http://github.com/gchq/stroom-visualisations-dev/releases/download/${visualisationsContentPackVer}/visualisations-production-${visualisationsContentPackVer}.zip"
//A set of content packs to download in the task downloadStroomContent
ext.contentPacks = [
'core-xml-schemas' : 'v2.2',
'event-logging-xml-schema' : 'v3.2.3',
'internal-dashboards' : 'v1.1',
'internal-statistics-sql' : 'v2.1',
'internal-statistics-stroom-stats': 'v2.1',
'standard-pipelines' : 'v0.1',
'stroom-101' : 'v1.0',
'stroom-logs' : 'v2.0-alpha.5',
'template-pipelines' : 'v0.2'
]
//defines a list of gradle projects that we will publish with maven/bintray
def projectsToBePublished = subprojects.findAll { project ->
project.path in [
':stroom-util',
':stroom-util-shared',
'zzDUMMYzz to ease sorting'
]
}
//list to hold details of any failed test classes
def failedTestReportFiles = []
//Configuration applicable to all projects
allprojects {
// Make doclint be quiet - we don't care about JavaDoc warnings.
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addBooleanOption('html5', true)
}
}
// Variable to capture the version of slf4j defined in the DW BOM, so
// we can use it to set the version of slf4j when we do a dependency
// substitution with log4j
def dropwizardBomSlf4jVersion = null
//Configuration applicable to all sub projects
subprojects {
//println "Configuring subproject ${project.name}"
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'ca.cutterslade.analyze'
// apply plugin: 'java-library'
// apply plugin: 'nebula.lint'
//
// gradleLint {
// rules += 'unused-dependency'
//// rules += 'all-dependency'
// }
sourceCompatibility = JavaVersion.VERSION_12
targetCompatibility = JavaVersion.VERSION_12
// This bit makes all sub projects have access to the BOMs for the dependency versions
dependencies {
compile platform(libs.dropwizard_bom)
}
//println project.getConfigurations().getByName("implementation").getAllDependencies()
configurations {
// ensure deps don't bring any logging implementations with them as this will
// conflict with logback. Also replace any log4j deps with log4j-over-slf4j
// so dependency jars work with slf4j
all {
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
exclude group: "commons-logging", module: "commons-logging"
// exclude group: "javax.validation", module: "validation-api"
exclude module: 'xercesImpl'
resolutionStrategy {
// A very hacky way of finding out what version of slf4j is in the dropwizard BOM
// TODO make it less hacky
if (dropwizardBomSlf4jVersion == null) {
eachDependency { DependencyResolveDetails details ->
if (dropwizardBomSlf4jVersion == null) {
if (details.requested.group == 'org.slf4j' && details.requested.name == "log4j-over-slf4j") {
//if (details.requested.group == 'org.slf4j') {
dropwizardBomSlf4jVersion = details.getTarget().getVersion()
println "Slf4j version = $dropwizardBomSlf4jVersion ${details.requested}"
}
}
}
}
dependencySubstitution {
//println "Slf4j version = $dropwizardBomSlf4jVersion"
substitute module('log4j:log4j') with module("org.slf4j:log4j-over-slf4j:1.7.25")
// substitute module('javax.validation:validation-api') with module("javax.validation:validation-api:1.1.0.Final")
}
// Stop stroom libs from dragging in a different version of dropwizard
// Currently commented out in the hope the dropwiz BOM will solve things
//eachDependency { DependencyResolveDetails details ->
//if (details.requested.group == 'io.dropwizard') {
//details.useVersion versions.dropwizard
//}
//if (details.requested.group == 'io.dropwizard.metrics') {
//details.useVersion versions.dropwizard_metrics
//}
//}
forcedModules = [
// This is how to force a dep to a specific version
// Curator will drag in a more recent version of zk but will support older versions so
// substitute it here. See NOTE in versions block above.
libs.zookeeper
]
}
}
}
repositories {
mavenLocal()
jcenter()
maven { url "https://dl.bintray.com/stroom/event-logging" }
maven { url "https://dl.bintray.com/stroom/stroom" }
maven { url "https://dl.bintray.com/stroom/stroom-proxy" }
}
test {
useJUnitPlatform()
// Report duration of tests that take over 1s
afterTest { descriptor, result ->
def durationSecs = (result.endTime - result.startTime) / 1000
if (durationSecs > 1) {
println "Test ${descriptor.className}.${descriptor.name}, took longer than 1s, result: ${result.resultType}, duration: ${durationSecs}s"
}
}
reports.html.destination = file("${reporting.baseDir}/${name}")
afterSuite { descriptor, result ->
if (descriptor != null
&& descriptor.className != null
&& result.resultType.toString() == "FAILURE") {
//test class failed so add its project info and test report file to a global list for
//processing at the end of the build
def reportFileName = "${reports.junitXml.destination}/TEST-${descriptor.className}.xml"
def reportFile = file(reportFileName)
def pair = new Tuple2("${project.name} ${descriptor.name}", reportFile)
failedTestReportFiles.add(pair)
}
}
//Use full logging for test exceptions so we can see where the failure occurred
testLogging {
events "failed"
exceptionFormat = 'full'
showStackTraces = true
}
}
clean {
//clear out the 'out' dirs used by intelliJ
delete "out"
}
task allDeps(type: DependencyReportTask) {}
task allDepInsight(type: DependencyInsightReportTask) {}
// // These lines pull the integration test task into our build process.
// tasks.check.dependsOn integrationTest
// tasks.integrationTest.mustRunAfter test
// afterEvaluate {
// repositories {
// jcenter()
// }
//
// compileJava {
// inputs.property("moduleName", moduleName)
// doFirst {
// options.compilerArgs = [
// '--module-path', classpath.asPath,
// ]
// classpath = files()
// }
// }
//
// compileTestJava {
// inputs.property("moduleName", moduleName)
// doFirst {
// options.compilerArgs = [
// '--module-path', classpath.asPath,
//// '--add-modules', 'junit',
//// '--add-reads', "$moduleName=junit",
// '--patch-module', "$moduleName=" + files(sourceSets.test.java.srcDirs).asPath,
// ]
// classpath = files()
// }
// }
//
// test {
// inputs.property("moduleName", moduleName)
// doFirst {
// jvmArgs = [
// '--module-path', classpath.asPath,
// '--add-modules', 'ALL-MODULE-PATH',
//// '--add-reads', "$moduleName=junit",
// '--patch-module', "$moduleName=" + files(sourceSets.test.java.outputDir).asPath,
// ]
// classpath = files()
// }
// }
//
// javadoc {
// options.addStringOption('-module-path', classpath.asPath)
// options.addStringOption('Xdoclint:all,-missing', '-html5')
// }
//
// jar {
// inputs.property("moduleName", moduleName)
// manifest {
// attributes(
// "Automatic-Module-Name": moduleName,
// )
// }
// version versions.stroomQuery
// }
// }
//
//task analyzeJavaLibraryDependencies(type: ca.cutterslade.gradle.analyze.AnalyzeDependenciesTask) {
// classesDirs = sourceSets.main.output.classesDirs
// require = [
// project.configurations.runtimeClasspath
// ]
// allowedToDeclare = [
// project.configurations.permitUnusedDeclared
// ]
// justWarn = true
//}
//task analyzeJavaLibraryTestDependencies(type: ca.cutterslade.gradle.analyze.AnalyzeDependenciesTask) {
// classesDirs = sourceSets.test.output.classesDirs
// require = [
// project.configurations.testRuntimeClasspath
// ]
// allowedToDeclare = [
// project.configurations.permitTestUnusedDeclared
// ]
// allowedToUse = [
// project.configurations.runtimeClasspath
// ]
// justWarn = true
//}
//tasks.build.dependsOn analyzeJavaLibraryDependencies
//tasks.build.dependsOn analyzeJavaLibraryTestDependencies
//
analyzeClassesDependencies {
justWarn = true
}
analyzeTestClassesDependencies {
justWarn = true
}
}
// configures only those projects in publishedProjectsPaths
configure(projectsToBePublished) {
println "Configuring ${project.name} for publishing"
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
group = 'stroom'
version = versions.stroom
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
scm {
url "https://github.com/stroom/stroom"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
root.appendNode('name', project.name)
root.children().last() + pomConfig
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
// configuration for the bintray plugin for uploading maven artifacts to bintray
// see https://github.com/bintray/gradle-bintray-plugin
// run task bintrayUpload to push the files, assuming BINTRAY_USER/KEY are set as env vars
bintray {
// Must never write these to log or system out
user = System.getenv('BINTRAY_USER') // set in Travis UI
key = System.getenv('BINTRAY_KEY') // set in Travis UI
// The maven plugin publications to push to bintray
publications = ['mavenJava']
// immediately make the artifacts public
publish = true
pkg {
repo = 'stroom'
name = 'stroom'
userOrg = 'stroom'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/gchq/stroom.git'
version {
name = "${versions.stroom}"
desc = "stroom-${versions.stroom}"
released = new Date()
vcsTag = "${versions.stroom}"
gpg {
// Bintray will self-sign the files
sign = true // Determines whether to GPG sign the files. The default is false
}
}
}
}
}
////configuration specific to projects that expose their test jars for other projects to use
//configure(projectsWithSharedTestJars) {
//
// println "Configuring ${project.path} to expose its test jars"
//
// configurations {
// testArtifacts
// }
//
// task testJar(type: Jar) {
// baseName = "${project.name}-test"
// from sourceSets.test.output
// }
//
// artifacts {
// testArtifacts testJar
// }
//
// task packageTests(type: Jar) {
// from sourceSets.test.output
// classifier = 'tests'
// }
//
// artifacts.archives packageTests
//}
task clearContentPackImportDir(type: Delete) {
doFirst {
println "Clearing ${contentPackImportDir}"
}
//ensure the import directory exists
new File(contentPackImportDir).mkdirs()
//cleans out any zip files in the contentPackImportDir
delete fileTree(new File(contentPackImportDir)) {
include '**/*.zip'
}
}
task clearContentPackDownloadDir(type: Delete) {
doFirst {
println "Clearing ${contentPackDownloadDir}"
}
//ensure the import directory exists
new File(contentPackDownloadDir).mkdirs()
//cleans out any zip files in the contentPackImportDir
delete fileTree(new File(contentPackDownloadDir)) {
include '**/*.zip'
}
}
task downloadStroomContent() {
doFirst {
println "Downloading content packs to ${contentPackDownloadDir}"
}
def downloadPack = { url ->
String filename = Paths.get(new URI(url).getPath()).getFileName().toString()
def downloadFile = new File(contentPackDownloadDir + "/" + filename)
def importFile = new File(contentPackImportDir + "/" + filename)
if (downloadFile.exists()) {
println "${url} has already been downloaded"
} else {
download {
src url
dest new File(contentPackDownloadDir)
overwrite true
}
}
if (!importFile.exists()) {
copy {
println "Copying from ${downloadFile} to ${importFile}"
from downloadFile
into stroomContentImportDir
}
}
}
doLast {
//download each content pack to the contentPackImportDir ready for stroom to import on startup
for (pack in contentPacks) {
def packName = pack.key
def packVer = pack.value
def packUrl = "${contentReleasesUrl}${packName}-${packVer}/${packName}-${packVer}.zip"
downloadPack packUrl
}
//now get the visualisations pack from a different repo
downloadPack visualisationsContentPackUrl
}
}
task setupSampleData() {
dependsOn downloadStroomContent
dependsOn ':stroom-app:setupSampleDataApplication'
}
gradle.buildFinished {
//if any of the tests failed dump the junit xml to the console
if (getPropertyOrDefault('dumpFailedTestXml', 'false') == 'true' && failedTestReportFiles.size > 0) {
println "Build has ${failedTestReportFiles.size} failed test classes, dumping JUnit xml output"
failedTestReportFiles.each { pair ->
def info = pair.first
def reportFile = pair.second
if (reportFile.exists()) {
println "-----Failed test class ${info} ------------------"
def lines = reportFile.readLines()
lines.each { String line ->
println "${line}"
}
println "-----End of test class ${info} ------------------"
} else {
println "File ${reportFile.toString()}"
}
}
}
}
task dependenciesPng() {
def reportsDir = new File("build/reports")
def compileDepsDot = file("$reportsDir/compileDeps.dot")
inputs.files subprojects.configurations.compile
outputs.files compileDepsDot
doFirst {
if (!reportsDir.exists()) reportsDir.mkdirs()
}
doLast {
def dotGraph = "digraph compile{" + System.getProperty("line.separator")
Set deps = [] as Set
subprojects.each { subproject ->
subproject.configurations.compile.dependencies.each { dependency ->
if (dependency instanceof ProjectDependency) {
String dep = "\"$subproject.name\" -> \"$dependency.name\";"
if (deps.add(dep)) { // if was not there before - avoid duplicates
dotGraph += dep + System.getProperty("line.separator")
}
}
}
}
dotGraph += "}"
compileDepsDot.write(dotGraph)
}
}
task clean() {
dependsOn clearContentPackImportDir
dependsOn clearContentPackDownloadDir
}
//import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin
//import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator
//import guru.nidi.graphviz.attribute.Color
//import guru.nidi.graphviz.attribute.Style
//
//plugins.apply(DependencyGraphGeneratorPlugin)
//
//def stroomGenerator = new Generator(
// "stroomLibraries", // Suffix for our Gradle task.
// { dependency -> dependency.getModuleGroup().startsWith("stroom") }, // Only want stroom.
// { dependency -> false }, // Include transitive dependencies.
// { node, dependency -> node.add(Style.FILLED, Color.rgb("#ff6f00")) }, // Give them some stroom color.
//)
//
//dependencyGraphGenerator {
// generators = [ stroomGenerator ]
//}