-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
284 lines (241 loc) · 7.69 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
plugins {
id 'java-library'
id 'checkstyle'
id 'idea'
id 'jacoco'
id 'pmd'
id "com.github.spotbugs" version "4.0.5"
id 'com.github.ben-manes.versions' version '0.28.0'
id 'de.aaschmid.cpd' version '3.1'
id 'nebula.lint' version '16.6.0'
id "com.moowork.node" version "1.2.0"
id "org.myire.quill.cobertura" version "2.3.1"
id "org.sonarqube" version "2.6.2"
id "org.owasp.dependencycheck" version "5.3.2.1"
}
ext {
log4jVersion = '2.13.1'
javaeeVersion = '8.0-4'
h2Version = '1.4.200'
jacksonVersion = '2.10.2'
jerseyVersion = '2.30.1'
hibernateVersion = '5.4.13.Final'
querydslVersion = "4.3.1"
fileuploadVersion = "1.4"
ownerVersion = '1.0.10'
hashidsVersion = '1.0.3'
esapiVersion = '2.2.0.0'
jjwtVersion = '0.9.1'
jschNioVersion = '1.0.14'
findbugsAnnotationsVersion = '3.0.1u2'
inferVersion = '0.17.2'
swaggerUiVersion = '3.25.0'
swaggerVersion = '1.5.16'
angularMaterialVersion = '1.1.3'
angularVersion = '1.6.1'
materialDesignIconsVersions = '2.2.0'
payaraVersion = '5.201'
checkstyleVersion = "7.8.1"
spotbugsVersion = "4.0.1"
pmdVersion = "6.22.0"
openejbVersion = '8.0.1'
junitVersion = '4.13'
jacocoVersion = "0.8.2"
mockitoVersion = '3.3.3'
hamcrestVersion = '2.0.0.0'
catchExceptionVersion = '1.4.6'
restAssuredVersion = '4.3.0'
jglueVersion = '4.1.0'
weldVersion = '2.4.8.Final'
}
defaultTasks 'build'
allprojects {
group = 'dk.kontentsu'
version = '1.0-SNAPSHOT'
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.encoding = 'UTF-8'
options.incremental = true
options.fork = true
}
apply plugin: 'nebula.lint'
gradleLint.rules = ['unused-dependency']
gradleLint.alwaysRun = false
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
tasks.withType(Exec) {
doFirst {
println commandLine
}
}
task spotbugs(
group: "Verification",
description: "Marker task to enabled Findbugs."
)
task pmd(
group: "Verification",
description: "Marker task to enabled PMD."
)
task checkstyle(
group: "Verification",
description: "Marker task to enabled Checkstyle."
)
repositories {
jcenter()
mavenCentral()
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'checkstyle'
apply plugin: 'com.github.spotbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'org.owasp.dependencycheck'
gradle.taskGraph.whenReady { taskGraph ->
tasks.spotbugsMain.onlyIf {
taskGraph.hasTask((tasks.spotbugs))
}
tasks.spotbugsTest.onlyIf {
taskGraph.hasTask((tasks.spotbugs))
}
}
gradle.taskGraph.whenReady { taskGraph ->
tasks.pmdMain.onlyIf {
taskGraph.hasTask((tasks.pmd))
}
tasks.pmdTest.onlyIf {
taskGraph.hasTask((tasks.pmd))
}
}
gradle.taskGraph.whenReady { taskGraph ->
tasks.checkstyleMain.onlyIf {
taskGraph.hasTask((tasks.checkstyle))
}
tasks.checkstyleTest.onlyIf {
taskGraph.hasTask((tasks.checkstyle))
}
}
checkstyle {
toolVersion = checkstyleVersion
ignoreFailures = true
sourceSets = [sourceSets.main]
configFile = file("$rootProject.projectDir/config/checkstyle/checkstyle.xml")
}
spotbugs {
toolVersion = spotbugsVersion
ignoreFailures = true
//onlyAnalyze = [sourceSets.main]
excludeFilter = file("$rootProject.projectDir/config/spotbugs/exclude.xml")
}
jacoco {
toolVersion = "$jacocoVersion"
}
pmd {
toolVersion = pmdVersion
sourceSets = [sourceSets.main]
ignoreFailures = true
ruleSetFiles = files("$rootProject.projectDir/config/pmd/ruleset.xml")
}
plugins.withType(JavaBasePlugin) {
check.dependsOn(rootProject.cpdCheck)
}
cpd {
toolVersion = pmdVersion
ignoreFailures = true
ignoreAnnotations = true
minimumTokenCount = 50
}
cpdCheck {
reports {
text.enabled = false
xml.enabled = true
}
source = sourceSets.main.allJava
}
test {
finalizedBy jacocoTestReport
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += output + main.output
srcDir file('src/it/java')
}
java.outputDir = file("$buildDir/classes/java/integration-test")
}
}
task integrationTest(type: Test) {
description = 'Run integration tests'
testClassesDirs = files(sourceSets.integrationTest.java.outputDir)
classpath = sourceSets.main.runtimeClasspath + sourceSets.integrationTest.runtimeClasspath
testReportDirName = 'integration-test'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
appendix = 'javadoc'
from(javadoc.destinationDir) {
into "META-INF/resources/webjars/${archiveBaseName}"
}
}
dependencies {
api 'org.apache.logging.log4j:log4j-api:' + log4jVersion
api 'com.google.code.findbugs:annotations:' + findbugsAnnotationsVersion
api 'com.facebook.infer.annotation:infer-annotation:' + inferVersion
testImplementation 'junit:junit:' + junitVersion
testImplementation 'org.apache.logging.log4j:log4j-core:' + log4jVersion
testImplementation 'eu.codearte.catch-exception:catch-exception:' + catchExceptionVersion
testImplementation 'org.mockito:mockito-core:' + mockitoVersion
testImplementation 'org.hamcrest:hamcrest-junit:' + hamcrestVersion
integrationTestImplementation 'junit:junit:' + junitVersion
integrationTestImplementation 'org.apache.logging.log4j:log4j-core:' + log4jVersion
integrationTestImplementation 'eu.codearte.catch-exception:catch-exception:' + catchExceptionVersion
integrationTestImplementation 'org.hamcrest:hamcrest-junit:' + hamcrestVersion
}
spotbugsMain {
reports {
xml.enabled = true
html.enabled = false
}
}
jacocoTestReport {
reports {
xml.enabled = true
csv.enabled = false
html.enabled = true
}
}
}
idea {
module {
downloadJavadoc = true
}
}
node {
version = '10.15.0'
npmVersion = '6.4.1'
nodeModulesDir = file("${project.projectDir}/client")
}
task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled true
xml.destination file("$buildDir/reports/jacoco/test/jacocoTestReport.xml")
html.enabled false
csv.enabled false
}
}
task testAngular(type: NpmTask) {
args = ['test', '--', '--watch=false', '--code-coverage', "--browsers ChromeHeadless"]
}
task lintAngular(type: NpmTask) {
args = [ 'run-script', 'lint', '--', '--single-run']
}
testAngular.dependsOn(npm_install)
lintAngular.dependsOn(npm_install)