forked from spring-projects/spring-pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
382 lines (322 loc) · 10.7 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
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
maven { url 'https://repo.spring.io/plugins-release' }
}
}
plugins {
id 'base'
id 'project-report'
id 'idea'
id 'org.sonarqube' version '2.8'
id 'org.ajoberstar.grgit' version '4.0.1' apply false
id 'io.spring.nohttp' version '0.0.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' apply false
id 'com.jfrog.artifactory' version '4.18.2' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.asciidoctor.jvm.gems' version '3.3.2'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
apply plugin: 'io.spring.nohttp'
def gitPresent = new File('.git').exists()
if (gitPresent) {
apply plugin: 'org.ajoberstar.grgit'
}
description = 'Spring for Apache Pulsar'
ext {
linkHomepage = 'https://github.com/spring-projects-experimental/spring-pulsar'
linkIssue = 'https://github.com/spring-projects-experimental/spring-pulsar/issues'
linkScmUrl = 'https://github.com/spring-projects-experimental/spring-pulsar'
linkScmConnection = 'https://github.com/spring-projects-experimental/spring-pulsar.git'
linkScmDevConnection = '[email protected]:spring-projects-experimental/spring-pulsar.git'
docResourcesVersion = '0.2.5'
javadocLinks = [
'https://docs.oracle.com/en/java/javase/17/docs/api/',
'https://docs.spring.io/spring-framework/docs/current/javadoc-api/'
] as String[]
if (gitPresent) {
modifiedFiles =
files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') }
}
assertjVersion = '3.22.0'
awaitilityVersion = '4.2.0'
googleJsr305Version = '3.0.2'
hamcrestVersion = '2.2'
hibernateValidationVersion = '7.0.4.Final'
jacksonBomVersion = '2.13.3'
jaywayJsonPathVersion = '2.6.0'
junitJupiterVersion = '5.8.2'
pulsarVersion = '2.10.0'
log4jVersion = '2.17.2'
mockitoVersion = '4.5.1'
reactorVersion = '2020.0.17'
springBootVersion = '3.0.0-SNAPSHOT' // docs module
springRetryVersion = '1.3.3'
springVersion = '6.0.0-SNAPSHOT'
caffeineVersion = '3.1.1'
idPrefix = 'pulsar'
}
nohttp {
source.include '**/src/**'
source.exclude '**/*.gif', '**/*.ks'
}
allprojects {
group = 'org.springframework.pulsar'
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
applyMavenExclusions = false
generatedPomCustomization {
enabled = false
}
imports {
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonBomVersion"
mavenBom "org.junit:junit-bom:$junitJupiterVersion"
mavenBom "org.springframework:spring-framework-bom:$springVersion"
mavenBom "io.projectreactor:reactor-bom:$reactorVersion"
mavenBom "org.apache.logging.log4j:log4j-bom:$log4jVersion"
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/milestone' }
if (version.endsWith('SNAPSHOT')) {
maven { url 'https://repo.spring.io/snapshot' }
}
// maven { url 'https://repository.apache.org/content/groups/staging/' }
}
}
subprojects { subproject ->
apply plugin: 'java-library'
apply plugin: 'java'
apply from: "${rootProject.projectDir}/gradle/publish-artifactory.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
java {
withJavadocJar()
withSourcesJar()
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
registerFeature('provided') {
usingSourceSet(sourceSets.main)
}
}
compileJava {
sourceCompatibility = 17
targetCompatibility = 17
}
compileTestJava {
sourceCompatibility = 17
options.encoding = 'UTF-8'
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
jacoco {
toolVersion = '0.8.7'
}
// dependencies that are common across all java projects
dependencies {
implementation "com.google.code.findbugs:jsr305:$googleJsr305Version"
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
testImplementation("org.awaitility:awaitility:$awaitilityVersion") {
exclude group: 'org.hamcrest'
}
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
optionalApi "org.assertj:assertj-core:$assertjVersion"
testImplementation "org.testcontainers:pulsar:1.17.2"
testImplementation "org.springframework:spring-test"
}
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
testLogging {
events "skipped", "failed"
showStandardStreams = project.hasProperty("showStandardStreams") ?: false
showExceptions = true
showStackTraces = true
exceptionFormat = 'full'
}
maxHeapSize = '1536m'
// jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8111'
jacoco {
destinationFile = file("$buildDir/jacoco.exec")
}
useJUnitPlatform()
if (System.properties['sonar.host.url']) {
finalizedBy jacocoTestReport
}
}
checkstyle {
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = '9.0'
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
publishing {
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
pom.withXml {
def pomDeps = asNode().dependencies.first()
subproject.configurations.providedImplementation.allDependencies.each { dep ->
pomDeps.remove(pomDeps.'*'.find { it.artifactId.text() == dep.name })
pomDeps.appendNode('dependency').with {
it.appendNode('groupId', dep.group)
it.appendNode('artifactId', dep.name)
it.appendNode('version', dep.version)
it.appendNode('scope', 'provided')
}
}
}
}
}
}
task updateCopyrights {
onlyIf { gitPresent && !System.getenv('GITHUB_ACTION') }
if (gitPresent) {
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
}
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
}
}
}
}
}
}
jar {
manifest {
attributes(
'Implementation-Version': archiveVersion,
'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
)
}
from("${rootProject.projectDir}/src/dist") {
include 'license.txt'
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.withType(Javadoc) {
options.addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
options.addBooleanOption('Werror', true) // fail build on Javadoc warnings
}
}
project ('spring-pulsar') {
description = 'Spring Pulsar Support'
dependencies {
api 'org.springframework:spring-context'
api 'org.springframework:spring-messaging'
api 'org.springframework:spring-tx'
api ("org.springframework.retry:spring-retry:$springRetryVersion") {
exclude group: 'org.springframework'
}
api "org.apache.pulsar:pulsar-client:$pulsarVersion"
api "org.apache.pulsar:pulsar-client-admin:$pulsarVersion"
api "org.apache.pulsar:pulsar-client-admin-api:$pulsarVersion"
api "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
optionalApi 'com.fasterxml.jackson.core:jackson-core'
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
optionalApi ('com.fasterxml.jackson.module:jackson-module-kotlin') {
exclude group: 'org.jetbrains.kotlin'
}
optionalApi "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
optionalApi 'io.projectreactor:reactor-core'
testImplementation 'io.projectreactor:reactor-test'
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
testImplementation "org.hibernate.validator:hibernate-validator:$hibernateValidationVersion"
}
}
project ('spring-pulsar-boot-autoconfigure') {
description = 'Spring Boot Pulsar Autoconfiguration'
dependencies {
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
api "org.springframework.boot:spring-boot:$springBootVersion"
api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
api "org.springframework.boot:spring-boot-starter:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-validation:$springBootVersion"
api project (':spring-pulsar')
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
}
}
project ('spring-pulsar-sample-apps') {
description = 'Spring Pulsar Sample Applications'
dependencies {
api project (':spring-pulsar-boot-autoconfigure')
}
}
sonarqube {
properties {
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
}
}
// skip publishing the root module
artifactoryPublish.skip = true
if (project.hasProperty('artifactoryUsername')) {
artifactory {
contextUrl = 'https://repo.spring.io'
publish {
repository {
repoKey = 'libs-snapshot-local'
username = "${artifactoryUsername}"
password = "${artifactoryPassword}"
}
defaults {
publications('mavenJava')
}
}
}
}