forked from spring-projects/spring-amqp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
489 lines (401 loc) · 13 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
buildscript {
repositories {
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
}
}
plugins {
id "org.sonarqube" version '2.5'
}
description = 'Spring AMQP'
apply plugin: 'base'
apply plugin: 'project-report'
apply plugin: 'idea'
def docsDir = 'src/reference/asciidoc' // Will be default with newer asciidoctor plugin
ext {
isTravisBuild = System.getenv().get("TRAVIS") == 'true'
linkHomepage = 'https://projects.spring.io/spring-amqp'
linkCi = 'https://build.spring.io/browse/AMQP'
linkIssue = 'https://jira.spring.io/browse/AMQP'
linkScmUrl = 'https://github.com/spring-projects/spring-amqp'
linkScmConnection = 'git://github.com/spring-projects/spring-amqp.git'
linkScmDevConnection = '[email protected]:spring-projects/spring-amqp.git'
}
allprojects {
group = 'org.springframework.amqp'
repositories {
if (version.endsWith('BUILD-SNAPSHOT')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
maven { url 'https://repo.spring.io/libs-release' }
// maven { url 'https://repo.spring.io/libs-staging-local' }
}
apply plugin: 'javadocHotfix'
}
ext {
expandPlaceholders = '**/quick-tour.xml'
javadocLinks = [
"http://docs.oracle.com/javase/8/docs/api/",
"http://docs.oracle.com/javaee/7/api/",
"http://docs.spring.io/spring/docs/current/javadoc-api/"
] as String[]
}
subprojects { subproject ->
apply plugin: 'java'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
repositories {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:$platformVersion"
}
}
}
}
sourceCompatibility=1.8
targetCompatibility=1.8
ext {
hamcrestVersion = '1.3'
jackson2Version = '2.9.1'
junitVersion = '4.12'
log4jVersion = '2.8.2'
logbackVersion = '1.2.3'
mockitoVersion = '2.9.0'
rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.0.0'
rabbitmqHttpClientVersion = '1.3.0.RELEASE'
slf4jVersion = "1.7.25"
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.0.0.RELEASE'
springRetryVersion = '1.2.0.RELEASE'
}
eclipse {
project {
natures += 'org.springframework.ide.eclipse.core.springnature'
}
}
jacoco {
toolVersion = '0.7.9'
}
// dependencies that are common across all java projects
dependencies {
testCompile ("junit:junit:$junitVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testCompile "org.apache.logging.log4j:log4j-core:$log4jVersion"
testCompile "org.hamcrest:hamcrest-all:$hamcrestVersion"
testCompile ("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testCompile "org.springframework:spring-test:$springVersion"
testCompile "org.slf4j:slf4j-log4j12:$slf4jVersion" // amqp-client now uses SLF4J
testRuntime "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
}
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all,-options,-processing'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg]
task checkTestConfigs {
doLast {
def configFiles = []
sourceSets.test.allSource.srcDirs.each {
fileTree(it).include('**/*.xml').exclude('**/log4j.xml').each { configFile ->
def configXml = new XmlParser(false, false).parse(configFile)
if (configXml.@'xsi:schemaLocation' ==~ /.*spring-[a-z-]*\d\.\d\.xsd.*/) {
configFiles << configFile
}
}
}
if (configFiles) {
throw new InvalidUserDataException('Hardcoded XSD version in the config files:\n' +
configFiles.collect {relativePath(it)}.join('\n') +
'\nPlease, use versionless schemaLocations for Spring XSDs to avoid issues with builds on different versions of dependencies.')
}
}
}
test {
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
}
if (isTravisBuild) {
// restrict memory usage, so tests don't fail with exit code 137 on travis
maxHeapSize = '256m'
}
}
task testAll(type: Test, dependsOn: check)
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(testAll)) {
test.enabled = false
}
}
tasks.withType(Test).all {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
dependsOn checkTestConfigs
if (name ==~ /(springIo.*)|(testAll)/) {
systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true'
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
checkstyle {
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
toolVersion = "8.1"
}
artifacts {
archives sourcesJar
archives javadocJar
}
jar {
manifest {
attributes(
'Implementation-Version': version,
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})",
'Implementation-Title': subproject.name,
'Implementation-Vendor-Id': subproject.group,
'Implementation-Vendor': 'Pivotal Software, Inc.',
'Implementation-URL': linkHomepage,
'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw
)
}
}
check.dependsOn javadoc
build.dependsOn jacocoTestReport
}
project('spring-amqp') {
description = 'Spring AMQP Core'
dependencies {
compile "org.springframework:spring-core:$springVersion"
compile ("org.springframework:spring-messaging:$springVersion", optional)
compile ("org.springframework:spring-oxm:$springVersion", optional)
compile ("org.springframework:spring-context:$springVersion", optional)
compile ("com.fasterxml.jackson.core:jackson-core:$jackson2Version", optional)
compile ("com.fasterxml.jackson.core:jackson-databind:$jackson2Version", optional)
}
}
project('spring-rabbit') {
description = 'Spring RabbitMQ Support'
dependencies {
compile project(":spring-amqp")
compile "com.rabbitmq:amqp-client:$rabbitmqVersion"
compile ("com.rabbitmq:http-client:$rabbitmqHttpClientVersion") {
exclude group: 'org.springframework', module: 'spring-web'
}
compile ("org.springframework:spring-aop:$springVersion", optional)
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-messaging:$springVersion"
compile "org.springframework:spring-tx:$springVersion"
compile "org.springframework:spring-web:$springVersion"
compile "org.springframework.retry:spring-retry:$springRetryVersion"
compile ("ch.qos.logback:logback-classic:$logbackVersion", optional)
compile ("org.apache.logging.log4j:log4j-core:$log4jVersion", optional)
testCompile project(":spring-rabbit-junit")
}
}
project('spring-rabbit-junit') {
description = 'Spring Rabbit JUnit Support'
dependencies { // no spring-amqp dependencies allowed
compile "org.springframework:spring-core:$springVersion"
compile "junit:junit:$junitVersion"
compile "com.rabbitmq:amqp-client:$rabbitmqVersion"
compile ("com.rabbitmq:http-client:$rabbitmqHttpClientVersion") {
exclude group: 'org.springframework', module: 'spring-web'
}
compile "org.springframework:spring-web:$springVersion"
}
}
project('spring-rabbit-test') {
description = 'Spring Rabbit Test Support'
dependencies {
compile project(":spring-rabbit")
compile ("junit:junit:$junitVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile "org.hamcrest:hamcrest-all:$hamcrestVersion"
compile ("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testCompile project(":spring-rabbit").sourceSets.test.output
testCompile project(":spring-rabbit-junit")
}
}
apply plugin: org.asciidoctor.gradle.AsciidoctorPlugin
asciidoctor {
sourceDir file("$docsDir")
sourceDocumentNames = files("$docsDir/index.adoc") // Change in >= 1.5.1
outputDir file("$buildDir/html")
backends = ['html5', 'docbook']
logDocuments = true
options = [
doctype: 'book',
attributes: [
docinfo: '',
toc2: '',
'compat-mode': '',
imagesdir: '',
stylesdir: "stylesheets/",
stylesheet: 'golo.css',
'spring-amqp-version': "$version",
'source-highlighter': 'highlightjs'
]
]
}
apply plugin: DocbookReferencePlugin
reference {
sourceFileName = 'index.xml'
sourceDir = asciidoctor.outputDir
pdfFilename = 'spring-amqp-reference.pdf'
expandPlaceholders = ''
}
reference.dependsOn asciidoctor
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
options.stylesheetFile = file("src/api/stylesheet.css")
options.links(rootProject.ext.javadocLinks)
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "api")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
task schemaZip(type: Zip) {
group = 'Distribution'
classifier = 'schema'
description = "Builds -${classifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
subprojects.each { subproject ->
def Properties schemas = new Properties();
def shortName = subproject.name.replaceFirst("${rootProject.name}-", '')
if (subproject.name.endsWith("-rabbit")) {
shortName = 'rabbit'
}
subproject.sourceSets.main.resources.find {
it.path.endsWith("META-INF${File.separator}spring.schemas")
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
File xsdFile = subproject.sourceSets.main.resources.find {
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into ("${shortName}") {
from xsdFile.path
}
}
}
}
task docsZip(type: Zip) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at static.springframework.org/spring-integration/docs."
from('src/dist') {
include 'changelog.txt'
}
from (api) {
into 'api'
}
from (reference) {
into 'reference'
}
}
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
classifier = 'dist'
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
from('src/dist') {
include 'README.md'
include 'apache-license.txt'
include 'epl-license.txt'
include 'notice.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
from(zipTree(schemaZip.archivePath)) {
into "${baseDir}/schema"
}
subprojects.each { subproject ->
into ("${baseDir}/libs") {
from subproject.jar
from subproject.sourcesJar
from subproject.javadocJar
}
}
}
// Create an optional "with dependencies" distribution.
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
classifier = 'dist-with-deps'
description = "Builds -${classifier} archive, containing everything " +
"in the -${distZip.classifier} archive plus all dependencies."
from zipTree(distZip.archivePath)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectNames = rootProject.subprojects*.name
def artifacts = new HashSet()
subprojects.each { subproject ->
subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectNames.contains(dependency.name)) {
artifacts << artifact.file
}
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
tasks.build.dependsOn assemble
artifacts {
archives distZip
archives docsZip
archives schemaZip
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}