-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
245 lines (201 loc) · 7.49 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
plugins {
id 'java'
id 'application'
id 'jacoco'
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.owasp.dependencycheck' version '11.1.1'
id 'org.sonarqube' version '6.0.1.5171'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '3.2.0'
id 'au.com.dius.pact' version '4.6.16'
}
group = 'uk.gov.hmcts.auth.provider.service'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
// https://github.com/gradle/gradle/issues/16791
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
dependencyManagement {
dependencies {
//CVE-2022-25857, CVE-2022-38749, CVE-2022-38750, CVE-2022-38751, CVE-2022-38752, CVE-2022-41854
dependencySet(group: 'org.yaml', version: '2.3') {
entry 'snakeyaml'
}
}
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
}
contractTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/contractTest/java')
}
resources.srcDir file('src/contractTest/resources')
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
// 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') == 'false' ? 11 : 0
suppressionFile = 'dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
skipConfigurations = [
"compileOnly",
"pmd",
"integrationTest",
"functionalTest",
"smokeTest",
"contractTestRuntimeClasspath",
"contractTestCompileClasspath"
]
}
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
selection.reject('Release candidate')
}
}
}
}
sonarqube {
properties {
property "sonar.projectName", "Reform :: Service Auth Provider"
property 'sonar.coverage.exclusions', "**/config/**"
}
}
def versions = [
pact_version: '4.6.16',
junit_jupiter: '5.11.4'
]
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'ch.qos.logback') {
details.useVersion '1.4.14'
}
}
}
}
ext {
log4JVersion = "2.22.0"
}
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-validation'
implementation group: 'com.google.guava', name: 'guava', version: '33.4.0-jre'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
implementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.7'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4JVersion
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
compileOnly group: 'net.sourceforge.findbugs', name: 'annotations', version: '1.3.2'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.24.2'
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
functionalTestImplementation group: 'com.typesafe', name: 'config', version: '1.4.3'
functionalTestImplementation group: 'io.rest-assured', name: 'rest-assured'
functionalTestImplementation group: 'junit', name: 'junit', version: '4.13.2'
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'junit5', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'spring6', version: versions.pact_version
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
contractTestImplementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit_jupiter
contractTestRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit_jupiter
contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit_jupiter
contractTestRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.11.4'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test'){
exclude(module: 'commons-logging')
}
}
mainClassName = 'uk.gov.hmcts.auth.provider.service.api.ServiceAuthProviderApplication'
installDist {
applicationDefaultJvmArgs = ["-Djava.security.egd=file:/dev/./urandom"]
}
run {
applicationDefaultJvmArgs = ["-Djava.security.egd=file:/dev/./urandom"]
}
bootJar {
archiveFileName = 'service-auth-provider.jar'
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
task printVersion {
doLast {
print project.version
}
}
compileFunctionalTestJava {
options.compilerArgs << "-Xlint:unchecked"
}
task functional(type: Test, group: 'Verification') {
description = "Runs Functional Tests"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task smoke(type: Test, group: 'Verification') {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task contractTest(type: Test) {
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}
task runProviderPactVerification(type: Test) {
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}
runProviderPactVerification.dependsOn contractTest
runProviderPactVerification.finalizedBy pactVerify
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
html.required = true
}
}
tasks.named('sonarqube') {
dependsOn jacocoTestReport
}
tasks.named('sonar') {
dependsOn jacocoTestReport
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}