-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.gradle
412 lines (339 loc) · 15.8 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
buildscript {
dependencies {
classpath("org.flywaydb:flyway-database-postgresql:10.17.2")
}
}
plugins {
id 'application'
id 'uk.gov.hmcts.java' version '0.12.63'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.springframework.boot' version '3.3.3'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.1.0.4882'
id 'jacoco'
id 'checkstyle'
id 'io.freefair.lombok' version '8.10'
id 'info.solidsoft.pitest' version '1.15.0'
id 'org.owasp.dependencycheck' version '9.2.0'
id 'au.com.dius.pact' version '4.2.14'
id 'org.flywaydb.flyway' version '10.17.2'
id 'net.serenity-bdd.serenity-gradle-plugin' version '3.0.0'
}
apply plugin: 'java'
apply plugin: 'idea'
group = 'uk.gov.hmcts.dm'
version = '2.0.0'
mainClassName = 'uk.gov.hmcts.dm.DmApp'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
contractTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
}
configurations {
functionalTestImplementation.extendsFrom(testImplementation)
functionalTestRuntimeOnly.extendsFrom(testRuntimeOnly)
smokeTestImplementation.extendsFrom(testImplementation)
smokeTestRuntimeOnly.extendsFrom(testRuntimeOnly)
contractTestImplementation.extendsFrom(testImplementation)
contractTestRuntimeOnly.extendsFrom(testRuntimeOnly)
}
configurations.all {
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-security'
exclude group: 'org.springframework.security', module: 'spring-security-rsa'
exclude group: 'org.codehaus.jettison', module: 'jettison'
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters' << '-Xlint:deprecation'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://repo.spring.io/milestone/'}
}
def versions = [
ehcache : '3.10.8',
postgresql : '42.7.4',
jackson : '2.17.2',
serenity : '3.7.0',
serenityreporter : '3.7.0',
serenityRestAssured: '3.7.0',
logging : '6.1.6',
pact_version : '4.1.7',
emTestHelper : '2.0.8',
shedlock : '5.15.1',
hibernate : '6.6.0.Final',
jupiter : '5.11.0',
springSecurity : '6.3.3'
]
dependencies {
implementation group: 'com.azure', name: 'azure-storage-blob', version: '12.27.1'
implementation group: 'org.apache.tika', name: 'tika-core', version: '2.9.2'
implementation group: 'com.google.guava', name: 'guava', version: '33.3.0-jre'
implementation group: 'commons-io', name: 'commons-io', version: '2.16.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: versions.jackson
implementation group:'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5-jakarta', version: versions.fasterXmlJackson
implementation group: 'org.ehcache', name: 'ehcache', version: versions.ehcache, {
exclude group: "org.glassfish.jaxb", module: "jaxb-runtime"
}
implementation group: 'org.springframework', name: 'spring-context-support', version: '6.1.12'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', {
exclude group: "org.hibernate", module: "hibernate-core"
}
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-batch'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.16.0'
implementation group: 'org.hibernate', name: 'hibernate-core', version: versions.hibernate
implementation group:'org.hibernate', name: 'hibernate-envers', version: versions.hibernate
implementation group: 'org.postgresql', name: 'postgresql', version: versions.postgresql
implementation group: "net.javacrumbs.shedlock", name: "shedlock-spring", version: versions.shedlock
implementation group: "net.javacrumbs.shedlock", name: "shedlock-provider-jdbc-template", version: versions.shedlock
implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.17.2'
runtimeOnly group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '10.17.2'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '5.2.0'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '8.0'
implementation group: 'com.github.hmcts', name: 'java-logging', version: versions.logging
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: '4.1.4'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.3'
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-web', 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: '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.apache.groovy', name: 'groovy', version: '4.0.22'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude(module: 'commons-logging')
}
testImplementation group: 'org.springframework.security', name: 'spring-security-test', version: '6.3.3'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.jupiter
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.jupiter
testImplementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.2'
testImplementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '4.0.5'
testImplementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
testImplementation group: 'com.github.stephenc.jcip', name :'jcip-annotations', version:'1.0-1'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenityRestAssured
testImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-single-page-report', version: versions.serenityreporter
testRuntimeOnly group: 'org.junit.vintage', name : 'junit-vintage-engine', version: versions.jupiter
functionalTestImplementation group: 'com.github.hmcts', name: 'em-test-helper', version: versions.emTestHelper
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.4.4', classifier: 'all', {
exclude group: 'commons-io', module: 'commons-io'
exclude group: 'org.apache.commons', module: 'commons-lang3'
}
testImplementation group: 'org.testcontainers', name: 'postgresql', version: '1.20.1'
//pact
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'junit5', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'spring', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'junit5spring', version: versions.pact_version
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.jupiter
contractTestRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version : versions.jupiter
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
}
dependencyManagement {
dependencies {
dependencySet(group: 'org.junit.platform', version: '1.11.0') {
entry 'junit-platform-commons'
}
}
}
dependencyCheck {
suppressionFile = 'config/owasp/dependency-check-suppressions.xml'
}
checkstyle {
maxWarnings = 0
toolVersion = '10.18.0'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
def coverageExclusionList = [
'**uk/gov/hmcts/dm/DmApp.java',
'**uk/gov/hmcts/dm/hateos/*',
'**uk/gov/hmcts/dm/exception/*',
'**uk/gov/hmcts/dm/domain/*',
'**uk/gov/hmcts/dm/commandobject/*',
'**uk/gov/hmcts/dm/config/**/*',
'**uk/gov/hmcts/dm/errorhandler/*',
'**uk/gov/hmcts/dm/repository/RepositoryFinder.java',
'**uk/gov/hmcts/dm/actuate/health/IdamHealth.java',
'**uk/gov/hmcts/dm/actuate/health/IdamServiceHealth.java',
'**uk/gov/hmcts/dm/controller/WelcomeController.java',
'**uk/gov/hmcts/dm/service/Constants.java',
'**uk/gov/hmcts/dm/service/FileContentVerifier*',
'**uk/gov/hmcts/dm/service/DocumentContentVersionModel.java',
'**uk/gov/hmcts/dm/data/migration/PendingMigrationScriptException*',
'**uk/gov/hmcts/dm/data/migration/FlywayNoOpStrategy*',
'**uk/gov/hmcts/dm/config/security/DmServiceAuthFilter*'
]
//(jacocoTestReport | jacocoTestCoverageVerification)
jacoco {
toolVersion = "0.8.12"
reportsDirectory = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
xml.outputLocation = file("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
pitest {
targetClasses = ['uk.gov.hmcts.dm.*']
excludedClasses = [
'uk.gov.hmcts.dm.authchecker.*' ,
'uk.gov.hmcts.dm.domain.*',
'uk.gov.hmcts.dm.DmApp.java',
'uk.gov.hmcts.dm.service.util.*'
]
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation ='build/reports/pitest/fastermutationtestingoutput'
threads = 15
testSourceSets = [sourceSets.test]
mainSourceSets = [sourceSets.main]
fileExtensionsToFilter.addAll('xml','json')
outputFormats = ['XML', 'HTML','CSV']
mutationThreshold = 5
coverageThreshold = 0
jvmArgs = ['-Xms1G','-Xmx3G']
timestampedReports = false
failWhenNoMutations = false
detectInlinedCode = true
}
project.tasks['sonarqube'].group = "Verification"
project.tasks['sonarqube'].dependsOn test, jacocoTestReport
sonarqube {
properties {
property "sonar.projectName", "${rootProject.name}"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.outputLocation}"
property "sonar.exclusions", coverageExclusionList.join(", ")
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}
bootJar {
getArchiveFileName().set(provider {
'dm-store.jar'
})
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
//This is used in get the version for fakeversion and buildInfo (./gradlew -q printVersion)
task printVersion {
description 'Prints the version of this project'
doLast {
print project.version
}
}
// https://github.com/gradle/gradle/issues/16791
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
test {
useJUnitPlatform()
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
// doFirst(){
// printf("Available processors:::::::::: " + Runtime.runtime.availableProcessors().intdiv(2).toString())
// }
//
// maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
// forkEvery = 10
group = 'Delivery pipeline'
description = 'Executes functional tests'
setTestClassesDirs(sourceSets.functionalTest.output.classesDirs)
setClasspath(sourceSets.functionalTest.runtimeClasspath)
environment("APPINSIGHTS_INSTRUMENTATIONKEY", "test-key")
//finalizedBy aggregate
}
serenity {
reports = ["single-page-html"]
}
processContractTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processFunctionalTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
task smoke(type: Test) {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests'
setTestClassesDirs(sourceSets.smokeTest.output.classesDirs)
setClasspath(sourceSets.smokeTest.runtimeClasspath)
include "uk/gov/hmcts/dm/smoke/**"
environment("APPINSIGHTS_INSTRUMENTATIONKEY", "test-key")
}
task fortifyScan(type: JavaExec) {
mainClass.set("uk.gov.hmcts.fortifyclient.FortifyClientMainApp")
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
project.ext {
pactVersion = getCheckedOutGitCommitHash()
}
static def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
task runProviderPactVerification(type: Test) {
logger.lifecycle("Runnning contract Tests")
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
systemProperty 'pact.verifier.publishResults', System.getProperty('pact.verifier.publishResults')
systemProperty 'pact.provider.version', pactVersion.toString();
}
runProviderPactVerification.finalizedBy pactVerify
flyway {
url = System.getenv('FLYWAY_URL')
user = System.getenv('FLYWAY_USER')
password = System.getenv('FLYWAY_PASSWORD')
baselineOnMigrate = true
baselineVersion = '1'
}
task migratePostgresDatabase(type: org.flywaydb.gradle.task.FlywayMigrateTask) {
baselineOnMigrate = true
if (project.hasProperty("dburl")) {
url = "jdbc:postgresql://${dburl}"
}
}