This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.gradle
314 lines (272 loc) · 10 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
/*
* Copyright (c) 2020 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.github.spotbugs.snom.SpotBugsReport
buildscript {
ext {
versions = [
ant: '1.10.13', // org.apache.ant:ant-junit
awsSdkVersion: '1.12.454', // com.amazonaws:aws-java-sdk-core
awsEncryptionSdk: '2.4.0', // com.amazonaws:aws-encryption-sdk-java
backstopper: '0.15.0', // com.nike.backstopper:backstopper-spring-web-mvc
c3p0: '0.9.5.5', // com.mchange:c3p0
caffeine: '3.1.6', // com.github.ben-manes.caffeine:caffeine
commonsIo: '2.11.0', // commons-io:commons-io
commonsText: '1.10.0', // org.apache.commons:commons-text
dependencyCheckGradle: '8.2.1', // org.owasp:dependency-check-gradle
findbugsAnnotations: '3.0.1u2', // com.google.code.findbugs:annotations
findSecBugs: '1.12.0', // com.h3xstream.findsecbugs:findsecbugs-plugin
flyway: '5.2.4', // org.flywaydb:flyway-core
groovy: '4.0.11', // org.apache.groovy:groovy-all
gson: '2.10.1', // com.google.code.gson:gson
guava: '31.1-jre', // com.google.guava:guava
hibernationValidation: '7.0.5.Final', // org.hibernate:hibernate-validator // TODO
jacksonAnnotations: '2.14.1', // com.fasterxml.jackson.core:jackson-annotations
jakartaValidationApi: '2.0.2', // jakarta.validation:jakarta.validation-api
jakartaXmlBindApi: '4.0.0', // jakarta.xml.bind:jakarta.xml.bind-api
javaxEl: '3.0.0', // org.glassfish:javax.el
jaxbRuntime: '4.0.2', // org.glassfish.jaxb:jaxb-runtime
jjwt: '0.11.5', // io.jsonwebtoken:jjwt-api
jupiterApi: '5.9.2', // org.junit.jupiter:junit-jupiter-api
kork: '7.172.0', // io.spinnaker.kork:kork-secrets
kotlinStdlib: '1.8.20', // org.jetbrains.kotlin:kotlin-stdlib-common
lang3: '3.12.0', // org.apache.commons:commons-lang3
logback: '1.4.7', // ch.qos.logback:logback-core
lombok: '1.18.26', // org.projectlombok:lombok
metricsCore: '4.2.18', // io.dropwizard.metrics:metrics-core
mockitoAll: '1.10.19', // org.mockito:mockito-all
mybatis: '3.5.13', // org.mybatis:mybatis
mybatisSpring: '2.1.0', // org.mybatis:mybatis-spring
mysqlConnector: '8.0.33', // com.mysql:mysql-connector-j
okhttp: '4.11.0', // com.squareup.okhttp3:okhttp
okta: '8.2.3', // com.okta.sdk:okta-sdk-api
oktaAuthnSdk: '2.0.10', // com.okta.authn.sdk:okta-authn-sdk-api
oktaJwtVerifier: '0.5.7', // com.okta.jwt:okta-jwt-verifier
openPojo: '0.9.1', // com.openpojo:openpojo
resilience4j: '1.7.1', // 2 requires java 17 // io.github.resilience4j:resilience4j-all
restAssured: '5.3.0', // io.rest-assured:rest-assured-all
slf4j: '2.0.7', // org.slf4j:slf4j-api
spockCore: '2.3-groovy-4.0', // org.spockframework:spock-core
springBoot: '2.7.11', // org.springframework.boot:spring-boot-dependencies
tikaCore: '2.7.0', // org.apache.tika:tika-core
wingtipsSpringBoot: '0.24.2', // com.nike.wingtips:wingtips-spring-boot
]
}
repositories {
maven {
url "https://repo.maven.apache.org/maven2"
}
maven {
url "https://plugins.gradle.org/m2/"
}
google()
}
dependencies {
classpath "org.owasp:dependency-check-gradle:${versions.dependencyCheckGradle}"
}
}
plugins {
id "io.spring.dependency-management" version "1.1.0"
id "com.github.nbaztec.coveralls-jacoco" version "1.2.15"
id "com.github.spotbugs" version "5.0.13"
id "com.diffplug.spotless" version "6.14.1"
}
apply from: 'gradle/owasp-dependency-check.gradle'
allprojects {
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'com.github.spotbugs'
apply plugin: 'com.diffplug.spotless'
spotless {
java {
googleJavaFormat()
}
}
dependencies {
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:${versions.findSecBugs}"
}
spotbugs {
toolVersion = '4.2.0'
excludeFilter = file("${rootProject.projectDir}/findbugs-supressions.xml")
}
spotbugsMain {
reports(({
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
xml {
enabled = false
}
} as Closure<NamedDomainObjectContainer<? extends SpotBugsReport>>))
}
spotbugsTest {
reports(({
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/test/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
xml {
enabled = false
}
} as Closure<NamedDomainObjectContainer<? extends SpotBugsReport>>))
}
repositories {
mavenCentral()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
jacoco {
toolVersion = "0.8.5"
}
}
subprojects {
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = '11'
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/groovy')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestCompile.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}
//noinspection GroovyAssignabilityCheck
task integrationTest(type: Test) {
description = 'Runs the integration tests.'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:${versions.springBoot}")
}
}
dependencies {
// Lombok
compileOnly "org.projectlombok:lombok:${versions.lombok}"
annotationProcessor "org.projectlombok:lombok:${versions.lombok}"
// common test deps
testImplementation "org.apache.groovy:groovy-all:${versions.groovy}"
testImplementation "org.spockframework:spock-core:${versions.spockCore}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.jupiterApi}"
testImplementation "org.mockito:mockito-all:${versions.mockitoAll}"
testImplementation "com.openpojo:openpojo:${versions.openPojo}"
}
test {
testLogging {
events "passed", "skipped", "failed"
}
}
integrationTest {
testLogging {
showStandardStreams = true
}
}
}
List<String> blackList = [
'cerberus-api-tests'
]
def publishedProjects = subprojects.findAll { !blackList.contains(it.path) }
task jacocoMerge(type: JacocoMerge) {
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
task aggregatedJacocoReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn publishedProjects.test, jacocoMerge
additionalSourceDirs.from = files(publishedProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(publishedProjects.sourceSets.main.output)
executionData jacocoMerge.destinationFile
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}
coverallsJacoco {
reportSourceSets = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
reportPath = "${buildDir}/reports/jacoco/aggregatedJacocoReport/aggregatedJacocoReport.xml"
}
configurations {
antJUnit
}
dependencies {
antJUnit "org.apache.ant:ant-junit:${versions.ant}"
runtimeOnly "org.apache.ant:ant-antlr:${versions.ant}"
}
// Compile all the test results into a single one.
task aggregatedJunitXml {
ant.taskdef(name: 'junitreport', classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator', classpath: configurations.antJUnit.asPath)
dependsOn subprojects*.test
doFirst {
///reports/jacoco/test/jacocoTestReport.xml
mkdir "$buildDir/reports/jacoco/test"
ant.junitreport(todir: "$buildDir/reports/jacoco") {
subprojects.each {
if (it.testResultsDir.exists()) {
fileset(dir: it.testResultsDir)
}
}
}
}
}
task aggregatedJunitHtml(type: TestReport) {
dependsOn subprojects*.test
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all sub projects
reportOn subprojects*.test
}
task generateAggregatedReports(dependsOn: [
aggregatedJunitXml,
aggregatedJunitHtml,
aggregatedJacocoReport,
dependencyCheckAggregate
]) {
doLast {
println "Finished generating aggregated reports"
}
}
task aggregatedTest {
dependsOn subprojects*.test
}
task aggregatedCheck {
dependsOn subprojects*.check
}
task aggregatedClean {
dependsOn subprojects*.clean
}
defaultTasks ':cerberus-web:bootRun'