Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit e4018d0

Browse files
authored
[chores] Update the build and realign it with core / Gradle 7 (#172)
- GitHub Actions: pin actions, readonly permission, separate tag step - Polish build.gradle - Upgrade to Gradle 7.4 - Update a few dependencies - Extract versions in catalog + polish javadocLinks - Upgrade rabbitmq javaClient to 5.14.2 - fix When.MAYBE warnings by adding jsr305 annotation (compileOnly)
1 parent 4ab12cb commit e4018d0

File tree

10 files changed

+282
-199
lines changed

10 files changed

+282
-199
lines changed

.github/workflows/publish.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches: # For branches, better to list them explicitly than regexp include
55
- main
66
- 1.4.x
7+
permissions: read-all
78
jobs:
89
# General job notes: we DON'T want to cancel any previous runs, especially in the case of a "back to snapshots" build right after a release push
910
# We specify the ubuntu version to minimize the chances we have to deal with a migration during a release
@@ -21,10 +22,11 @@ jobs:
2122
versionType: ${{ steps.version.outputs.versionType }}
2223
fullVersion: ${{ steps.version.outputs.fullVersion }}
2324
steps:
24-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
2526
- name: setup java
26-
uses: actions/setup-java@v1
27+
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
2728
with:
29+
distribution: 'temurin'
2830
java-version: 8
2931
- name: interpret version
3032
id: version
@@ -44,9 +46,10 @@ jobs:
4446
if: needs.prepare.outputs.versionType == 'SNAPSHOT'
4547
environment: snapshots
4648
steps:
47-
- uses: actions/checkout@v2
48-
- uses: actions/setup-java@v1
49+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
50+
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
4951
with:
52+
distribution: 'temurin'
5053
java-version: 8
5154
- name: deploy
5255
env:
@@ -63,9 +66,10 @@ jobs:
6366
if: needs.prepare.outputs.versionType == 'MILESTONE'
6467
environment: releases
6568
steps:
66-
- uses: actions/checkout@v2
67-
- uses: actions/setup-java@v1
69+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
70+
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
6871
with:
72+
distribution: 'temurin'
6973
java-version: 8
7074
- name: deploy
7175
env:
@@ -75,12 +79,6 @@ jobs:
7579
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.SIGNING_PASSPHRASE}}
7680
run: |
7781
./gradlew assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-milestone-local
78-
- name: tag
79-
run: |
80-
git config --local user.name 'reactorbot'
81-
git config --local user.email '[email protected]'
82-
git tag -m "Release milestone ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
83-
git push --tags
8482
8583
#sign the release artifacts and deploy them to Artifactory
8684
deployRelease:
@@ -90,9 +88,10 @@ jobs:
9088
if: needs.prepare.outputs.versionType == 'RELEASE'
9189
environment: releases
9290
steps:
93-
- uses: actions/checkout@v2
94-
- uses: actions/setup-java@v1
91+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
92+
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
9593
with:
94+
distribution: 'temurin'
9695
java-version: 8
9796
- name: deploy
9897
env:
@@ -104,6 +103,29 @@ jobs:
104103
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
105104
run: |
106105
./gradlew assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-release-local publishMavenJavaPublicationToSonatypeRepository
106+
107+
tagMilestone:
108+
name: Tag milestone
109+
needs: [ prepare, deployMilestone ]
110+
runs-on: ubuntu-20.04
111+
permissions:
112+
contents: write
113+
steps:
114+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
115+
- name: tag
116+
run: |
117+
git config --local user.name 'reactorbot'
118+
git config --local user.email '[email protected]'
119+
git tag -m "Release milestone ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
120+
git push --tags
121+
tagRelease:
122+
name: Tag release
123+
needs: [ prepare, deployRelease ]
124+
runs-on: ubuntu-20.04
125+
permissions:
126+
contents: write
127+
steps:
128+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
107129
- name: tag
108130
run: |
109131
git config --local user.name 'reactorbot'

.github/workflows/test-linux.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
- 1.4.x
8-
8+
permissions: read-all
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
@@ -17,12 +17,13 @@ jobs:
1717
- 5672:5672
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
2121

2222
- name: Set up JDK 1.8
23-
uses: actions/setup-java@v1
23+
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
2424
with:
25-
java-version: 1.8
25+
distribution: 'temurin'
26+
java-version: 8
2627

2728
- name: Test
2829
run: ./gradlew check -i -s -Drabbitmqctl.bin=DOCKER:${{job.services.rabbitmq.id}}

build.gradle

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2011-2022 VMware Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,40 +21,30 @@ buildscript {
2121
}
2222
}
2323
plugins {
24-
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
25-
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
24+
alias(libs.plugins.asciidoctor.convert) apply false
25+
alias(libs.plugins.asciidoctor.pdf) apply false
2626
// applied in setup.gradle, only if artifactory credentials are configured
27-
id "com.jfrog.artifactory" version "4.24.20" apply false
27+
alias(libs.plugins.artifactory) apply false
2828
}
2929

3030
ext {
31-
gradleScriptDir = "${rootProject.projectDir}/gradle"
31+
//NOTE: all dependencies, including plugins, are defined in gradle/libs.versions.toml catalog
3232

33-
// Logging
34-
slf4jVersion = '1.7.32'
35-
logbackVersion = '1.2.6'
36-
37-
// Libraries
38-
rabbitMqJavaClientVersion = '5.13.1'
39-
40-
// Sample
41-
springBootVersion = '2.5.6'
42-
springAmqpVersion = '2.3.11'
43-
44-
// Testing
45-
mockitoVersion = '4.0.0'
46-
junitPlatformVersion = '1.8.1'
47-
junitJupiterVersion = '5.8.1'
48-
assertjVersion = '3.21.0'
49-
50-
javadocLinks = ["https://docs.oracle.com/javase/8/docs/api/",
51-
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
52-
"https://projectreactor.io/docs/core/release/api/",
53-
"https://rabbitmq.github.io/rabbitmq-java-client/api/current/",] as String[]
33+
jdk = JavaVersion.current().majorVersion
34+
jdkJavadoc = "https://docs.oracle.com/javase/$jdk/docs/api/"
35+
if (JavaVersion.current().isJava11Compatible()) {
36+
jdkJavadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/"
37+
}
38+
javadocLinks = [
39+
jdkJavadoc,
40+
"https://www.reactive-streams.org/reactive-streams-${libs.versions.reactiveStreams.get()}-javadoc/",
41+
"https://projectreactor.io/docs/core/release/api/",
42+
"https://rabbitmq.github.io/rabbitmq-java-client/api/current/"
43+
] as String[]
5444
}
5545

56-
apply from: "$gradleScriptDir/asciidoc.gradle"
57-
apply from: "$gradleScriptDir/releaser.gradle"
46+
apply from: "${rootDir}/gradle/asciidoc.gradle"
47+
apply from: "${rootDir}/gradle/releaser.gradle"
5848

5949
configurations.all {
6050
// check for snapshot updates every time
@@ -72,10 +62,13 @@ configure(allprojects) { project ->
7262
apply plugin: 'eclipse'
7363
apply plugin: 'idea'
7464
apply plugin: 'java'
75-
apply from: "$gradleScriptDir/setup.gradle"
65+
apply from: "${rootDir}/gradle/setup.gradle"
7666

7767
sourceCompatibility = targetCompatibility = 1.8
7868

69+
if (JavaVersion.current().isJava8Compatible()) {
70+
compileTestJava.options.compilerArgs += "-parameters"
71+
}
7972
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:varargs",
8073
"-Xlint:cast",
8174
"-Xlint:classfile",
@@ -97,21 +90,25 @@ configure(allprojects) { project ->
9790
]
9891

9992
dependencies {
100-
implementation "io.projectreactor:reactor-core:$reactorCoreVersion"
101-
implementation "com.rabbitmq:amqp-client:$rabbitMqJavaClientVersion"
93+
implementation libs.reactor.core
94+
implementation libs.rabbitmq.javaClient
95+
96+
// JSR-305 annotations
97+
compileOnly libs.jsr305
10298

10399
// Testing
104100
// JUnit Jupiter API and TestEngine implementation
105-
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
106-
testImplementation("org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}")
107-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
108-
109-
testImplementation "io.projectreactor:reactor-test:$reactorCoreVersion"
110-
testImplementation "org.mockito:mockito-core:$mockitoVersion"
111-
testImplementation "org.assertj:assertj-core:${assertjVersion}"
112-
testRuntimeOnly "org.slf4j:jcl-over-slf4j:$slf4jVersion"
113-
testRuntimeOnly "org.slf4j:slf4j-api:$slf4jVersion"
114-
testRuntimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
101+
testImplementation platform(libs.junit.bom)
102+
testImplementation "org.junit.jupiter:junit-jupiter-api"
103+
testImplementation "org.junit.jupiter:junit-jupiter-params"
104+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
105+
106+
testImplementation libs.reactor.test
107+
testImplementation libs.mockito
108+
testImplementation libs.assertj
109+
testRuntimeOnly libs.slf4j.api
110+
testRuntimeOnly libs.slf4j.jcl
111+
testRuntimeOnly libs.logback
115112
}
116113

117114
// force test runs even when there are no test changes
@@ -121,7 +118,7 @@ configure(allprojects) { project ->
121118
configure(rootProject) {
122119
archivesBaseName = 'reactor-rabbitmq'
123120
description = 'Reactor RabbitMQ: A reactive API for RabbitMQ'
124-
apply from: "$gradleScriptDir/javadoc.gradle"
121+
apply from: "${rootDir}/gradle/javadoc.gradle"
125122

126123
jar {
127124
manifest {
@@ -145,26 +142,27 @@ project(':reactor-rabbitmq-samples') {
145142

146143
dependencies {
147144
implementation rootProject
148-
runtimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
149-
implementation "org.springframework.boot:spring-boot-starter:$springBootVersion"
150-
implementation "org.springframework.amqp:spring-rabbit:$springAmqpVersion"
145+
146+
runtimeOnly libs.logback
147+
implementation libs.spring.boot.starter
148+
implementation libs.spring.amqp.rabbitmq
151149

152150
testImplementation rootProject.sourceSets.test.output
153-
testRuntimeOnly "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
151+
testRuntimeOnly libs.spring.boot.test
154152
}
155153

156154
task sender(type:JavaExec) {
157-
mainClass = 'reactor.rabbitmq.samples.SampleSender'
155+
mainClass.set('reactor.rabbitmq.samples.SampleSender')
158156
classpath = sourceSets.main.runtimeClasspath
159157
}
160158

161159
task receiver(type:JavaExec) {
162-
mainClass = 'reactor.rabbitmq.samples.SampleReceiver'
160+
mainClass.set('reactor.rabbitmq.samples.SampleReceiver')
163161
classpath = sourceSets.main.runtimeClasspath
164162
}
165163

166164
task springboot(type:JavaExec) {
167-
mainClass = 'reactor.rabbitmq.samples.SpringBootSample'
165+
mainClass.set('reactor.rabbitmq.samples.SpringBootSample')
168166
classpath = sourceSets.main.runtimeClasspath
169167
}
170168

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
version=1.5.5-SNAPSHOT
2-
reactorCoreVersion=3.4.13-SNAPSHOT
1+
version=1.5.5-SNAPSHOT

gradle/javadoc.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ javadoc {
66
title = "Reactor RabbitMQ ${version}"
77

88
if (JavaVersion.current().isJava8Compatible()) {
9-
compileTestJava.options.compilerArgs += "-parameters"
10-
tasks.withType(Javadoc) {
11-
options.addStringOption('Xdoclint:none', '-quiet')
12-
}
9+
options.addStringOption('Xdoclint:none', '-quiet')
1310
}
1411

1512
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED

gradle/libs.versions.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[versions]
2+
# Baselines, should be updated on every release
3+
reactorCore = "3.4.16-SNAPSHOT"
4+
rabbitMq = "5.14.2"
5+
6+
# Other shared versions
7+
asciidoctor = "3.3.2"
8+
junit = "5.8.2"
9+
slf4j = "1.7.36"
10+
springBoot = "2.5.9"
11+
reactiveStreams = "1.0.3"
12+
13+
[libraries]
14+
assertj = "org.assertj:assertj-core:3.22.0"
15+
jsr305 = "com.google.code.findbugs:jsr305:3.0.1" #v3.0.1 is the last with required annotations
16+
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
17+
logback = "ch.qos.logback:logback-classic:1.2.10"
18+
mockito = "org.mockito:mockito-core:4.3.1"
19+
rabbitmq-javaClient = { module = "com.rabbitmq:amqp-client", version.ref = "rabbitMq" }
20+
reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "reactorCore" }
21+
reactor-test = { module = "io.projectreactor:reactor-test", version.ref = "reactorCore" }
22+
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
23+
slf4j-jcl = { module = "org.slf4j:jcl-over-slf4j", version.ref = "slf4j" }
24+
spring-amqp-rabbitmq = "org.springframework.amqp:spring-rabbit:2.3.14"
25+
spring-boot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springBoot" }
26+
spring-boot-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springBoot" }
27+
28+
[plugins]
29+
artifactory = { id = "com.jfrog.artifactory", version = "4.27.1" }
30+
asciidoctor-convert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
31+
asciidoctor-pdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor" }

gradle/wrapper/gradle-wrapper.jar

4.11 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)