forked from hmcts/ccpay-service-request-cpo-update-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
242 lines (197 loc) · 7.78 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
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '2.4.3'
id 'org.owasp.dependencycheck' version '6.4.1.1'
id 'com.github.ben-manes.versions' version '0.39.0'
id 'org.sonarqube' version '3.3'
id 'uk.gov.hmcts.java' version '0.12.5'
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
allprojects {
sourceCompatibility = '11'
targetCompatibility = '11'
}
sourceSets {
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')
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
task functional(type: Test) {
description = "Runs functional tests"
group = "Verification"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task integration(type: Test) {
description = "Runs integration tests"
group = "Verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
failFast = true
}
task smoke(type: Test) {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
checkstyle {
maxWarnings = 0
toolVersion = '8.29'
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
pmd {
toolVersion = "6.39.0"
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")
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
def sonarExclusions = [
'**/config/**',
'CpoUpdateApplication.java'
]
sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.projectName", "Reform :: cpo-update-service"
property "sonar.projectKey", "uk.gov.hmcts.reform:cpo-update-service"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
property "sonar.host.url", "https://sonarcloud.io/"
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
property "sonar.dependencyCheck.reportPath", "${project.buildDir}/reports/dependency-check-report.xml"
property "sonar.exclusions", sonarExclusions.join(", ")
property "sonar.test.exclusions", sonarExclusions.join(", ")
property "sonar.coverage.exclusions", sonarExclusions.join(", ")
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}
// 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
}
}
apply from: "${rootDir}/cve-resolution-strategy.gradle"
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
ext {
reformLoggingVersion = "5.1.9"
}
dependencies {
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.boot', name: 'spring-boot-starter-json'
implementation group: 'org.springframework.retry', name: 'spring-retry', version: '1.3.1'
implementation group: 'org.springframework', name: 'spring-aspects', version: '5.3.12'
implementation group: 'org.hibernate', name: 'hibernate-validator', version: '7.0.1.Final'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.20'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.20'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '3.0.0'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: reformLoggingVersion
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: reformLoggingVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.14.1'
implementation group: 'com.azure', name: 'azure-core', version: '1.21.0'
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.4.2'
implementation group: 'com.microsoft.azure', name: 'azure-servicebus', version: '3.6.5'
implementation group: 'uk.gov.hmcts.reform.auth', name: 'auth-checker-lib', version: '2.1.4'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version:'0.9.1'
implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0'
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '3.3.0'
testImplementation(platform('org.junit:junit-bom:5.8.1'))
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
}
mainClassName = 'uk.gov.hmcts.reform.CpoUpdateApplication'
bootJar {
archiveFileName = "cpo-update-service.jar"
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
// Gradle 7.x issue, workaround from: https://github.com/gradle/gradle/issues/17236#issuecomment-894768083
rootProject.tasks.named("processSmokeTestResources") {
duplicatesStrategy = 'include'
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}