-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
600 lines (497 loc) · 24 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
import uk.gov.hmcts.rse.AuthMode
plugins {
id 'application'
id 'checkstyle'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '2.7.18'
id 'org.owasp.dependencycheck' version '9.2.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.1.0.4882'
id 'au.com.dius.pact' version '4.2.14'
id "io.freefair.lombok" version "8.10.2"
id 'com.github.hmcts.rse-cft-lib' version '0.19.1512'
id "org.flywaydb.flyway" version "10.20.1"
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
def versions = [
junit : '5.11.4',
junitPlatform : '1.11.4',
springBoot : springBoot.class.package.implementationVersion,
springStatemachine: '4.0.0',
lombok : '1.18.36',
springSecurity : '5.8.15',
camunda : '7.20.0',
jackson : '2.18.2',
testcontainers : '1.20.3',
pdfbox : '3.0.2',
tika : '2.9.2'
]
allprojects {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.github.ben-manes.versions'
checkstyle {
maxWarnings = 0
toolVersion = '10.18.2'
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
jacoco {
toolVersion = '0.8.8' // jacocoMavenPluginVersion
reportsDirectory = file("$buildDir/reports/jacoco")
}
// before committing a change, make sure task still works
dependencyUpdates {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
rejectVersionIf { selection -> // <---- notice how the closure argument is named
return isNonStable(selection.candidate.version) && !isNonStable(selection.currentVersion)
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'true' ? 0 : 11
suppressionFile = 'config/owasp/suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
retirejs {
enabled = false
}
ossIndex {
enabled = false
}
}
}
dependencyManagement {
dependencies {
//CVE-2018-10237 - Unbounded memory allocation
dependencySet(group: 'com.google.guava', version: '33.3.1-jre') {
entry 'guava'
}
dependency group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-common', version: '1.9.25'
dependency group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk7', version: '1.9.25'
dependency group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: '1.9.25'
dependency group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.9.25'
dependency group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.9.25'
dependency group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.12.0'
//Solves CVE-2023-34034
dependency group: 'org.springframework.security', name: 'spring-security-crypto', version: '6.2.1'
dependency group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson
dependency group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson
dependency group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: versions.jackson
// To prevent other libraries using conflicting versions
dependency group: 'org.slf4j', name: 'slf4j-nop', version: '2.0.16'
// solves CVE-2022-25857
dependencySet(
group: 'org.yaml',
version: '2.3'
) {
entry 'snakeyaml'
}
dependencySet(group: 'org.apache.tomcat.embed', version: '10.1.34') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-el'
entry 'tomcat-embed-websocket'
}
//Solves CVE-2023-6481
dependencySet(group: 'ch.qos.logback', version: '1.2.13') {
entry 'logback-core'
entry 'logback-classic'
}
}
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.9'
mavenBom "com.azure.spring:spring-cloud-azure-dependencies:5.17.1"
}
}
configurations {
testCompile.exclude group: 'ch.qos.logback', module: 'logback-classic'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://jitpack.io"
}
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
contractTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/contractTest/java')
}
resources.srcDir file('src/contractTest/resources')
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
tasks.withType(Test) {
useJUnitPlatform()
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
tasks.withType(Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task integration(type: Test) {
maxHeapSize = '3G'
description = "Runs integration tests"
group = "Verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
failFast = true
testLogging.showStandardStreams = false
}
task contract(type: Test) {
group = 'Delivery pipeline'
description = 'Runs the consumer Pact tests'
setTestClassesDirs(sourceSets.contractTest.output.classesDirs)
setClasspath(sourceSets.contractTest.runtimeClasspath)
systemProperty 'pact.rootDir', "pacts"
}
task fortifyScan(type: JavaExec, description: 'Run fortify scan.') {
getMainClass().set("uk.gov.hmcts.fortifyclient.FortifyClientMainApp")
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
task awaitApplicationReadiness(type: Exec, description: 'Awaits until application is ready.') {
commandLine './bin/wait-for.sh'
commandLine './bin/wait-for.sh', 'manage-case'
}
task runSmokeTests(type: Exec, description: 'Runs smoke tests.') {
commandLine '/usr/bin/yarn', '--silent', 'run', 'test:smoke'
}
task runProdApiTests(type: Exec, description: 'Runs Prod features in functional tests.') {
onlyIf {
return System.env.ENVIRONMENT == 'aat'
}
commandLine '/usr/bin/yarn', '--silent', 'run', 'test:api-prod'
}
task runNonProdApiTestsByGroups(description: 'Runs Non Prod features in functional tests.') {
onlyIf {
return System.env.ENVIRONMENT == 'preview'
}
doLast {
def ftGroups = System.env.PR_FT_GROUPS ?: 'nonprod'
for (ftGroup in ftGroups.toLowerCase().split(",")) {
exec {
logger.info('Running FT group: ' + ftGroup)
commandLine '/usr/bin/yarn', 'run', 'test:api-' + ftGroup
}
}
}
}
task runNightlyApiTests(type: Exec, description: 'Runs additional multiparty nightly tests.') {
onlyIf {
return System.env.NIGHTLY_RUN == 'true'
}
commandLine '/usr/bin/yarn', '--silent', 'run', 'test:api-nightly-prod'
}
def inStrictOrder(Task... tasks) {
for (int i = 0; i < tasks.size() - 1; i++) {
tasks[i + 1].mustRunAfter(tasks[i])
}
return tasks
}
task smoke(description: 'Runs the smoke tests.') {
dependsOn(inStrictOrder(awaitApplicationReadiness, runSmokeTests))
}
task functional(description: 'Runs the functional tests.') {
dependsOn(inStrictOrder(awaitApplicationReadiness,
runNightlyApiTests, runProdApiTests, runNonProdApiTestsByGroups))
}
project.tasks['sonarqube'].dependsOn test, jacocoTestReport
// excluding controllers from Sonar due to https://tools.hmcts.net/jira/browse/DTSCCI-254
// https://tools.hmcts.net/jira/browse/DTSCCI-311 ticket to write unit test for each controller
sonarqube {
properties {
property "sonar.projectName", "CIVIL :: service"
property "sonar.projectKey", "civil-service"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.destination.path}"
property "sonar.coverage.exclusions", "**/model/**, **/config/**/*Configuration.java, **/request/servlet/** , **/controllers/**, **/testingsupport/**, **/*ExternalTaskListener.java, **/*BaseExternalTaskHandler.java, **/stereotypes/**, **/*Exception.java, **/EventHistoryMapper*.java, **/model/hearingvalues/**, **/enums/hearing/**, **/fees/client/**, **/enums/sdo/**, **/service/PaymentsService.java, **/DashboardWithParamsCallbackHandler.java, **/PaymentRequestUpdateCallbackService.java, **/advice/**"
property "sonar.cpd.exclusions", "**/*DocumentManagementService.java, **/*Spec*.java, **/*CcdDashboardClaimantClaimMatcher.java, **/*CcdDashboardDefendantClaimMatcher.java"
property "sonar.exclusions", "**/hmc/model/**, **/model/hearingvalues/**, **/handler/callback/camunda/dashboardnotifications/claimant/CCJRequestedDashboardNotificationHandler.java, **/handler/callback/camunda/dashboardnotifications/claimant/ClaimantCCJResponseNotificationHandler.java" +
", **/handler/callback/camunda/dashboardnotifications/claimant/ClaimantResponseNotificationHandler.java, **/utils/**, **/filters/**, **/handler/callback/camunda/dashboardnotifications/defendant/MoreTimeRequestedDashboardNotificationDefendantHandler.java, **/handler/callback/camunda/dashboardnotifications/claimant/ClaimantMediationSuccessfulDashboardNotificationHandler.java, **/handler/callback/camunda/dashboardnotifications/claimant/ClaimSettledDashboardNotificationHandler.java, **/handler/callback/camunda/dashboardnotifications/claimant/HearingScheduledClaimantNotificationHandler.java, **/handler/callback/camunda/dashboardnotifications/defendant/SettleClaimPaidInFullDefendantDashboardNotificationHandler.java, **/handler/callback/camunda/dashboardnotifications/defendant/DefendantNotifyDiscontinuanceDashboardNotificationHandler.java"
property "sonar.host.url", "https://sonar.reform.hmcts.net/"
property "sonar.web.javaOpts", "-Xmx2G"
}
}
jacocoTestReport {
executionData(test, integration)
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled = true
csv.enabled = false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
jacocoTestReport.dependsOn {
subprojects*.test
}
ext.libraries = [
junit5: [
"org.junit.jupiter:junit-jupiter-api:${versions.junit}",
"org.junit.jupiter:junit-jupiter-engine:${versions.junit}",
"org.junit.jupiter:junit-jupiter-params:${versions.junit}",
"org.junit.platform:junit-platform-commons:${versions.junitPlatform}",
"org.junit.platform:junit-platform-engine:${versions.junitPlatform}"
]
]
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.projectlombok') {
details.useVersion versions.lombok
}
}
exclude group: 'org.springframework.security', module: 'spring-security-rsa'
exclude group: 'org.projectlombok', module: 'lombok-mapstruct-binding'
}
dependencies {
def withoutJunit4 = {
exclude group: 'junit', module: 'junit'
}
implementation 'com.github.hmcts:civil-commons:v1.1.5'
implementation project(':dashboard-notifications')
implementation group: 'org.springframework.data', name: 'spring-data-jpa'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
implementation group: 'org.springframework', name: 'spring-aspects'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation group: 'org.springframework.statemachine', name: 'spring-statemachine-core', version: versions.springStatemachine
implementation group: 'org.springframework.statemachine', name: 'spring-statemachine-test', version: versions.springStatemachine
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.8.0'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.4'
implementation group: 'javax.persistence', name: 'javax.persistence-api'
implementation group: 'org.jdbi', name: 'jdbi3-sqlobject', version: '3.46.0'
implementation group: 'org.jdbi', name: 'jdbi3-spring4', version: '3.19.0'
implementation group: 'org.flywaydb', name: 'flyway-core'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.10.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-openfeign-core'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '4.1.2'
implementation group: 'org.apache.tika', name: 'tika-core', version: versions.tika
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: '13.5'
implementation group: 'org.springframework.retry', name: 'spring-retry'
implementation group: 'com.github.hmcts', name: 'java-logging', version: '6.1.7'
implementation group: 'com.github.hmcts', name: 'ccd-client', version: '4.9.5-SPRING2'
implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1'
implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '3.0.23'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version:'7.4'
implementation('com.github.hmcts:fees-java-client:0.0.6') {
exclude group: 'uk.gov.hmcts.reform', module: 'java-logging'
}
implementation('com.github.hmcts:payments-java-client:1.6.7') {
exclude group: 'uk.gov.hmcts.reform', module: 'java-logging'
exclude group: 'uk.gov.hmcts.reform', module: 'service-auth-provider-client'
}
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '5.2.1-RELEASE'
implementation group: 'com.github.hmcts', name: 'ccd-case-document-am-client', version: '1.7.1'
implementation group: 'com.sendgrid', name: 'sendgrid-java', version: '4.10.3'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
implementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-cache'
implementation group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '3.1.8'
implementation group: 'org.springframework.security', name: 'spring-security-web', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-config', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-core', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: versions.springSecurity
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: versions.springSecurity
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.41.2'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.12.6'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '2.1.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.24.3'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.24.3'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.98'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '10.1.34'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '7.17.26'
implementation group: 'com.networknt', name: 'json-schema-validator', version: '1.5.4'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: versions.jackson
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: versions.jackson
implementation group: 'org.camunda.bpm', name: 'camunda-external-task-client', version: versions.camunda
implementation group: 'org.camunda.community.rest', name: 'camunda-platform-7-rest-client-spring-boot-starter', version: versions.camunda
implementation group: 'org.camunda.bpm', name: 'camunda-engine-rest-core', version: versions.camunda
implementation group: 'org.apiguardian', name: 'apiguardian-api', version: '1.1.2'
// JAX-B dependencies for JDK 9+
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.2'
implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '4.0.5'
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '6.3.0'
implementation group: 'com.azure', name: 'azure-core', version: '1.53.0'
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.17.7'
implementation group: 'com.microsoft.azure', name: 'azure-servicebus', version: '3.6.7'
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox
implementation group: 'org.apache.pdfbox', name: 'pdfbox-io', version: versions.pdfbox
testImplementation group: 'org.apache.pdfbox', name: 'pdfbox-io', version: versions.pdfbox
testImplementation group: 'org.apache.pdfbox', name: 'preflight', version: versions.pdfbox, withoutJunit4
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.11.0'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.11.0'
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '4.11.0'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.15.11'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.15.11'
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testImplementation libraries.junit5
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation group: 'io.rest-assured', name: 'rest-assured'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.26.3'
testImplementation group: 'org.springframework.statemachine', name: 'spring-statemachine-test', version: versions.springStatemachine
testImplementation 'com.github.hmcts:fortify-client:1.4.6:all'
//pact contract testing
contractTestImplementation 'au.com.dius.pact.consumer:junit5:4.6.5'
contractTestImplementation group: 'org.hamcrest', name: 'java-hamcrest', version: '2.0.0.0'
contractTestImplementation('org.junit.jupiter:junit-jupiter-api:5.11.4')
contractTestImplementation('org.junit.jupiter:junit-jupiter-engine:5.11.4')
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
integrationTestImplementation('org.junit.jupiter:junit-jupiter-api:5.11.4')
integrationTestImplementation('org.junit.jupiter:junit-jupiter-engine:5.11.4')
// dashboard specific changes
testImplementation group: 'org.testcontainers', name: 'postgresql', version: versions.testcontainers
testImplementation group: 'org.testcontainers', name: 'junit-jupiter', version: versions.testcontainers
testImplementation group: 'com.h2database', name: 'h2', version: '2.3.232'
// dashboard specific changes ends
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
// https://mvnrepository.com/artifact/com.opencsv/opencsv
implementation group: 'com.opencsv', name: 'opencsv', version: '5.9', {
exclude group: 'commons-collections', module: 'commons-collections'
}
}
mainClassName = 'uk.gov.hmcts.reform.civil.Application'
bootJar {
getArchiveFileName().set(provider {
'civil-service.jar'
})
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
task buildCCDXlsx(type: Exec) {
group 'ccd tasks'
environment 'CCD_DEF_CASE_SERVICE_BASE_URL', 'http://localhost:4000'
environment 'CCD_DEF_GEN_APP_SERVICE_BASE_URL', 'http://localhost:9999'
environment 'CCD_DEF_AAC_URL', 'http://localhost:4502'
commandLine './bin/build-civil-xlsx-definitions.sh'
}
task runOtherServices(type: Exec) {
group 'ccd tasks'
environment 'ADDITIONAL_COMPOSE_FILES', 'cftlib-additional-services.yml'
environment 'BASE_COMPOSE_FILES_PATH', './src/cftlib/resources/docker/'
commandLine './bin/add-services.sh'
doLast() {
importBpmnDiagrams
}
}
task importBpmnDiagrams(type: Exec) {
group 'ccd tasks'
dependsOn(runOtherServices)
environment 'CAMUNDA_BASE_URL', 'http://localhost:9404'
environment 'SERVICE_AUTH_PROVIDER_API_BASE_URL', 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal'
commandLine './bin/import-bpmn-diagram-cftlib.sh'
}
bootWithCCD {
group 'ccd tasks'
dependsOn(buildCCDXlsx)
dependsOn(runOtherServices)
dependsOn(importBpmnDiagrams)
//AAT or Local (IDAM and S2S Simulators)
authMode = AuthMode.AAT
environment 'BASE_COMPOSE_FILES_PATH', './src/cftlib/resources/docker/'
environment 'RSE_LIB_ADDITIONAL_DATABASES', 'cmc'
doFirst() {
project.file('./.aat-env').readLines().each() {
def index = it.indexOf("=")
def key = it.substring(0, index)
def value = it.substring(index + 1)
environment(key, value)
}
}
}
task runAndPublishConsumerPactTests(type: Test) {
dependsOn(contract)
logger.lifecycle("Runs pact Tests")
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
finalizedBy(pactPublish)
}
project.ext {
pactVersion = getCheckedOutGitCommitHash()
}
pact {
publish {
pactDirectory = 'pacts'
pactBrokerUrl = System.getenv("PACT_BROKER_FULL_URL") ?: 'http://localhost:80'
tags = [System.getenv("PACT_BRANCH_NAME") ?: 'Dev']
version = project.pactVersion
}
}
def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
task loadEnvSecrets() {
doLast {
new ByteArrayOutputStream().withStream { os ->
exec {
commandLine 'az', 'keyvault', 'secret', 'show', '--vault-name', 'civil-aat', '-o', 'tsv', '--query', 'value', '--name', 'civil-service-dot-env'
standardOutput = os
}
project.file('./.aat-env').write(new String(os.toString().replace('\n', '').decodeBase64(), java.nio.charset.StandardCharsets.UTF_8))
}
}
}
bootRun {
doFirst() {
if (project.file('./.aat-env').exists()) {
project.file('./.aat-env').readLines().each() {
def index = it.indexOf("=")
def key = it.substring(0, index)
def value = it.substring(index + 1)
environment key, value
}
}
}
}