-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
218 lines (199 loc) · 8.05 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
import groovy.json.JsonSlurper
import org.veo.SpockBlockFormatterStep
plugins {
id 'org.springframework.boot' version '3.4.0' apply false
id 'io.spring.dependency-management' version '1.1.7' apply false
id "com.github.spotbugs" version '6.0.26'
id "com.diffplug.spotless" version "6.25.0" apply false
id "io.freefair.lombok" version "8.11"
}
def continuousIntegrationBuild = rootProject.hasProperty('ci')
allprojects {
group = 'org.veo'
version = '0.54.0'
apply plugin: "com.diffplug.spotless"
repositories {
mavenCentral()
}
spotless {
groovyGradle {
greclipse()
replaceRegex('Excessive line breaks', /\n{3,}/, '\n\n')
indentWithSpaces(4)
trimTrailingWhitespace()
}
java {
target 'src/**/*.java', 'buildSrc/**/*.java'
googleJavaFormat()
importOrder('java', 'jakarta', 'javax', 'org', 'com', 'org.veo', '')
addStep org.veo.LicenseHeaderStep.create(project.rootDir)
addStep org.veo.NoWildcardImportsStep.create()
removeUnusedImports()
trimTrailingWhitespace()
replaceRegex('Consecutive empty block comment lines', /( *\*\n){2,}/, '*\n')
replaceRegex('Empty line at block comment end', / \*\n *\*\//, ' */')
replaceRegex('Empty comment block', /\/\*+\s+\*\//, '')
replaceRegex('Empty line after annotation', /(^ +@[a-zA-Z0-9]+\([^)]+\)\n)\n+/, '$1')
replaceRegex('Empty line inside annotation', /(^ +@[a-zA-Z0-9]+\([^)]+\n)\n+/, '$1')
replaceRegex('Default value for Schema#required()', /((?<=@Schema\([^)]{1,500}), required = false)|((?<=@Schema\()required = false(, )?)/, '')
}
groovy {
target 'src/**/*.groovy', 'buildSrc/**/*.groovy'
addStep org.veo.LicenseHeaderStep.create(project.rootDir)
addStep org.veo.NoWildcardImportsStep.create()
addStep SpockBlockFormatterStep.create()
greclipse()
importOrder('java', 'javax', 'org', 'com', 'org.veo', '')
indentWithSpaces(4)
trimTrailingWhitespace()
replaceRegex('Excessive line breaks', /\n{3,}/, '\n\n')
replaceRegex('Extra space around equals sign', /( += )|( = +)/, ' = ')
replaceRegex('Not one space between right round and left curly bracket', /\) *\{/, ') {')
}
format 'xml', {
target 'src/**/*.xml', 'misc/eclipse/java-format.xml'
eclipseWtp('xml')
}
format 'git', {
target '**/.gitignore'
trimTrailingWhitespace()
endWithNewline()
}
format 'markdown', {
target '**/*.md'
targetExclude '**/bin/**', '**/target/**'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
json {
target '**/*.json'
targetExclude '**/bin/**', '**/target/**'
gson()
.indentWithSpaces(2)
endWithNewline()
}
yaml {
target '.gitlab-ci.yml'
trimTrailingWhitespace()
endWithNewline()
}
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.github.spotbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'io.freefair.lombok'
dependencyManagement {
imports {
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
}
}
dependencyManagement {
dependencies {
dependency 'io.hypersistence:hypersistence-utils-hibernate-62:3.9.0'
dependency 'io.jsonwebtoken:jjwt-api:0.12.6'
dependency 'io.jsonwebtoken:jjwt-impl:0.12.6'
dependency 'io.jsonwebtoken:jjwt-jackson:0.12.6'
// pull in fix for https://github.com/spockframework/spock/issues/1539
dependency "org.spockframework:spock-core:2.4-M4-groovy-4.0"
dependency "org.spockframework:spock-spring:2.4-M4-groovy-4.0"
dependency 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'
dependency 'org.springdoc:springdoc-openapi-starter-common:2.7.0'
dependency 'io.swagger.core.v3:swagger-core-jakarta:2.2.27'
dependency 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.27'
dependency 'net.ttddyy:datasource-proxy:1.10.1'
dependency 'com.github.victools:jsonschema-generator:4.37.0'
dependency 'com.github.victools:jsonschema-module-jackson:4.37.0'
dependency 'com.github.victools:jsonschema-module-jakarta-validation:4.37.0'
dependency 'com.github.victools:jsonschema-module-swagger-2:4.37.0'
dependency 'com.networknt:json-schema-validator:1.5.4'
dependency "org.testcontainers:spock:1.20.4"
dependency "org.testcontainers:postgresql:1.20.4"
dependency "org.keycloak:keycloak-authz-client:26.0.3"
dependency 'com.fasterxml.uuid:java-uuid-generator:5.1.0'
dependency 'com.github.zafarkhaja:java-semver:0.10.2'
dependency 'org.apache.commons:commons-collections4:4.4'
dependency 'org.jgrapht:jgrapht-core:1.5.2'
dependency 'org.jgrapht:jgrapht-io:1.5.2'
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
repositories {
maven { url 'https://jitpack.io' }
}
testing {
suites {
configureEach {
useSpock('2.4-M4-groovy-4.0')
targets {
all {
testTask.configure {
maxHeapSize = '1g'
systemProperties project.properties.subMap([
"http.proxyHost",
"http.proxyPort",
"https.proxyHost",
"https.proxyPort"
])
systemProperty 'user.language', 'en'
systemProperty 'user.country', 'US'
}
}
}
}
}
}
pmd {
toolVersion = '7.8.0'
ruleSetConfig = rootProject.resources.text.fromFile('misc/pmd/rules.xml')
ruleSets = []
rulesMinimumPriority = 3
consoleOutput = true
sourceSets = project.sourceSets.matching {it.name != 'test'}
}
spotbugs.excludeFilter = rootProject.file('misc/spotbugs/exclude.xml')
spotbugsTest.enabled = false
// write human readable report on normal builds
spotbugsMain.reports {
// Jenkins needs xml reports to detect and display bugs.
xml.enabled = continuousIntegrationBuild
html.enabled = !continuousIntegrationBuild
}
// specific "continuous integration" settings needed by Jenkins
if (continuousIntegrationBuild) {
tasks.withType(Test) {
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
}
}
}
dependencies {
compileOnly 'org.slf4j:slf4j-api'
runtimeOnly 'ch.qos.logback:logback-classic'
runtimeOnly 'ch.qos.logback.contrib:logback-json-classic:0.1.5'
runtimeOnly 'ch.qos.logback.contrib:logback-jackson:0.1.5'
spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0@jar"
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
}
tasks.withType(JavaCompile) {
configure(options){
debugOptions.debugLevel = "source,lines,vars"
// See https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9
// for a detailed list of linting keys.
compilerArgs.addAll([
'-Xlint:all',
'-Xlint:-serial'
])
}
}
}