-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
313 lines (263 loc) · 7.98 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
buildscript {
repositories {
maven { url mavenRepo }
if (!project.hasProperty('compileOnly')) {
maven { url 'https://plugins.gradle.org/m2/' }
}
}
if (!project.hasProperty('compileOnly')) {
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.2'
}
}
}
plugins {
id 'com.github.ben-manes.versions' version '0.20.0'
}
allprojects {
repositories {
maven { url mavenRepo }
}
}
import org.gradle.api.logging.StandardOutputListener
apply plugin: 'eclipse'
apply plugin: 'idea'
subprojects {
apply plugin: 'java'
apply plugin: 'distribution'
configurations {
awaitility
commonsBeanutils {
exclude module: 'commons-collections'
}
commonsCodec
commonsCollections
commonsIo
commonsLang
evoInflector
httpclient
httpmime
jacksonCore
jacksonDatabind
jacksonDatabindXml
json
semVer
validation
xmlunit
yaml
testCompile.extendsFrom awaitility, junit, mockito, xmlunit
}
dependencies {
awaitility "org.awaitility:awaitility:$awaitilityVersion"
commonsBeanutils "commons-beanutils:commons-beanutils:$commonsBeanutilsVersion"
commonsCodec "commons-codec:commons-codec:$commonsCodecVersion"
commonsCollections "org.apache.commons:commons-collections4:$commonsCollectionsVersion"
commonsIo "commons-io:commons-io:$commonsIoVersion"
commonsLang "org.apache.commons:commons-lang3:$commonsLangVersion"
evoInflector "org.atteo:evo-inflector:$evoInflectorVersion"
httpclient "org.apache.httpcomponents:httpclient:$httpclientVersion"
httpmime "org.apache.httpcomponents:httpmime:$httpmimeVersion"
jacksonCore "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
jacksonDatabind "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
jacksonDatabindXml "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
json "org.json:json:$jsonVersion"
junit "junit:junit:$junitVersion"
mockito "org.mockito:mockito-core:$mockitoVersion"
semVer "com.github.zafarkhaja:java-semver:$semVerVersion"
validation "javax.validation:validation-api:$validationVersion"
xmlunit "org.xmlunit:xmlunit-core:$xmlunitVersion"
yaml "org.yaml:snakeyaml:$snakeYamlVersion"
compile 'com.google.code.findbugs:jsr305:3.0.2'
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all' << '-Xlint:-processing' << '-Xlint:-serial' << '-Werror'
}
javadoc {
def events = []
StandardOutputListener listener = { event -> events << event }
doFirst {
logging.addStandardOutputListener(listener)
}
doLast {
logging.removeStandardOutputListener(listener)
if (events.find { it.toString() =~ /warning/ }) {
throw new GradleException('Warnings in Javadoc, see output above')
}
}
}
// Need all test info on command-line for TravisCI
test {
testLogging {
events 'failed'
showStandardStreams = true
showStackTraces = true
exceptionFormat 'full'
}
outputs.upToDateWhen { false } // Always run tests so that we have a test report on each build
}
if (!project.hasProperty('compileOnly')) {
apply plugin: 'checkstyle'
checkstyle {
configFile = rootProject.file('config/checkstyle.xml')
toolVersion = '8.10'
ignoreFailures = false
}
// Despite ignoreFailures=false, the build won't by default fail on CheckStyle warnings
// https://issues.gradle.org/browse/GRADLE-2888
tasks.withType(Checkstyle).each { checkstyleTask ->
checkstyleTask.doLast {
reports.all { report ->
def outputFile = report.destination
if (outputFile.exists() && outputFile.text.contains('<error ')) {
throw new GradleException("Found checkstyle issues in $outputFile")
}
}
}
}
apply plugin: 'pmd'
pmd {
ruleSets = []
ruleSetFiles = rootProject.files('config/pmd.xml')
toolVersion = '6.3.0'
ignoreFailures = false
}
apply plugin: 'com.github.spotbugs'
dependencies {
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.7.1',
'com.mebigfatguy.fb-contrib:fb-contrib:7.4.2'
}
spotbugs {
reportLevel = 'low'
toolVersion = '3.1.3'
ignoreFailures = false
effort = 'max'
excludeFilter = rootProject.file('config/spotbugs_filter.xml')
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
html {
enabled = true
}
xml {
withMessages = true
enabled = !html.enabled
}
}
}
apply from: rootProject.file('jdepend.gradle')
apply from: rootProject.file('coverage.gradle')
apply plugin: 'eclipse'
eclipse.classpath {
defaultOutputDir = file('classes')
file.whenMerged { classpath ->
classpath.entries.removeAll { it.kind == 'lib' && it.path.contains("/$buildDir.name/") }
}
}
apply plugin: 'idea'
}
distributions {
main {
contents {
from(jar) {
into 'libs'
}
from(configurations.runtime) {
into 'libs'
}
}
}
}
}
if (!project.hasProperty('compileOnly')) {
apply plugin: 'codenarc'
codenarc { toolVersion = '1.1' }
task codenarc(type: CodeNarc) {
mustRunAfter 'clean'
configFile = file('config/codenarc.groovy')
reports {
html {
destination = rootProject.file('build/reports/codenarc.html')
enabled = true
}
xml {
destination = rootProject.file('build/results/codenarc.xml')
enabled = true
}
}
source = fileTree(rootDir) {
include '**/*.gradle'
include '**/*.groovy'
exclude '**/build/**/*.gradle'
exclude '**/build/**/*.groovy'
}
}
}
project(':infoarchive-configuration') {
configurations {
compile.extendsFrom commonsIo, evoInflector, json
}
}
project(':infoarchive-yaml') {
configurations {
compile.extendsFrom commonsIo, commonsLang, evoInflector, yaml
}
dependencies {
compile project(':infoarchive-configuration')
}
}
project(':infoarchive-sdk-core') {
configurations {
compile.extendsFrom commonsBeanutils, commonsCollections, commonsCodec, commonsIo, commonsLang, evoInflector,
httpclient, httpmime, jacksonCore, jacksonDatabind, semVer, validation, yaml
}
dependencies {
compile project(':infoarchive-yaml')
testCompile project(':infoarchive-yaml').sourceSets.test.output
}
javadoc {
def overview = file('src/javadoc/overview.html')
title = "InfoArchive SIP SDK $version"
options.overview = overview
inputs.file overview
}
}
project(':infoarchive-sdk-stringtemplate') {
configurations {
stringtemplate
compile.extendsFrom stringtemplate
}
dependencies {
stringtemplate "org.antlr:ST4:$stringTemplateVersion"
compile project(':infoarchive-sdk-core')
testCompile project(':infoarchive-yaml').sourceSets.test.output
}
}
project(':infoarchive-sdk-velocity') {
configurations {
velocity
compile.extendsFrom commonsCollections, velocity
}
dependencies {
velocity "org.apache.velocity:velocity-engine-core:$velocityVersion"
compile project(':infoarchive-sdk-core')
testCompile project(':infoarchive-yaml').sourceSets.test.output
}
}
defaultTasks 'build'
if (!project.hasProperty('compileOnly')) {
apply from: rootProject.file('publish.gradle')
// [sonarToken] is encrypted in .travis.yml, so only available when building in Travis
if (project.hasProperty('sonarToken')) {
System.setProperty('sonar.login', sonarToken)
apply plugin: 'org.sonarqube'
subprojects.findAll {
it.name.startsWith('sample')
}.each {
it.sonarqube.skipProject = true
}
check.dependsOn 'sonarqube'
}
check.dependsOn tasks.codenarc
}