-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
275 lines (224 loc) · 9.03 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
import org.flywaydb.gradle.task.FlywayMigrateTask
buildscript {
dependencies {
classpath("org.flywaydb:flyway-database-postgresql:11.1.0")
}
}
plugins {
id 'application'
id 'jacoco'
id 'checkstyle'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.springframework.boot' version '3.3.5'
id 'org.flywaydb.flyway' version '11.1.0'
id 'org.owasp.dependencycheck' version '11.1.1'
id 'org.sonarqube' version '6.0.1.5171'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
maven {
url = 'https://artifacts.camunda.com/artifactory/camunda-bpm-ee/'
credentials {
def userEnvVar = System.getenv('CAMUNDA_NEXUS_USER')
def passEnvVar = System.getenv('CAMUNDA_NEXUS_PASSWORD')
username userEnvVar == null ? "$CAMUNDA_NEXUS_USER" : userEnvVar
password passEnvVar == null ? "$CAMUNDA_NEXUS_PASSWORD" : passEnvVar
}
}
}
// before committing a change, make sure task still works
dependencyUpdates {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA', 'ee'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
rejectVersionIf { selection -> // <---- notice how the closure argument is named
return isNonStable(selection.candidate.version) && !isNonStable(selection.currentVersion)
}
}
checkstyle {
maxWarnings = 0
toolVersion = '10.21.0'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
// 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.assemblyEnabled = false
//CVE Scanning only relevant to production code that is published, not test or other implementations
scanConfigurations += 'releaseCompileClasspath'
}
sourceSets {
testUtils {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/testUtils/java')
}
resources.srcDir file('src/testUtils/resources')
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/smokeTest/java')
}
resources.srcDir file('src/smokeTest/resources')
}
functionalTest {
java {
compileClasspath += testUtils.output
runtimeClasspath += testUtils.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
integrationTest {
java {
compileClasspath += testUtils.output
runtimeClasspath += testUtils.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
}
task smoke(type: Test) {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
task functional(type: Test, description: 'Runs the 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
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
}
}
project.tasks['sonarqube'].dependsOn test, integration, jacocoTestReport
sonarqube {
properties {
property "sonar.projectName", "Reform :: camunda-bpm"
property "sonar.projectKey", "uk.gov.hmcts.reform:camunda-bpm"
property "sonar.coverage.exclusions", "**/config/**"
}
}
dependencyManagement {
dependencies {
imports {
// Before upgrading, please copy relevant migration scripts in src/main/resources/db/migration/ from https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/
mavenBom 'org.camunda.bpm:camunda-bom:7.21.0-ee'
}
}
}
dependencies {
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp-ee'
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest'
implementation 'org.camunda.spin:camunda-spin-dataformat-all'
implementation 'org.camunda.bpm:camunda-engine-plugin-spin'
implementation group: 'org.camunda.bpm', name: 'camunda-engine-spring-6'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation group: 'jakarta.servlet', name: 'jakarta.servlet-api'
implementation 'org.postgresql:postgresql:42.7.4'
implementation 'org.flywaydb:flyway-core:11.1.0'
// JAX-B dependencies for JDK 9+
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '4.0.5'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.7'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '5.3.0'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.4'
implementation group: 'io.github.openfeign', name: 'feign-jackson', version: '13.5'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.camunda.bpm.extension:camunda-bpm-assert:1.2'
testImplementation 'org.camunda.bpm.extension:camunda-bpm-assert-scenario:1.1.1'
testImplementation 'org.slf4j:jul-to-slf4j:2.0.16'
testImplementation 'org.testcontainers:postgresql:1.20.4'
testImplementation group: 'com.github.tomakehurst', name:'wiremock-standalone', version: '3.0.1'
testImplementation "org.junit.vintage:junit-vintage-engine"
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testUtilsImplementation sourceSets.main.runtimeClasspath
testUtilsImplementation sourceSets.test.runtimeClasspath
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
integrationTestImplementation "org.junit.vintage:junit-vintage-engine"
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
smokeTestImplementation group: 'io.rest-assured', name: 'rest-assured'
functionalTestImplementation group: 'io.rest-assured', name: 'rest-assured'
}
group = 'uk.gov.hmcts.reform'
version = '1.0-SNAPSHOT'
description = 'Camunda BPM Spring Boot Application'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
mainClassName = 'uk.gov.hmcts.reform.camunda.bpm.CamundaApplication'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
flyway {
url = System.getenv('FLYWAY_URL')
user = System.getenv('FLYWAY_USER')
password = System.getenv('FLYWAY_PASSWORD')
baselineOnMigrate = true
baselineVersion = '000'
}
tasks.withType(Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task migratePostgresDatabase(type: FlywayMigrateTask) {
baselineOnMigrate = true
if (project.hasProperty("dburl")) {
url = "jdbc:postgresql://${dburl}"
}
}
bootJar {
archiveFileName = "${archiveBaseName.get()}.${archiveExtension.get()}"
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
}
test {
reports {
junitXml.required = true
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}