-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
360 lines (300 loc) · 13 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
plugins {
id 'application'
id 'checkstyle'
id 'uk.gov.hmcts.java' version '0.12.63'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '3.4.0'
id 'org.owasp.dependencycheck' version '11.1.1'
id 'com.github.ben-manes.versions' version '0.51.0'
id "info.solidsoft.pitest" version '1.15.0'
id 'org.sonarqube' version '6.0.1.5171'
id 'com.gorylenko.gradle-git-properties' version '2.4.2'
id "io.freefair.lombok" version "8.11"
}
group = 'uk.gov.hmcts.reform'
version = '1.0.2'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
gitProperties {
gitPropertiesDir = new File("${project.rootDir}/src/main/resources/uk/gov/hmcts/reform/pcqloader/gitcommit")
keys = ['git.commit.id','git.commit.time']
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "GMT"
}
sourceSets {
test {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/test/java')
}
resources.srcDir file('src/test/resources')
}
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/smokeTest/java')
}
resources.srcDir file('src/smokeTest/resources')
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
functionalTestImplementation.extendsFrom testImplementation
functionalTestRuntime.extendsFrom testRuntime
smokeTestRuntime.extendsFrom testRuntime
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
task unit(type: Test, description: 'Runs the unit tests.', group: 'Verification') {
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
useJUnitPlatform()
}
task functional(type: Test) {
group = 'Functional Tests'
description = 'Verifies that files from functionPreDeploy step were processed following job creation in AKS'
setTestClassesDirs(sourceSets.functionalTest.output.classesDirs)
setClasspath(sourceSets.functionalTest.runtimeClasspath)
include "uk/gov/hmcts/reform/pcqloader/postdeploy/**"
}
task integration(type: Test, description: 'Runs the integration tests.', group: 'Verification') {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform()
}
task fortifyScan(type: JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
checkstyle {
maxWarnings = 0
toolVersion = '10.21.0'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
configDirectory = new File(rootDir, 'config/checkstyle')
}
pmd {
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.functionalTest, sourceSets.integrationTest, sourceSets.smokeTest]
reportsDir = file("$project.buildDir/reports/pmd")
// https://github.com/pmd/pmd/issues/876
ruleSets = []
ruleSetFiles = files("config/pmd/ruleset.xml")
}
project.tasks['jacocoTestReport'].dependsOn test, integration
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
xml.outputLocation = file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
pitest {
junit5PluginVersion.set('1.2.1')
targetClasses = ['uk.gov.hmcts.reform.pcqloader.*']
threads = 10
enableDefaultIncrementalAnalysis = true
outputFormats = ['XML', 'HTML']
timestampedReports = true
mutationThreshold = 50
timeoutConstInMillis = 30000
}
project.tasks['pitest'].group = "Verification"
sonarqube {
properties {
property "sonar.projectName", "Reform :: pcq-loader"
property "sonar.projectKey", "uk.gov.hmcts.reform:pcq-loader"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all {
def isNonStable = { String version ->
['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier ->
version ==~ /(?i).*[.-]\$qualifier[.\\d-+]*/
}
}
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
selection.reject('Release candidate')
}
}
}
}
// 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
}
}
dependencyManagement {
dependencies {
// CVE-2021-29425
dependency group: 'commons-io', name: 'commons-io', version: '2.18.0'
dependencySet(group: 'org.springframework.cloud', version: '4.2.0') {
entry 'spring-cloud-starter-openfeign'
entry 'spring-cloud-openfeign-core'
}
dependencySet(group: 'org.springframework.security', version: '6.4.2') {
entry 'spring-security-core'
entry 'spring-security-test'
}
dependencySet(group: 'io.netty', version: '4.1.116.Final') {
entry 'netty-buffer'
entry 'netty-codec'
entry 'netty-codec-http'
entry 'netty-codec-http2'
entry 'netty-codec-socks'
entry 'netty-common'
entry 'netty-handler'
entry 'netty-handler-proxy'
entry 'netty-resolver'
entry 'netty-transport'
entry 'netty-transport-native-epoll'
entry 'netty-transport-native-kqueue'
entry 'netty-transport-native-unix-common'
entry 'netty-codec-dns'
entry 'netty-resolver-dns'
entry 'netty-resolver-dns-native-macos'
entry 'netty-resolver-dns-classes-macos'
entry 'netty-transport-classes-epoll'
entry 'netty-transport-classes-kqueue'
}
}
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2024.0.0'
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
def versions = [
feignForm : '3.8.0',
junit : '5.9.2',
reformLogging : '6.1.7',
springBoot : springBoot.class.package.implementationVersion,
restAssured : '5.5.0',
lombok : '1.18.36',
testcontainers : '1.20.4',
springSecurity : '6.1.2'
]
dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web-services'
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-json'
implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap',version: '4.2.0'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.2.0'
implementation group: 'com.azure', name: 'azure-storage-blob', version: '12.29.0'
implementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
implementation group: "com.networknt", name: "json-schema-validator", version: "1.5.4"
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: '13.5'
implementation group: 'io.github.openfeign.form', name: 'feign-form', version: versions.feignForm
implementation group: 'io.github.openfeign.form', name: 'feign-form-spring', version: versions.feignForm
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.reformLogging
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '8.0'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-web', version: '3.6.2'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
implementation group: 'com.github.hmcts', name: 'pcq-commons', version: '1.2.5'
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.3'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'commons-net', name: 'commons-net', version: '3.11.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
testImplementation(platform(group: 'org.junit', name: 'junit-bom', version: '5.11.4'))
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.15.0'
testImplementation 'org.codehaus.sonar-plugins:sonar-pitest-plugin:0.5'
testImplementation group: 'io.rest-assured', name: 'xml-path', version: versions.restAssured
testImplementation group: 'io.rest-assured', name: 'json-path', version: versions.restAssured
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2'
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '5.2.0'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '3.0.1'
testImplementation 'com.github.hmcts:fortify-client:1.4.6:all'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-webflux'
testImplementation group: "org.testcontainers", name: "junit-jupiter", version: versions.testcontainers
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
functionalTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
smokeTestImplementation group: 'io.rest-assured', name: 'rest-assured', version: versions.restAssured
smokeTestRuntime group: 'io.rest-assured', name: 'xml-path', version: versions.restAssured
smokeTestRuntime group: 'io.rest-assured', name: 'json-path', version: versions.restAssured
smokeTestRuntime group: 'io.rest-assured', name: 'kotlin-extensions', version: versions.restAssured
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
}
test {
useJUnitPlatform()
failFast = true
}
application {
mainClass = 'uk.gov.hmcts.reform.pcqloader.PcqLoaderApplication'
}
bootJar {
archiveFileName = 'pcq-loader.jar'
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
rootProject.tasks.named("processTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processFunctionalTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processIntegrationTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processSmokeTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processResources") {
dependsOn("generateGitProperties")
}