-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
293 lines (245 loc) · 7.93 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
import com.github.spotbugs.SpotBugsTask
import org.springframework.boot.gradle.plugin.SpringBootPlugin
plugins {
// SonarQube
id 'org.sonarqube' version '2.6.2'
// Spring Boot and dependency management
id 'org.springframework.boot' version '2.1.3.RELEASE' apply false
// SpotBugs
id 'com.github.spotbugs' version '1.6.4'
}
description = 'Anti-virus and file network service'
allprojects {
apply plugin: 'checkstyle'
apply plugin: 'com.github.spotbugs'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'pmd'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
version = '0.11-SNAPSHOT'
ext {
taskGroupName = 'AV-service'
// Log4j version
log4jVersion = '2.10.0'
// Logstash Logback encoder version
logstashLogbackVersion = '5.2'
// Spock version
spockVersion = '1.2-groovy-2.4'
// Cglib nodep version
cglibVersion = '3.2.7'
// Equals verifier version
equalsVerifierVersion = '2.5.2'
}
repositories {
mavenCentral()
// // Spring snapshots
// maven {
// url "http://repo.spring.io/snapshot"
// }
// // Spring milestones
// maven {
// url "http://repo.spring.io/milestone"
// }
// // Spring libs milestones
// maven {
// url "http://repo.spring.io/libs-milestone"
// }
}
sourceSets {
// integration tests
integrationTest {
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/groovy')
}
resources.srcDir file('src/integration-test/resources')
}
// performance tests
performanceTest {
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/performance-test/groovy')
}
resources.srcDir file('src/performance-test/resources')
}
}
configurations {
// IT
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
// PT
performanceTestCompile.extendsFrom testCompile
performanceTestRuntime.extendsFrom testRuntime
}
idea {
module {
// add integration test source dirs to IDEA
testSourceDirs += file('src/integration-test/groovy')
scopes.TEST.plus += [configurations.integrationTestCompile]
}
}
dependencyManagement {
imports {
mavenBom(SpringBootPlugin.BOM_COORDINATES)
}
}
dependencies {
//
// Logging
//
// Log4j API
implementation('org.apache.logging.log4j:log4j-api')
// Log4j to SLF4J
implementation("org.apache.logging.log4j:log4j-to-slf4j:${log4jVersion}")
// JCL to SLF4J & Logback
implementation('org.springframework.boot:spring-boot-starter-logging')
// Logstash encoder
implementation("net.logstash.logback:logstash-logback-encoder:${logstashLogbackVersion}")
//
// Spring
//
// AMQP
compile('org.springframework.boot:spring-boot-starter-amqp')
// JMS
compile('org.springframework.boot:spring-boot-starter-activemq')
// Kafka
compile('org.springframework.kafka:spring-kafka')
// Data JPA & Hibernate
compile('org.springframework.boot:spring-boot-starter-data-jpa')
// Data Solr
compile('org.springframework.boot:spring-boot-starter-data-solr')
// MVC & Security
// Moved to REST module
// Ehcache
compile('org.ehcache:ehcache')
// Joda time (for Spring Solr)
runtime('joda-time:joda-time')
// PostgreSQL
runtime('org.postgresql:postgresql')
// H2 DB
runtime('com.h2database:h2')
// Lombok
compileOnly('org.projectlombok:lombok')
annotationProcessor('org.projectlombok:lombok')
// Development tools
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor')
compile('org.springframework.boot:spring-boot-devtools')
//
// Testing
//
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude module: 'assertj-core'
exclude module: 'jsonassert'
exclude module: 'json-path'
}
// Spock
testCompile("org.spockframework:spock-core:${spockVersion}")
testCompile("org.spockframework:spock-spring:${spockVersion}")
// Cglib
testCompile("cglib:cglib-nodep:${cglibVersion}")
// Objenesis
testCompile('org.objenesis:objenesis')
// Equals verifier
testCompile("nl.jqno.equalsverifier:equalsverifier:${equalsVerifierVersion}")
}
jar {
baseName = "avservice-${project.name}"
}
test {
maxParallelForks = 2
minHeapSize = '256m'
maxHeapSize = '256m'
testLogging {
exceptionFormat = 'full'
}
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
mustRunAfter test
systemProperty('itest', 'true')
minHeapSize = '512m'
maxHeapSize = '512m'
testLogging {
// show events - "PASSED", "STARTED", "FAILED", "SKIPPED"
// events "PASSED", "FAILED"
exceptionFormat = 'full'
}
}
task performanceTest(type: Test) {
testClassesDirs = sourceSets.performanceTest.output.classesDirs
classpath = sourceSets.performanceTest.runtimeClasspath
}
//
// Quality tool configurations
//
checkstyle {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
reportsDir = file("${project.rootDir}/reports/checkstyle/${project.name}")
sourceSets = [sourceSets.main]
ignoreFailures = true
}
spotbugs {
reportsDir = file("${project.rootDir}/reports/spotbugsReports/${project.name}")
sourceSets = [sourceSets.main]
effort = 'max'
reportLevel = 'high'
ignoreFailures = false
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
pmd {
reportsDir = file("${project.rootDir}/reports/pmd/${project.name}")
sourceSets = [sourceSets.main]
ignoreFailures = true
}
jacoco {
reportsDir = file("${project.rootDir}/reports/jacoco/${project.name}")
}
jacocoTestReport {
executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')
reports {
xml.enabled = true
html.enabled = true
}
}
sonarqube {
properties {
property 'sonar.jacoco.reportPath', "${buildDir}/jacoco/test.exec"
property 'sonar.jacoco.itReportPath', "${buildDir}/jacoco/integrationTest.exec"
}
}
// set reporting HTML output directory
tasks.withType(Test) {
reports.html.destination = file("${project.rootDir}/reports/test/${project.name}")
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
clean {
delete "${project.rootDir}/reports/"
}
task copyToLib(type: Copy) {
from(configurations.runtime) {
}
into "$buildDir/libs"
}
build.dependsOn copyToLib
check.dependsOn integrationTest
check.dependsOn jacocoTestReport
check.dependsOn javadoc
}
wrapper() {
gradleVersion = '5.5'
distributionType = Wrapper.DistributionType.ALL
}