-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
297 lines (248 loc) · 10.7 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
import java.util.stream.Collectors
plugins {
id 'java'
id 'jacoco'
id 'application'
alias libs.plugins.spring apply false
alias libs.plugins.spring.framework apply false
alias libs.plugins.owasp
alias libs.plugins.sonarqube
alias libs.plugins.pitest
alias libs.plugins.git.properties
}
apply from: './gradle/jira.gradle'
gitProperties {
// Change date format in git.properties file.
dateFormat = "yyyy-MM-dd HH:mm:ssZ"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
group = 'uk.gov.hmcts.reform.idam'
description = 'idam-web-public'
sourceCompatibility = 21
targetCompatibility = 21
configurations.all {
exclude group: "org.glassfish", module: "jakarta.el"
}
def springBootVersion = libs.versions.spring.boot.get()
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
ext['okhttp.version'] = '4.11.0'
ext['netty.version'] = '4.1.100.Final' // CVE-2023-44487
ext['jackson.version'] = '2.16.2'
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter()
}
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') == 'false' ? 11 : 0
suppressionFile = "${project.rootDir}" + '//dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
nodeEnabled = false
nodeAudit {
enabled = false
yarnEnabled = false
}
}
}
dependencies {
configurations.all {
exclude group:"org.bouncycastle", module: "bcprov-jdk15on"
exclude group:"org.bouncycastle", module: "bcutil-jdk15on"
exclude group:"org.bouncycastle", module: "bcpkix-jdk15on"
}
implementation 'org.bouncycastle:bcprov-jdk18on:1.79'
implementation 'org.bouncycastle:bcpkix-jdk18on:1.79'
implementation 'org.bouncycastle:bcutil-jdk18on:1.79'
implementation (libs.idam.api.spec) {
exclude module: 'springfox-swagger2'
exclude module: 'springfox-swagger-ui'
}
implementation libs.guava
implementation libs.commons.fileupload
implementation libs.commons.io
implementation libs.commons.text
implementation libs.snakeyaml
implementation libs.findbugs.jsr305
implementation (libs.bundles.feign) {
exclude group: 'commons-fileupload'
exclude module: 'commons-fileupload'
}
implementation libs.bundles.applicationinsights
implementation group: 'com.squareup.okio', name: 'okio', version: '3.9.1'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation group: 'org.hibernate.validator', name: 'hibernate-validator'
implementation group: 'org.springframework.security', name: 'spring-security-web'
implementation group: 'org.springframework.security', name: 'spring-security-data'
implementation group: 'org.springframework.security', name: 'spring-security-config'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-client'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-resource-server'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis-reactive'
implementation group: 'org.springframework.session', name: 'spring-session-data-redis', version: '2.7.4'
implementation group: 'org.springframework.data', name: 'spring-data-redis', version: '2.6.4'
implementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-zuul', version: '2.2.10.RELEASE') {
exclude(module: 'rxnetty-contexts')
exclude(module: 'rxnetty-servo')
exclude(module: 'rxnetty')
}
implementation group: 'com.netflix.servo', name: 'servo-core', version: '0.13.2'
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.47'
implementation group: 'org.springframework.security', name: 'spring-security-taglibs'
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
implementation group: 'javax.servlet', name: 'jstl'
implementation group: 'javax.json', name: 'javax.json-api'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind'
implementation group: 'org.apache.httpcomponents', name: 'httpclient'
implementation group: 'org.apache.httpcomponents', name: 'httpcore'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-jasper', version: '9.0.98'
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: '11.0.2'
implementation group: 'org.pitest', name: 'pitest', version: '1.16.3'
implementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0'
implementation group: 'org.owasp.encoder', name: 'encoder-jsp', version: '1.3.1'
implementation (group: 'org.codehaus.sonar-plugins', name: 'sonar-pitest-plugin', version: '0.5') {
exclude module: 'junit'
}
testImplementation 'com.github.hmcts:fortify-client:1.4.5:all'
testCompileOnly("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")
testImplementation('pl.pragmatists:JUnitParams:1.1.1') {
exclude(module: 'junit')
}
testImplementation group: 'org.mockito', name: 'mockito-core'
testImplementation group: 'org.springframework', name: 'spring-test'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-devtools'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
}
testImplementation group: 'org.springframework.security', name: 'spring-security-test'
testImplementation group: 'junit', name: 'junit'
}
task createAJiraTicket() {
doLast {
String token = System.getenv("JIRA_API_TOKEN")
createFailedPipelineJiraTicket(token)
}
}
task fortifyScan(type: JavaExec) {
classpath += sourceSets.test.runtimeClasspath
main = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
bootRun {
systemProperties = System.properties
}
task smoke(dependsOn: ':codeceptSmoke') {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests against a running instance'
}
task functional(dependsOn: ':codeceptFunctional') {
group = 'Delivery pipeline'
description = 'Executes functional tests against a running instance'
}
task yarnInstall(type: Exec) {
workingDir '.'
commandLine 'yarn', 'install'
}
task notifyClientInstall(type: Exec) {
workingDir '.'
commandLine 'yarn', 'add', 'notifications-node-client'
}
task codeceptSmoke(type: Exec, dependsOn: ':yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--grep', '@smoke', '--verbose', '--reporter', 'mocha-multi', '-c', 'codecept.smoke.conf.js'
}
task codeceptFunctional(type: Exec, dependsOn :'yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--grep', '@functional', '--verbose', '--reporter', 'mocha-multi'
}
task smokeSauce(dependsOn: ':codeceptSmokeSauce') {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests against a running instance'
}
task codeceptSmokeSauce(type: Exec, dependsOn: ':yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--config', 'saucelabs.conf.js', '--steps', '--grep', '@smoke', '--verbose', '--debug', '--reporter', 'mochawesome'
}
task crossbrowser(dependsOn: ':codeceptFunctionalSauce') {
group = 'Delivery pipeline'
description = 'Execute cross browser tests on saucelabs'
}
task codeceptFunctionalSauce(type: Exec, dependsOn: ':yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run-multiple', '--all', '--config', 'saucelabs.conf.js', '--grep', '@crossbrowser', '--verbose', '--debug', '--steps', '--reporter', 'mocha-multi'
}
}
project.tasks['sonarqube'].dependsOn test
def listFiles(String pattern) {
return new FileNameFinder()
.getFileNames("${project.rootDir}", pattern)
.stream()
.collect(Collectors.joining(","))
}
sonarqube {
properties {
property "sonar.projectName", "SIDAM-WEB-PUBLIC"
property "sonar.exclusions", "**/uk/gov/hmcts/reform/idam/web/config/properties/*.java," +
"**/uk/gov/hmcts/reform/idam/web/config/IdamWebMvcConfiguration.java," +
"**/uk/gov/hmcts/reform/idam/web/config/SessionConfiguration.java," +
"**/uk/gov/hmcts/reform/idam/web/config/AppConfiguration.java," +
"**/uk/gov/hmcts/reform/idam/web/config/AppConfigurationSSO.java," +
"**/uk/gov/hmcts/reform/idam/web/model/*.java," +
"**/uk/gov/hmcts/reform/idam/web/helper/MvcKeys.java," +
"**/uk/gov/hmcts/reform/idam/web/Application.java," +
"**/*Exception.java"
property "sonar.host.url", "https://sonar.reform.hmcts.net/"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco.xml"
}
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.idam.*']
threads = 10
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation = 'build/reports/pitest/fastermutationtestingoutput'
outputFormats = ['XML', 'HTML']
timestampedReports = true
mutationThreshold = 80
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
html.destination file("${buildDir}/reports/jacoco")
xml.destination file("${buildDir}/reports/jacoco.xml")
}
}
test.finalizedBy jacocoTestReport
bootRun {
systemProperties = System.properties
}