forked from reactor/reactor-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
228 lines (195 loc) · 6.16 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
/*
* Copyright (c) 2011-2022 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
}
plugins {
id("jacoco-report-aggregation")
alias(libs.plugins.asciidoctor.convert) apply false
alias(libs.plugins.asciidoctor.pdf) apply false
alias(libs.plugins.artifactory) apply false
alias(libs.plugins.spotless)
}
ext {
isCiServer = System.getenv().containsKey("CI") //doesn't detect Bamboo, but eh
jdk = JavaVersion.current().majorVersion
jdkJavadoc = "https://docs.oracle.com/javase/$jdk/docs/api/"
if (JavaVersion.current().isJava11Compatible()) {
jdkJavadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/"
}
javadocLinks = [
jdkJavadoc,
"https://projectreactor.io/docs/core/${libs.versions.reactorCore.get()}/api/",
"https://www.reactive-streams.org/reactive-streams-${libs.versions.reactiveStreams.get()}-javadoc/",
"https://kafka.apache.org/${libs.versions.kafka.doc.get()}/javadoc/"
] as String[]
//NOTE: all dependencies, including plugins, are defined in gradle/libs.versions.toml catalog
}
apply from: "${rootDir}/gradle/asciidoc.gradle"
apply from: "${rootDir}/gradle/releaser.gradle"
configurations.all {
// check for snapshot updates every time
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
spotless {
if (project.hasProperty("spotlessFrom")) {
if (project.spotlessFrom == "ALL") {
println "[Spotless] Ratchet deactivated"
}
else {
println "[Spotless] Ratchet from $project.spotlessFrom"
ratchetFrom project.spotlessFrom
}
}
else if (isCiServer) {
println "[Spotless] CI detected without explicit branch, not enforcing check"
enforceCheck false
}
else {
String spotlessBranch = "origin/main"
println "[Spotless] Local run detected, ratchet from $spotlessBranch"
ratchetFrom spotlessBranch
}
java {
licenseHeaderFile('codequality/spotless/licenseSlashstarStyle.txt')
}
format 'gradle', {
target '**/*.gradle'
targetExclude 'settings.gradle'
//find start of gradle files by looking for either `import`
// or start of blocks like `javadoc{` or `configure(rootProject) {`...
licenseHeaderFile('codequality/spotless/licenseSlashstarStyle.txt',
"^\\w+(\\(\\w+\\))?\\s?\\{\$|import")
}
}
configure(allprojects) { project ->
group = 'io.projectreactor.kafka'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
if (version.endsWith('-SNAPSHOT')) {
maven { url 'https://repo.spring.io/snapshot' }
}
}
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply from: "${rootDir}/gradle/setup.gradle"
apply from: "${rootDir}/gradle/javadoc.gradle"
sourceCompatibility = targetCompatibility = 1.8
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
maxHeapSize = "1024m"
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = project.hasProperty("showStandardStreams") ?: false
exceptionFormat = 'full'
}
jacoco {
includes = ['reactor/kafka/sender/**', 'reactor/kafka/receiver/**']
}
}
checkstyle {
configFile = new File(rootDir, "codequality/checkstyle/checkstyle.xml")
configProperties = [suppressionsXml: "$rootDir/codequality/checkstyle/suppressions.xml"]
}
test.dependsOn('checkstyleMain', 'checkstyleTest')
jacocoTestReport {
dependsOn test
sourceSets sourceSets.main
reports {
html.enabled = true
xml.enabled = true
}
}
jacocoTestReport.dependsOn test
dependencies {
api libs.kafka
api libs.reactor.core
compileOnly libs.jsr305
testCompileOnly libs.jsr305
// compile "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation libs.junit4
testImplementation libs.reactor.test
testImplementation libs.powermock.core
testImplementation libs.powermock.junit
testImplementation libs.powermock.mockito
testImplementation libs.log4j.api
testImplementation libs.log4j.core
testImplementation libs.log4j.slf4j
// move to compile for 3.0.0 clients
testCompileOnly libs.slf4j
testImplementation libs.testcontainers
testImplementation libs.awaitility
testImplementation libs.assertj
}
}
configure(rootProject) {
archivesBaseName = 'reactor-kafka'
description = 'Reactor Kafka: A reactive API for Apache Kafka'
jar {
manifest {
attributes 'Automatic-Module-Name': 'reactor.kafka'
}
}
//add specific task artifacts to the publication
publishing.publications.mavenJava.artifact(docsZip)
}
project(':reactor-kafka-tools') {
archivesBaseName = 'reactor-kafka-tools'
description = 'Tools for Reactor Kafka'
dependencies {
implementation rootProject
implementation libs.jopt
implementation libs.argparse4j
testImplementation rootProject.sourceSets.test.output
}
test {
systemProperties System.properties
jacoco {
enabled = false
}
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'reactor.kafka.tools'
}
}
}
project(':reactor-kafka-samples') {
archivesBaseName = 'reactor-kafka-samples'
description = 'Samples for Reactor Kafka'
dependencies {
implementation rootProject
testImplementation rootProject.sourceSets.test.output
}
test {
jacoco {
enabled = false
}
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'reactor.kafka.samples'
}
}
}
// Gradle 7.4 supports aggregated jacoco reports via "jacoco-report-aggregation" plugin