-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathbuild.gradle
More file actions
526 lines (441 loc) · 17.3 KB
/
Copy pathbuild.gradle
File metadata and controls
526 lines (441 loc) · 17.3 KB
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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
buildscript {
ext.isCI = System.getenv('GITHUB_ACTION')
ext.kotlinVersion = '2.4.10'
repositories {
gradlePluginPortal()
mavenCentral()
if (version.endsWith('SNAPSHOT')) {
maven { url = 'https://repo.spring.io/snapshot' }
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}
plugins {
id 'base'
alias(libs.plugins.dokka) apply false
alias(libs.plugins.antora)
alias(libs.plugins.io.spring.antora.generate.yml)
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.aggregate.javadoc)
alias(libs.plugins.nullability) apply false
}
description = 'Spring Integration'
ext {
linkHomepage = 'https://projects.spring.io/spring-integration'
linkCi = 'https://github.com/spring-projects/spring-integration/actions/workflows/ci-snapshot.yml'
linkIssue = 'https://github.com/spring-projects/spring-integration/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-integration'
linkScmConnection = 'git://github.com/spring-projects/spring-integration.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration.git'
javaProjects = subprojects - project(':spring-integration-bom')
}
allprojects {
group = 'org.springframework.integration'
repositories {
if (project.hasProperty('mavenLocal')) {
mavenLocal()
}
mavenCentral()
maven { url = 'https://repo.spring.io/milestone' }
if (version.endsWith('SNAPSHOT')) {
maven { url = 'https://repo.spring.io/snapshot' }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
}
}
ext.javadocLinks = [
'https://docs.oracle.com/en/java/javase/17/docs/api/',
'https://jakarta.ee/specifications/platform/10/apidocs/',
'https://docs.spring.io/spring-framework/docs/current/javadoc-api',
'https://docs.spring.io/spring-amqp/docs/current/api/',
'https://docs.spring.io/spring-data/data-mongo/docs/current/api/',
'https://docs.spring.io/spring-data/data-redis/docs/current/api/',
'https://docs.spring.io/spring-ws/docs/current/api/'
] as String[]
configurations {
dependencyManagement {
canBeConsumed = false
canBeResolved = false
}
configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'minutes'
}
}
dependencies {
dependencyManagement(platform(libs.com.fasterxml.jackson.bom))
dependencyManagement(platform(libs.com.google.protobuf.bom))
dependencyManagement(platform(libs.io.cloudevents.bom))
dependencyManagement(platform(libs.io.grpc.bom))
dependencyManagement(platform(libs.io.micrometer.bom))
dependencyManagement(platform(libs.io.micrometer.tracing.bom))
dependencyManagement(platform(libs.io.projectreactor.bom))
dependencyManagement(platform(libs.apache.artemis.bom))
dependencyManagement(platform(libs.apache.camel.bom))
dependencyManagement(platform(libs.apache.groovy.bom))
dependencyManagement(platform(libs.apache.logging.log4j.bom))
dependencyManagement(platform(libs.org.jetbrains.kotlinx.coroutines.bom))
dependencyManagement(platform(libs.org.junit.bom))
dependencyManagement(platform(libs.org.mongodb.driver.bom))
dependencyManagement(platform(libs.spring.framework.bom))
dependencyManagement(platform(libs.spring.amqp.bom))
dependencyManagement(platform(libs.spring.data.bom))
dependencyManagement(platform(libs.spring.kafka.bom))
dependencyManagement(platform(libs.spring.security.bom))
dependencyManagement(platform(libs.spring.ws.bom))
dependencyManagement(platform(libs.org.testcontainers.bom))
dependencyManagement(platform(libs.tools.jackson.bom))
}
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"
if (System.getenv('ARTIFACTORY_USERNAME')) {
apply from: "${rootProject.projectDir}/commercial-settings.gradle"
}
subprojects { subproject ->
if (subproject.name == 'spring-integration-bom') {
return
}
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'checkstyle'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'io.spring.nullability'
configurations {
[compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath].each {
it.extendsFrom(dependencyManagement)
}
}
sourceSets {
test {
resources {
srcDirs = ['src/test/resources', 'src/test/java']
}
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
withJavadocJar()
withSourcesJar()
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask).configureEach {
compilerOptions {
apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_3
languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_3
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
javaParameters = true
allWarningsAsErrors = true
}
}
tasks.withType(JavaCompile).configureEach {
options.fork = true
sourceCompatibility = JavaVersion.VERSION_17
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
options.addBooleanOption('Werror', true) // fail build on Javadoc warnings
options.addBooleanOption('-no-fonts', true) // exclude fonts from module javadoc
}
eclipse {
project {
natures += 'org.springframework.ide.eclipse.core.springnature'
}
}
// dependencies that are common across all java projects
dependencies {
if (!(subproject.name ==~ /.*-test.*/)) {
testImplementation(project(':spring-integration-test-support')) {
exclude group: 'org.hamcrest'
}
}
if (subproject.name !in ['spring-integration-test-support', 'spring-integration-core']) {
api project(':spring-integration-core')
}
compileOnly libs.com.github.spotbugs.annotations
testImplementation libs.com.github.spotbugs.annotations
compileOnly libs.org.checkerframework.checker.qual
testImplementation libs.org.checkerframework.checker.qual
testImplementation libs.org.awaitility
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testImplementation libs.org.junit.pioneer
testImplementation(libs.com.willowtreeapps.assertk) {
exclude group: 'org.jetbrains.kotlin'
}
testImplementation 'org.jetbrains.kotlin:kotlin-reflect'
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.testcontainers:testcontainers-junit-jupiter'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl'
}
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all,-options,-processing'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg, '-parameters']
tasks.register('testAll', Test) { dependsOn['check'] }
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(testAll)) {
test.enabled = false
}
}
tasks.withType(Test).configureEach {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
if (name ==~ /(testAll)/) {
systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true'
systemProperty 'junit.jupiter.execution.timeout.default', '30 m'
}
else {
// Fail a stuck test instead of stalling the whole build with no output at all.
// The default `SAME_THREAD` mode interrupts the test thread and then still waits
// for the invocation to return, so a test wedged in a non-interruptible call
// is reported, but not aborted.
systemProperty 'junit.jupiter.execution.timeout.default', '10 m'
}
environment 'SI_FATAL_WHEN_NO_BEANFACTORY', 'true'
useJUnitPlatform()
reports.junitXml.required = false
enableAssertions = false
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(project.findProperty('testJavaVersion') ?: 25)
}
// The `org.gradle.jvmargs` in the `gradle.properties` applies only to the Gradle daemon:
// forked test JVMs default to 512 MB, which `:spring-integration-core:test` exhausts.
maxHeapSize = '1g'
jvmArgs '-Xshare:off',
'--enable-native-access=ALL-UNNAMED',
'-XX:+HeapDumpOnOutOfMemoryError'
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
systemProperty 'java.io.tmpdir', '/private/tmp'
}
}
checkstyle {
configDirectory.set(rootProject.file('src/checkstyle'))
toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '13.8.0'
}
jar {
manifest {
attributes(
'Implementation-Version': project.version,
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})",
'Implementation-Title': subproject.name,
'Implementation-Vendor-Id': subproject.group,
'Implementation-Vendor': 'Broadcom Inc.',
'Implementation-URL': linkHomepage,
'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw
)
}
from("${rootProject.projectDir}/src/dist") {
include 'notice.txt'
into 'META-INF'
expand(copyright: new Date().format('yyyy'), version: project.version)
}
from("${rootProject.projectDir}") {
include 'LICENSE.txt'
into 'META-INF'
}
}
tasks.register('checkClasspathForConflicts') {
onlyIf { false }
inputs.files(configurations.runtimeClasspath)
def ignored = ['module-info.class']
def errors = ['Found classpath conflicts:\n']
Map<String, Set<String>> classpathContents = [:]
doLast {
inputs.files.each { file ->
new java.util.jar.JarFile(file)
.stream()
.filter { !it.name.startsWith('META-INF/') && it.name.endsWith('.class') && !ignored.contains(it.name) }
.each { classpathContents.computeIfAbsent(it.name, { [] as Set }).add(file.absolutePath) }
}
def conflicts = classpathContents.findAll { it.value.size() > 1 }
conflicts.each {
errors += " $it.key\n"
it.value.each {
errors += " $it\n"
}
}
if (errors.size() > 1) {
throw new InvalidUserDataException(errors.toString().replaceAll(~/,\s/, '') - '[' - ']')
}
}
}
check.dependsOn checkClasspathForConflicts, javadoc
publishing {
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
}
}
}
if (file('src/main/kotlin')) {
apply plugin: 'org.jetbrains.dokka'
dokka {
dokkaPublications.html {
outputDirectory = rootProject.layout.buildDirectory.dir('kdoc')
}
dokkaSourceSets.configureEach {
sourceRoots.setFrom(file('src/main/kotlin'))
classpath.from(sourceSets.main.runtimeClasspath)
externalDocumentationLinks.register('spring-integration-api') {
url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/"))
packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI())
}
externalDocumentationLinks.register('reactor-core') {
url.set(uri('https://projectreactor.io/docs/core/release/api/'))
}
externalDocumentationLinks.register('reactive-streams') {
url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/'))
}
}
}
}
}
dependencies {
javaProjects.each {
javadoc it
}
}
configurations.javadocClasspath.extendsFrom(configurations.dependencyManagement)
javadoc {
title = "${rootProject.description} ${version} API"
options {
encoding = 'UTF-8'
memberLevel = JavadocMemberLevel.PROTECTED
author = true
header = project.description
use = true
overview = 'src/api/overview.html'
splitIndex = true
links(project.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
}
destinationDir = file('build/api')
notCompatibleWithConfigurationCache('Task requires resolving transitive dependencies from all subprojects')
doFirst {
classpath += files(javaProjects.collect { it.sourceSets.main.compileClasspath })
}
}
tasks.register('api') {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
dependsOn javadoc
}
apply from: "${rootDir}/gradle/docs.gradle"
tasks.register('schemaZip', Zip) {
group = 'Distribution'
archiveClassifier = 'schema'
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
String[] versionNumbers = project.version.toString().split(/\./, 3)
javaProjects.each { subproject ->
Properties schemas = new Properties()
def shortName = subproject.name.replaceFirst("${rootProject.name}-", '')
if (subproject.name.endsWith('-core')) {
shortName = ''
}
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("integration/$shortName") {
from xsdFile.path
rename { it.replace('.xsd', "-${versionNumbers[0]}.${versionNumbers[1]}.xsd") }
}
}
}
}
apply plugin: 'org.jetbrains.dokka'
dependencies {
dokka project(':spring-integration-core')
}
dokka {
moduleName = 'spring-integration'
dokkaPublications.html {
outputDirectory = project.layout.buildDirectory.dir('kdoc')
}
}
tasks.register('docsZip', Zip) {
dependsOn 'dokkaGenerate'
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing api and reference " +
"for deployment at static.springframework.org/spring-integration/docs."
from('src/dist') {
include 'changelog.txt'
}
from(javadoc) {
into 'api'
}
from(project.layout.buildDirectory.file('kdoc')) {
into 'kdoc-api'
}
}
tasks.register('distZip', Zip) {
dependsOn 'docsZip'
dependsOn 'schemaZip'
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
def baseDir = "${project.name}-${project.version}"
from('src/dist') {
include 'readme.txt'
include 'notice.txt'
into baseDir
expand(copyright: new Date().format('yyyy'), version: project.version)
}
from("$project.rootDir") {
include 'LICENSE.txt'
into baseDir
}
from(zipTree(docsZip.archiveFile)) {
into "$baseDir/docs"
}
from(zipTree(schemaZip.archiveFile)) {
into "$baseDir/schema"
}
javaProjects.each { subproject ->
into("$baseDir/libs") {
from subproject.jar
from subproject.sourcesJar
from subproject.javadocJar
}
}
from(project(':spring-integration-bom').generatePomFileForMavenJavaPublication) {
into "$baseDir/libs"
rename 'pom-default.xml', "spring-integration-bom-${project.version}.xml"
}
}
tasks.register('dist') {
dependsOn assemble
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact docsZip
artifact schemaZip
artifact distZip
}
}
}