Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chores] Update the build and realign it with core / Gradle 7 #172

Merged
merged 12 commits into from
Feb 22, 2022
Merged
50 changes: 36 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: # For branches, better to list them explicitly than regexp include
- main
- 1.4.x
permissions: read-all
jobs:
# 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
# We specify the ubuntu version to minimize the chances we have to deal with a migration during a release
Expand All @@ -21,10 +22,11 @@ jobs:
versionType: ${{ steps.version.outputs.versionType }}
fullVersion: ${{ steps.version.outputs.fullVersion }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- name: setup java
uses: actions/setup-java@v1
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
with:
distribution: 'temurin'
java-version: 8
- name: interpret version
id: version
Expand All @@ -44,9 +46,10 @@ jobs:
if: needs.prepare.outputs.versionType == 'SNAPSHOT'
environment: snapshots
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
with:
distribution: 'temurin'
java-version: 8
- name: deploy
env:
Expand All @@ -63,9 +66,10 @@ jobs:
if: needs.prepare.outputs.versionType == 'MILESTONE'
environment: releases
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
with:
distribution: 'temurin'
java-version: 8
- name: deploy
env:
Expand All @@ -75,12 +79,6 @@ jobs:
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.SIGNING_PASSPHRASE}}
run: |
./gradlew assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-milestone-local
- name: tag
run: |
git config --local user.name 'reactorbot'
git config --local user.email '[email protected]'
git tag -m "Release milestone ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
git push --tags

#sign the release artifacts and deploy them to Artifactory
deployRelease:
Expand All @@ -90,9 +88,10 @@ jobs:
if: needs.prepare.outputs.versionType == 'RELEASE'
environment: releases
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
with:
distribution: 'temurin'
java-version: 8
- name: deploy
env:
Expand All @@ -104,6 +103,29 @@ jobs:
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
run: |
./gradlew assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-release-local publishMavenJavaPublicationToSonatypeRepository

tagMilestone:
name: Tag milestone
needs: [ prepare, deployMilestone ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- name: tag
run: |
git config --local user.name 'reactorbot'
git config --local user.email '[email protected]'
git tag -m "Release milestone ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
git push --tags
tagRelease:
name: Tag release
needs: [ prepare, deployRelease ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- name: tag
run: |
git config --local user.name 'reactorbot'
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
- 1.4.x

permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,12 +17,13 @@ jobs:
- 5672:5672

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2
with:
java-version: 1.8
distribution: 'temurin'
java-version: 8

- name: Test
run: ./gradlew check -i -s -Drabbitmqctl.bin=DOCKER:${{job.services.rabbitmq.id}}
96 changes: 47 additions & 49 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved.
* 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.
Expand All @@ -21,40 +21,30 @@ buildscript {
}
}
plugins {
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
alias(libs.plugins.asciidoctor.convert) apply false
alias(libs.plugins.asciidoctor.pdf) apply false
// applied in setup.gradle, only if artifactory credentials are configured
id "com.jfrog.artifactory" version "4.24.20" apply false
alias(libs.plugins.artifactory) apply false
}

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

// Logging
slf4jVersion = '1.7.32'
logbackVersion = '1.2.6'

// Libraries
rabbitMqJavaClientVersion = '5.13.1'

// Sample
springBootVersion = '2.5.6'
springAmqpVersion = '2.3.11'

// Testing
mockitoVersion = '4.0.0'
junitPlatformVersion = '1.8.1'
junitJupiterVersion = '5.8.1'
assertjVersion = '3.21.0'

javadocLinks = ["https://docs.oracle.com/javase/8/docs/api/",
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
"https://projectreactor.io/docs/core/release/api/",
"https://rabbitmq.github.io/rabbitmq-java-client/api/current/",] as String[]
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://www.reactive-streams.org/reactive-streams-${libs.versions.reactiveStreams.get()}-javadoc/",
"https://projectreactor.io/docs/core/release/api/",
"https://rabbitmq.github.io/rabbitmq-java-client/api/current/"
] as String[]
}

apply from: "$gradleScriptDir/asciidoc.gradle"
apply from: "$gradleScriptDir/releaser.gradle"
apply from: "${rootDir}/gradle/asciidoc.gradle"
apply from: "${rootDir}/gradle/releaser.gradle"

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

sourceCompatibility = targetCompatibility = 1.8

if (JavaVersion.current().isJava8Compatible()) {
compileTestJava.options.compilerArgs += "-parameters"
}
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:varargs",
"-Xlint:cast",
"-Xlint:classfile",
Expand All @@ -97,21 +90,25 @@ configure(allprojects) { project ->
]

dependencies {
implementation "io.projectreactor:reactor-core:$reactorCoreVersion"
implementation "com.rabbitmq:amqp-client:$rabbitMqJavaClientVersion"
implementation libs.reactor.core
implementation libs.rabbitmq.javaClient

// JSR-305 annotations
compileOnly libs.jsr305

// Testing
// JUnit Jupiter API and TestEngine implementation
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

testImplementation "io.projectreactor:reactor-test:$reactorCoreVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.assertj:assertj-core:${assertjVersion}"
testRuntimeOnly "org.slf4j:jcl-over-slf4j:$slf4jVersion"
testRuntimeOnly "org.slf4j:slf4j-api:$slf4jVersion"
testRuntimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
testImplementation platform(libs.junit.bom)
testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.junit.jupiter:junit-jupiter-params"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"

testImplementation libs.reactor.test
testImplementation libs.mockito
testImplementation libs.assertj
testRuntimeOnly libs.slf4j.api
testRuntimeOnly libs.slf4j.jcl
testRuntimeOnly libs.logback
}

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

jar {
manifest {
Expand All @@ -145,26 +142,27 @@ project(':reactor-rabbitmq-samples') {

dependencies {
implementation rootProject
runtimeOnly "ch.qos.logback:logback-classic:$logbackVersion"
implementation "org.springframework.boot:spring-boot-starter:$springBootVersion"
implementation "org.springframework.amqp:spring-rabbit:$springAmqpVersion"

runtimeOnly libs.logback
implementation libs.spring.boot.starter
implementation libs.spring.amqp.rabbitmq

testImplementation rootProject.sourceSets.test.output
testRuntimeOnly "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testRuntimeOnly libs.spring.boot.test
}

task sender(type:JavaExec) {
mainClass = 'reactor.rabbitmq.samples.SampleSender'
mainClass.set('reactor.rabbitmq.samples.SampleSender')
classpath = sourceSets.main.runtimeClasspath
}

task receiver(type:JavaExec) {
mainClass = 'reactor.rabbitmq.samples.SampleReceiver'
mainClass.set('reactor.rabbitmq.samples.SampleReceiver')
classpath = sourceSets.main.runtimeClasspath
}

task springboot(type:JavaExec) {
mainClass = 'reactor.rabbitmq.samples.SpringBootSample'
mainClass.set('reactor.rabbitmq.samples.SpringBootSample')
classpath = sourceSets.main.runtimeClasspath
}

Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
version=1.5.5-SNAPSHOT
reactorCoreVersion=3.4.13-SNAPSHOT
version=1.5.5-SNAPSHOT
5 changes: 1 addition & 4 deletions gradle/javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ javadoc {
title = "Reactor RabbitMQ ${version}"

if (JavaVersion.current().isJava8Compatible()) {
compileTestJava.options.compilerArgs += "-parameters"
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
options.addStringOption('Xdoclint:none', '-quiet')
}

options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
Expand Down
31 changes: 31 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[versions]
# Baselines, should be updated on every release
reactorCore = "3.4.16-SNAPSHOT"
rabbitMq = "5.14.2"

# Other shared versions
asciidoctor = "3.3.2"
junit = "5.8.2"
slf4j = "1.7.36"
springBoot = "2.5.9"
reactiveStreams = "1.0.3"

[libraries]
assertj = "org.assertj:assertj-core:3.22.0"
jsr305 = "com.google.code.findbugs:jsr305:3.0.1" #v3.0.1 is the last with required annotations
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
logback = "ch.qos.logback:logback-classic:1.2.10"
mockito = "org.mockito:mockito-core:4.3.1"
rabbitmq-javaClient = { module = "com.rabbitmq:amqp-client", version.ref = "rabbitMq" }
reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "reactorCore" }
reactor-test = { module = "io.projectreactor:reactor-test", version.ref = "reactorCore" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
slf4j-jcl = { module = "org.slf4j:jcl-over-slf4j", version.ref = "slf4j" }
spring-amqp-rabbitmq = "org.springframework.amqp:spring-rabbit:2.3.14"
spring-boot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springBoot" }
spring-boot-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springBoot" }

[plugins]
artifactory = { id = "com.jfrog.artifactory", version = "4.27.1" }
asciidoctor-convert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
asciidoctor-pdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading