generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
executable file
·2147 lines (1704 loc) · 80 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
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardOpenOption
import java.nio.file.StandardCopyOption
import java.time.ZoneId
// TODO: Enable miniconda for python build tasks once supported in build
// environment
//import com.pswidersk.gradle.python.VenvTask
/* Used by gradle plugins outside the official gradle plugins repository */
buildscript {
// Workaround for missing transitive dependency for plugin org.kordamp.gradle.markdown
// https://github.com/kordamp/markdown-gradle-plugin/issues/36
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module( 'com.overzealous:remark:1.1.0' ) using module( 'com.wavefront:remark:2023-07.07' ) because "not available on maven central anymore"
}
}
repositories {
mavenCentral()
}
dependencies {
// For markdown -> html
classpath 'com.atlassian.commonmark:commonmark:0.17.0'
// To create a unified javadoc across submodules and top-level module:
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.1'
}
}
/* Gradle plugins available in the official gradle plugins repository */
plugins {
// Static analysis tool sonarqube client
id 'org.sonarqube' version '5.1.0.4882'
//id 'com.github.jacobono.jaxb' version '1.3.5'
// Above is unmaintained, less gradle-y, below fork has several improvements
//id 'org.openrepose.gradle.plugins.jaxb' version '2.5.0'
// Above has no releases since 2018, below fork supports gradle 7+
id 'com.github.seanrl.jaxb' version '2.5.4'
// For ability to use git ids for versioning jar files:
id 'org.ajoberstar.grgit' version '5.3.0'
// To compile user documentation (not working: blows up on compileMarkdown)
//id 'org.uulib.gradle.markdown' version '0.0.1'
// To generate de/serialization classes for message bodies
id 'com.google.protobuf' version '0.9.1'
// To create trusted certificate files (.jks aka cacerts) from dir of .pem
// (Not working: not friendly to our directory structure nor submodules)
//id 'de.chkpnt.truststorebuilder' version '0.2.57'
// To print junit test reports to the console in addition to html, so that
// remote developers can see detailed test feedback without launching a
// browser. See #61601
id 'com.adarshr.test-logger' version '4.0.0'
// To discover library versions with known vulnerabilities
id 'org.owasp.dependencycheck' version '10.0.2'
// Task to assist in downloading artifacts
id 'de.undercouch.download' version '5.6.0'
// To discover library versions with updates available
id 'com.github.ben-manes.versions' version '0.51.0'
// Run python scripts
// TODO: cannot install miniconda in current build environment
// Enable this when we have more control over the build environment
//id 'com.pswidersk.python-plugin' version '1.2.1'
// Markdown to html
id 'org.kordamp.gradle.markdown' version '2.2.0'
// To generate API documentation from JAX-RS annotations and javadocs
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.26"
// To generate JPMS images more easily with 3rd-party "automatic" modules
id 'org.beryx.jlink' version '2.26.0'
// Integrated code coverage report
id 'jacoco-report-aggregation'
}
repositories {
mavenCentral()
maven {
url "https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/" //
}
}
// The target Java version for use in a gradle toolchain
def final TARGET_JDK = 17
java {
withJavadocJar()
withSourcesJar()
// Declare the Java version, self-contained to the build
toolchain {
languageVersion = JavaLanguageVersion.of(TARGET_JDK)
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.adarshr.test-logger'
// Each module does not need a version update unless code in it has changed.
def gitCommit = grgit.log(paths: [project.name, 'build.gradle', 'gradle'], maxCommits: 1).find()
// Default version string for new module with no history
String currentDate = OffsetDateTime.now(ZoneOffset.UTC).format('yyyyMMdd')
version = currentDate + '-0000000'
// Null check in case there is a new module with no history
if (gitCommit != null)
{
def gitCommitId = gitCommit.id
def gitCommitDate = gitCommit.dateTime.withZoneSameInstant(ZoneId.of("UTC"))
version = gitCommitDate.format('yyyyMMdd') + '-' + gitCommitId[0..6]
}
// Whenever there are local changes, flag the version with a "-dev" suffix.
// If "-dev" shows up in a version in production, either a bad artifact
// made it into production or there is a bug in this logic. In either case,
// the response is to make sure that a clean build producing a version with
// no "-dev" occurs and to put that artifact into production.
def gitIsClean = grgit.status().isClean()
if (!gitIsClean)
{
version = version + '-dev'
}
sourceSets {
main {
java {
// Standard sources in src. The dist being here is for eclipse
// purposes. Eclipse needs the conf files to be labeled as
// source or library or class in order to land on its runtime
// or debugtime classpath.
// It seems unintuitive but somehow works because there are no
// actual java files inside the conf directory, this just
// causes the files to show up on eclipse's classpath at
// runtime or debugtime.
// https://stackoverflow.com/questions/18183677/gradle-add-folder-to-eclipse-classpath#18184414
srcDirs = ['src', 'dist/lib/conf']
}
// "resources" here end up included inside the jar.
// For non-jarred resources such as config files, see distributions
// section inside wres-core, as well as startScripts section.
resources {
srcDirs = ['nonsrc']
}
}
test {
java {
srcDirs = ['test']
}
resources {
srcDirs = ['testNonsrc']
}
}
}
repositories {
mavenCentral()
maven {
url "https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/" //
}
}
test {
maxHeapSize = "512m"
testLogging.showStandardStreams = true
systemProperties += ['user.timezone': 'UTC']
}
jar {
// version number should be included
manifest {
attributes("Implementation-Title": "Water Resources Evaluation Service",
"Implementation-Version": archiveVersion)
}
}
java {
withJavadocJar()
withSourcesJar()
// Declare the Java version, self-contained to the build
toolchain {
languageVersion = JavaLanguageVersion.of(TARGET_JDK)
}
}
tasks.withType(AbstractArchiveTask) {
archiveVersion = project.version
// Make bit-for-bit reproducible jars, zips, and tars.
preserveFileTimestamps = false
reproducibleFileOrder = true
}
// Truly prevent these annoying jars from showing up in dist zip
configurations.implementation {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.checkerframework', module: 'checker-qual'
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
// Truly prevent these annoying jars from showing up in dist zip
configurations.runtimeOnly {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.checkerframework', module: 'checker-qual'
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
}
project(':wres-system') {
apply plugin: 'com.github.seanrl.jaxb'
dependencies {
implementation 'org.slf4j:slf4j-api:2.0.13'
implementation 'org.apache.commons:commons-lang3:3.17.0'
// to use native postgres copy, need this on compile, otherwise runtime
implementation('org.postgresql:postgresql:42.7.4') {
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
}
// For Java 9+ compatibility:
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
api 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1'
// Builders
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.36'
annotationProcessor 'org.projectlombok:lombok:1.18.36'
// Database drivers need to be on the runtime classpath in order to
// acquire connections initially. See #103431
implementation 'com.h2database:h2:2.3.232'
// connection pooling:
implementation 'com.zaxxer:HikariCP:5.1.0'
// Java Flight Recorder statistics for JDBC
implementation 'com.github.marschall:jfr-jdbc:0.4.0'
// Because org.postgresql:postgresql uses JUL logging, bridge it, here
// at compile time because we need to expose a class to JUL.
implementation 'org.slf4j:jul-to-slf4j:2.1.0-alpha1'
// Fast-Infoset encoded XML
implementation group: 'com.sun.xml.fastinfoset', name: 'FastInfoset', version: '2.1.1'
// JCIP annotations
compileOnly group: 'net.jcip', name: 'jcip-annotations', version: '1.0'
testImplementation 'junit:junit:4.13.2'
// Use mockserver to test certificate utilities
testImplementation 'org.mock-server:mockserver-netty:5.15.0'
}
test {
// Set the socket timeout for tests involving mockserver to 120s
systemProperties += ["mockserver.maxSocketTimeout": 120000]
}
}
project(':wres-datamodel') {
dependencies {
implementation project(':wres-config')
api project(':wres-statistics')
api 'org.apache.commons:commons-lang3:3.17.0'
implementation 'org.slf4j:slf4j-api:2.0.13'
runtimeOnly('ch.qos.logback:logback-classic:1.5.12') {
// Not used at runtime, bloat
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
implementation('com.github.ben-manes.caffeine:caffeine:3.1.8') {
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
}
// The following five libraries together provide units of measure.
api 'javax.measure:unit-api:2.2'
implementation 'si.uom:si-units:2.1'
implementation 'tech.units:indriya:2.2.1'
implementation 'systems.uom:systems-ucum:2.1'
implementation 'systems.uom:systems-quantity:2.1'
// For geometries
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
// JCIP annotations
compileOnly group: 'net.jcip', name: 'jcip-annotations', version: '1.0'
// Mocking help
testImplementation 'org.mockito:mockito-core:5.14.2'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testCompileOnly 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.11.3'
}
// Facilitate unit tests with JUnit
test {
useJUnitPlatform()
}
}
project(':wres-io') {
dependencies {
implementation project(':wres-system')
implementation project(':wres-datamodel')
implementation project(':wres-statistics')
implementation project(':wres-config')
implementation project(':wres-reading')
// Java Flight Recorder statistics for JDBC
implementation 'com.github.marschall:jfr-jdbc:0.4.0'
implementation('edu.ucar:cdm-core:5.4.2') {
// Because we use slf4j, not jcl:
exclude group: 'commons-logging', module: 'commons-logging'
// CVE-2021-33813
exclude group: 'org.jdom', module: 'jdom2'
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
// Remove older guava version. TODO: remove when the CDM catches up
exclude group: 'com.google.guava', module: 'guava'
}
// Include later dependency versions for the excluded dependencies above
implementation 'com.google.guava:guava:33.3.1-jre'
// to use native postgres copy, need this on compile, otherwise runtime
implementation('org.postgresql:postgresql:42.7.4') {
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
}
// Use H2 for truly embedded SQL db
implementation 'com.h2database:h2:2.3.232'
// connection pooling:
implementation 'com.zaxxer:HikariCP:5.1.0'
// wres.io.utilities uses javax.json.* imports
implementation 'org.glassfish:javax.json:1.1.4'
// Better-than-Java's HTTP client
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
// To cache
implementation('com.github.ben-manes.caffeine:caffeine:3.1.8') {
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
}
// For geometries
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
implementation group: 'org.locationtech.jts', name: 'jts-io', version: '1.20.0', ext: 'pom'
implementation 'org.liquibase:liquibase-core:4.30.0'
// Use instead of the bridge between JUL and SLF4J. #60801-283
runtimeOnly 'com.mattbertolini:liquibase-slf4j:5.1.0'
compileOnly 'net.jcip:jcip-annotations:1.0'
// Because org.postgresql:postgresql uses JUL logging, bridge at runtime
runtimeOnly 'org.slf4j:jul-to-slf4j:2.1.0-alpha1'
// Because cdm and aws sdk uses apache commons logging, bridge to slf4j
runtimeOnly 'org.slf4j:jcl-over-slf4j:2.1.0-alpha1'
//JB @ 02/16/17
testImplementation 'com.google.guava:guava-testlib:33.3.1-jre'
// Mocking help
testImplementation 'org.mockito:mockito-inline:5.2.0'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.11.3'
// In-memory implementation of a java.nio.file abstract file system api
// to test writing of files without actually writing files on the host machine
testImplementation group: 'com.google.jimfs', name: 'jimfs', version: '1.3.0'
}
test {
useJUnitPlatform()
// Set the socket timeout for tests involving mockserver to 120s
systemProperties += ["mockserver.maxSocketTimeout" : 120000,
"ucar.unidata.io.http.maxReadCacheSize": 200000,
"ucar.unidata.io.http.httpBufferSize" : 200000]
}
// Give wres-io access to the liquibase changesets on the expected classpath
// at test time.
sourceSets {
test {
resources {
// Flatten the contents of /dist/lib/conf so that the classpath
// path to the liquibase changesets is exactly
// 'database/[changeset].xml'.
srcDirs += 'dist/lib/conf'
}
}
}
}
project(':wres-writing') {
// Check if the dependency modules version is later. If so, update this
// module to that later version.
// See #105526: there is an ordering issue whereby the correct
// project.version does not propagate to the application plugin tasks
// (distZip, distTar etc.) unless the project.version is determined and
// set before the application plugin is applied
def gitCommitOfDependencies = grgit.log(paths: ['wres-datamodel',
'wres-eventsbroker',
'wres-events'], maxCommits: 1).find()
// Null check in case there is a new module with no history
if (gitCommitOfDependencies != null)
{
def gitCommitIdOfDependencies = gitCommitOfDependencies.id
def gitCommitDateOfDependencies = gitCommitOfDependencies.dateTime.withZoneSameInstant(ZoneId.of("UTC"))
def gitCommitOfThisModule = grgit.log(paths: [project.name, 'build.gradle', 'gradle'], maxCommits: 1).find()
def gitCommitDateOfThisModule = gitCommitOfThisModule.dateTime.withZoneSameInstant(ZoneId.of("UTC"))
def versionOfDependencies =
gitCommitDateOfDependencies.format('yyyyMMdd') + '-' + gitCommitIdOfDependencies[0..6]
if (gitCommitDateOfDependencies.isAfter(gitCommitDateOfThisModule))
{
version = versionOfDependencies
println("Set wres-writing version: " + project.version)
if (!grgit.status().isClean())
{
version = version + '-dev'
}
}
}
apply plugin: 'application'
// Workaround windows paths that are too long by overriding the explicit setting of individual dependencies
startScripts {
classpath = files('$APP_HOME/lib/*')
// Note: see lengthy note in main application below
classpath += files('conf')
}
mainClassName = 'wres.writing.client.WritingClient'
applicationDefaultJvmArgs = ['-Xms640m', '-Xmx640m',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+CrashOnOutOfMemoryError',
'-Djava.util.logging.config.file=logging.properties',
'-Dorg.jboss.logging.provider=slf4j']
distributions {
main {
println(project.version)
contents {
from {
// Note: see lengthy note in main application below
['dist']
}
}
}
}
dependencies {
implementation project(':wres-reading')
implementation project(':wres-system')
implementation project(':wres-datamodel')
implementation project(':wres-statistics')
implementation project(':wres-config')
implementation project(':wres-events')
implementation project(':wres-eventsbroker')
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
implementation('edu.ucar:cdm-core:5.4.2') {
// Because we use slf4j, not jcl:
exclude group: 'commons-logging', module: 'commons-logging'
// CVE-2021-33813
exclude group: 'org.jdom', module: 'jdom2'
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
// Remove older guava version. TODO: remove when the CDM catches up
exclude group: 'com.google.guava', module: 'guava'
}
// Include later dependency versions for the excluded dependencies above
implementation 'com.google.guava:guava:33.3.1-jre'
// Better-than-Java's HTTP client
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
// Update vulnerable kotlin-stdlib that okhttp/okio uses
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.23'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23'
// To accurately detect mime types of files.
implementation 'org.apache.tika:tika-core:2.9.2'
// For geometries
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
implementation group: 'org.locationtech.jts', name: 'jts-io', version: '1.20.0', ext: 'pom'
compileOnly 'net.jcip:jcip-annotations:1.0'
// Mocking help
testImplementation 'org.mockito:mockito-inline:5.2.0'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testImplementation 'junit:junit:4.13.2'
// In-memory implementation of a java.nio.file abstract file system api
// to test writing of files without actually writing files on the host machine
testImplementation group: 'com.google.jimfs', name: 'jimfs', version: '1.3.0'
}
}
project(':wres-reading') {
dependencies {
implementation project(':wres-system')
implementation project(':wres-datamodel')
implementation project(':wres-statistics')
implementation project(':wres-config')
implementation project(':wres-http')
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
// For Java 8 java.time support
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.1'
implementation('edu.ucar:cdm-core:5.4.2') {
// Because we use slf4j, not jcl:
exclude group: 'commons-logging', module: 'commons-logging'
// CVE-2021-33813
exclude group: 'org.jdom', module: 'jdom2'
// Not used at runtime, bloat
exclude group: 'org.checkerframework', module: 'checker-qual'
// Remove older guava version. TODO: remove when the CDM catches up
exclude group: 'com.google.guava', module: 'guava'
}
// Include later dependency versions for the excluded dependencies above
implementation 'com.google.guava:guava:33.3.1-jre'
implementation 'org.apache.commons:commons-compress:1.27.1'
// Better-than-Java's HTTP client
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
// To accurately detect mime types of files.
implementation 'org.apache.tika:tika-core:2.9.2'
// For geometries
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
implementation group: 'org.locationtech.jts', name: 'jts-io', version: '1.20.0', ext: 'pom'
// Fast-Infoset encoded XML
implementation group: 'com.sun.xml.fastinfoset', name: 'FastInfoset', version: '2.1.1'
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation 'org.liquibase:liquibase-core:4.30.0'
// Use instead of the bridge between JUL and SLF4J. #60801-283
runtimeOnly 'com.mattbertolini:liquibase-slf4j:5.1.0'
compileOnly 'net.jcip:jcip-annotations:1.0'
// Builders
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.36'
annotationProcessor 'org.projectlombok:lombok:1.18.36'
//JB @ 02/16/17
testImplementation 'com.google.guava:guava-testlib:33.3.1-jre'
// Mocking help
testImplementation 'org.mockito:mockito-inline:5.2.0'
// Use mockserver as a mock server for mock API responses
testImplementation 'org.mock-server:mockserver-netty:5.15.0'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.11.3'
// In-memory implementation of a java.nio.file abstract file system api
// to test writing of files without actually writing files on the host machine
testImplementation group: 'com.google.jimfs', name: 'jimfs', version: '1.3.0'
}
test {
useJUnitPlatform()
// Set the socket timeout for tests involving mockserver to 120s
systemProperties += ["mockserver.maxSocketTimeout" : 120000,
"ucar.unidata.io.http.maxReadCacheSize": 200000,
"ucar.unidata.io.http.httpBufferSize" : 200000]
}
}
project(':wres-metrics') {
dependencies {
implementation project(':wres-datamodel')
implementation project(':wres-config')
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
implementation 'org.slf4j:slf4j-api:2.0.13'
implementation group: 'org.eclipse.collections', name: 'eclipse-collections', version: '11.1.0'
compileOnly 'net.jcip:jcip-annotations:1.0'
runtimeOnly('ch.qos.logback:logback-classic:1.5.12') {
// Not used at runtime, bloat
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
testImplementation 'org.mockito:mockito-core:5.14.2'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testCompileOnly 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.11.3'
}
test {
useJUnitPlatform()
}
}
project(':wres-statistics') {
apply plugin: 'com.google.protobuf'
// Python bindings and wheel from python script
// TODO: cannot install miniconda in current build environment
// Enable this when we have more control over the build environment
//apply plugin: 'com.pswidersk.python-plugin'
// Html from markdown
apply plugin: 'org.kordamp.gradle.markdown'
def generatedDir = "${project.projectDir}/src"
// Workaround to set duplicate strategy for all copy tasks.
// See: https://github.com/gradle/gradle/issues/17236
tasks.withType(Copy).all {
duplicatesStrategy 'exclude'
}
protobuf {
// Automatically download and use the correct protobuf compiler
protoc {
artifact = 'com.google.protobuf:protoc:3.25.5'
}
// So all IDEs/editors can see generated files, use actual src dir:
generatedFilesBaseDir = "${generatedDir}"
// Generate python bindings: more long-winded as java is a default option
generateProtoTasks {
all().each {task ->
task.builtins {
// Python sources
python {
outputSubDir = 'python'
}
}
}
}
}
sourceSets {
main {
// Tell protobuf plugin where to find .proto schema files:
proto {
srcDirs = ['nonsrc']
}
}
}
// Set the python version to use
// TODO: cannot install miniconda in current build environment
// Enable this when we have more control over the build environment
//pythonPlugin {
// pythonVersion = "3.8.2"
//}
// Generate a python wheel artifact for the wres protobuf bindings for use in python applications
// Also generate an html document from markdown
// TODO: cannot install miniconda in current build environment
// Enable this when we have more control over the build environment
//task (buildProtobufBindingsForPython, type: VenvTask, dependsOn: ['generateProto'] ) {
// workingDir = file( "src/main/python" )
// args = ["wresproto.py"]
//}
task copyProtoSchemaToDist(type: Copy, dependsOn: markdownToHtml) {
description = 'Copies the Protobuf schema from nonsrc to dist/src.'
destinationDir = file("${project.projectDir}/dist/wresproto/src/wresproto")
delete fileTree(dir: destinationDir)
from fileTree("${project.projectDir}/nonsrc/wresproto").include("*.proto")
into destinationDir
}
// Generate html from markdown
markdownToHtml {
sourceDir = new File("${project.projectDir}/dist/wresproto/doc")
outputDir = new File("${project.projectDir}/dist/wresproto/doc")
// Enable all options
markdownToHtml.all = true
}
// Clean the generated java bindings before regenerating them: #86722
task cleanProtoGeneratedDir() {
def javaBindingsDir = file("${project.projectDir}/src/main/java/wres")
delete fileTree(dir: javaBindingsDir).include('**/generated/*.java')
}
// Tie the preparation of the Protobuf distribution into the java compile task for convenience.
compileJava.dependsOn copyProtoSchemaToDist
// Tie the clean of the protobuf java bindings directory to the compile task
compileJava.dependsOn cleanProtoGeneratedDir
// Tie the python wheel generation into the java compile task for convenience
// TODO: cannot install miniconda in current build environment
// Enable this when we have more control over the build environment
//compileJava.dependsOn buildProtobufBindingsForPython
dependencies {
api 'com.google.protobuf:protobuf-java:3.25.5'
implementation 'org.slf4j:slf4j-api:2.0.13'
runtimeOnly('ch.qos.logback:logback-classic:1.5.12') {
// Not used at runtime, bloat
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
}
// Facilitate unit tests with JUnit
test {
useJUnitPlatform()
}
// Make this a Java Platform Module System (Java 9 jigsaw) module
java.modularity.inferModulePath.set(true)
}
// Return /etc/system-release file as a string if readable, else empty string.
static String readElInfo()
{
def elInfoPath = Paths.get('/etc/system-release')
def elInfoReadable = Files.isReadable(elInfoPath)
if (elInfoReadable)
{
return Files.readString(elInfoPath)
}
return ''
}
project(':wres-vis') {
// Check if the dependency modules version is later. If so, update this
// module to that later version.
// See #105526: there is an ordering issue whereby the correct
// project.version does not propagate to the application plugin tasks
// (distZip, distTar etc.) unless the project.version is determined and
// set before the application plugin is applied
def gitCommitOfDependencies = grgit.log(paths: ['wres-datamodel',
'wres-eventsbroker',
'wres-events'], maxCommits: 1).find()
// Null check in case there is a new module with no history
if (gitCommitOfDependencies != null)
{
def gitCommitIdOfDependencies = gitCommitOfDependencies.id
def gitCommitDateOfDependencies = gitCommitOfDependencies.dateTime.withZoneSameInstant(ZoneId.of("UTC"))
def gitCommitOfThisModule = grgit.log(paths: [project.name, 'build.gradle', 'gradle'], maxCommits: 1).find()
def gitCommitDateOfThisModule = gitCommitOfThisModule.dateTime.withZoneSameInstant(ZoneId.of("UTC"))
def versionOfDependencies =
gitCommitDateOfDependencies.format('yyyyMMdd') + '-' + gitCommitIdOfDependencies[0..6]
if (gitCommitDateOfDependencies.isAfter(gitCommitDateOfThisModule))
{
version = versionOfDependencies
println("Set wres-vis version: " + project.version)
if (!grgit.status().isClean())
{
version = version + '-dev'
}
}
}
apply plugin: 'application'
// Workaround windows paths that are too long by overriding the explicit setting of individual dependencies
startScripts {
classpath = files('$APP_HOME/lib/*')
// Note: see lengthy note in main application below
classpath += files('conf')
}
mainClassName = 'wres.vis.client.GraphicsClient'
applicationDefaultJvmArgs = ['-Xms640m', '-Xmx640m',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+CrashOnOutOfMemoryError',
'-Djava.util.logging.config.file=logging.properties',
'-Dorg.jboss.logging.provider=slf4j']
distributions {
main {
println(project.version)
contents {
from {
// Note: see lengthy note in main application below
['dist']
}
}
}
}
dependencies {
implementation project(':wres-config')
implementation project(':wres-datamodel')
implementation project(':wres-eventsbroker')
implementation project(':wres-events')
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation group: 'com.sun.xml.fastinfoset', name: 'FastInfoset', version: '2.1.1'
implementation 'org.slf4j:slf4j-api:2.0.13'
implementation group: 'org.jfree', name: 'jfreechart', version: '1.5.5'
// SVG graphics from JFreeChart instances
implementation group: 'org.jfree', name: 'org.jfree.svg', version: '4.1'
runtimeOnly('ch.qos.logback:logback-classic:1.5.12') {
// Not used at runtime, bloat
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
// For ohdcommonchps.jar:
runtimeOnly group: 'org.slf4j', name: 'log4j-over-slf4j', version: '2.1.0-alpha1'
// JUnit 5 API and runtime
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
// Backwards compatibility for JUnit 4 tests
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.11.3'
// Mocking help
testImplementation 'org.mockito:mockito-core:5.14.2'
testRuntimeOnly files('dist/lib/conf')
// In-memory implementation of a java.nio.file abstract file system api
// to test writing of files without actually writing files on the host machine
testImplementation group: 'com.google.jimfs', name: 'jimfs', version: '1.3.0'
}
// Facilitate unit tests with JUnit
test {
useJUnitPlatform()
}
}
project(':wres-config') {
apply plugin: 'com.github.seanrl.jaxb'
dependencies {
implementation project(':wres-statistics')
implementation 'org.slf4j:slf4j-api:2.0.13'
runtimeOnly('ch.qos.logback:logback-classic:1.5.12') {
// Not used at runtime, bloat
exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework'
}
// For Java 9+ compatibility:
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
api 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1'
// To know about @Locatable
compileOnlyApi 'org.glassfish.jaxb:jaxb-core:2.3.0.1'
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:2.3.8'
runtimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.12'
// For YAML (de)serialization.
implementation 'com.fasterxml.jackson:jackson-bom:2.18.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.18.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.18.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.1'
implementation('com.hubspot.jackson:jackson-datatype-protobuf:0.9.17') {
// Exclude old modules to eliminate several CVEs
// Remove older protobuf version and include later version below
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.protobuf', module: 'protobuf-java-util'
// Remove older guava version
exclude group: 'com.google.guava', module: 'guava'
}
// Include later dependency versions for the excluded dependencies above
implementation 'com.google.protobuf:protobuf-java:3.25.5'
implementation 'com.google.guava:guava:33.3.1-jre'
// To validate WKT strings as geometries
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
implementation group: 'org.locationtech.jts', name: 'jts-io', version: '1.20.0', ext: 'pom'
// Protobuf utilities
implementation 'com.google.protobuf:protobuf-java-util:3.25.5'
implementation 'org.apache.commons:commons-lang3:3.17.0'
// For reading CSV thresholds
implementation group: 'com.opencsv', name: 'opencsv', version: '5.9'
// YAML/JSON schema validation
implementation 'com.networknt:json-schema-validator:1.5.4'
// To auto-generate builders for Java records through annotation processing
annotationProcessor 'io.soabase.record-builder:record-builder-processor:41'
compileOnly 'io.soabase.record-builder:record-builder-core:41'