This repository has been archived by the owner on Mar 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 179
/
build.gradle
355 lines (299 loc) · 9.51 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
buildscript {
ext.kotlinVersion = '1.3.72'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'org.sonarqube' version '2.8'
id 'checkstyle'
id 'org.ajoberstar.grgit' version '4.0.2'
id 'com.jfrog.artifactory' version '4.15.2' apply false
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
}
description = 'Spring Integration Kafka Support'
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
java {
withJavadocJar()
withSourcesJar()
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"
sourceSets {
test {
resources {
srcDirs = ['src/test/resources', 'src/test/java']
}
}
}
group = 'org.springframework.integration'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
if (version.endsWith('BUILD-SNAPSHOT')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
// maven { url 'https://repo.spring.io/libs-staging-local' }
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}
ext {
assertkVersion = '0.23'
googleJsr305Version = '3.0.2'
jacksonVersion = '2.11.4'
junitJupiterVersion = '5.6.3'
log4jVersion = '2.13.3'
springIntegrationVersion = '5.3.7.RELEASE'
springKafkaVersion = '2.5.13.RELEASE'
idPrefix = 'kafka'
linkHomepage = 'https://github.com/spring-projects/spring-integration-kafka'
linkCi = 'https://build.spring.io/browse/INTEXT'
linkIssue = 'https://github.com/spring-projects/spring-integration-kafka/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-integration-kafka'
linkScmConnection = 'https://github.com/spring-projects/spring-integration-kafka.git'
linkScmDevConnection = '[email protected]:spring-projects/spring-integration-kafka.git'
modifiedFiles =
files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
}
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
applyMavenExclusions = false
generatedPomCustomization {
enabled = false
}
imports {
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion"
mavenBom "org.junit:junit-bom:$junitJupiterVersion"
mavenBom "org.springframework.integration:spring-integration-bom:$springIntegrationVersion"
}
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
jacoco {
toolVersion = '0.8.5'
}
dependencies {
compileOnly "com.google.code.findbugs:jsr305:$googleJsr305Version"
api 'org.springframework.integration:spring-integration-core'
api "org.springframework.kafka:spring-kafka:$springKafkaVersion"
testImplementation "org.springframework.kafka:spring-kafka-test:$springKafkaVersion"
testImplementation 'org.springframework.integration:spring-integration-test'
testImplementation "com.willowtreeapps.assertk:assertk-jvm:$assertkVersion"
testImplementation 'org.jetbrains.kotlin:kotlin-reflect'
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.scala-lang:scala-library:2.12.11'
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-core'
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = '1024m'
jacoco {
destinationFile = file("$buildDir/jacoco.exec")
}
useJUnitPlatform()
}
checkstyle {
configDirectory.set(rootProject.file('src/checkstyle'))
toolVersion = '8.41.1'
}
publishing {
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
}
}
}
task updateCopyrights {
onlyIf { !System.getenv('TRAVIS') && !System.getenv('bamboo_buildKey') }
inputs.files(modifiedFiles)
outputs.dir('build')
doLast {
def now = Calendar.instance.get(Calendar.YEAR) as String
inputs.files.each { file ->
def line
file.withReader { reader ->
while (line = reader.readLine()) {
def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/
if (matcher.count) {
def beginningYear = matcher[0][1]
if (now != beginningYear && now != matcher[0][2]) {
def years = "$beginningYear-$now"
def sourceCode = file.text
sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years)
file.write(sourceCode)
println "Copyright updated for file: $file"
}
break
}
}
}
}
}
}
compileKotlin.dependsOn updateCopyrights
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco/html")
}
}
build.dependsOn jacocoTestReport
jar {
manifest {
attributes(
'Implementation-Version': archiveVersion,
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})",
'Implementation-Title': project.name,
'Implementation-Vendor-Id': project.group,
'Implementation-Vendor': 'Pivotal Software, Inc.',
'Implementation-URL': linkHomepage,
'Automatic-Module-Name': project.name.replace('-', '.') // for Jigsaw
)
}
}
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 the 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'
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = new File(buildDir, 'api')
}
task schemaZip(type: Zip) {
group = 'Distribution'
archiveClassifier = 'schema'
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
def Set files = new HashSet()
def Properties schemas = new Properties();
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
project.sourceSets.main.resources.find {
it.path.endsWith("META-INF${File.separator}spring.schemas")
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
File xsdFile = project.sourceSets.main.resources.find {
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
if (!files.contains(xsdFile.path)) {
into ("integration/${shortName}") {
from xsdFile.path
rename { String fileName ->
String[] versionNumbers = project.version.split(/\./, 3)
fileName.replace('.xsd', "-${versionNumbers[0]}.${versionNumbers[1]}.xsd")
}
}
files.add(xsdFile.path)
}
}
}
task docsZip(type: Zip) {
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing api " +
"for deployment at static.spring.io/spring-integration/docs."
from('src/dist') {
include 'changelog.txt'
}
from(api) {
into 'api'
}
}
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
from('src/dist') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archiveFile)) {
into "${baseDir}/docs"
}
from(zipTree(schemaZip.archiveFile)) {
into "${baseDir}/schema"
}
into("${baseDir}/libs") {
from project.jar
from project.sourcesJar
from project.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'
archiveClassifier = 'dist-with-deps'
description = "Builds -${archiveClassifier} archive, containing everything " +
"in the -${distZip.archiveClassifier} archive plus all dependencies."
from zipTree(distZip.archiveFile)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectName = rootProject.name
def artifacts = new HashSet()
rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectName.equals(dependency.name)) {
artifacts << artifact.file
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
artifacts {
archives distZip
archives docsZip
archives schemaZip
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}