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

Commit 92fd34c

Browse files
committed
[build] Backport rest of master build-related improvements (see #127)
Complements the partial backport done in 9b7b6b8 with other changes to the build (Gradle version, switching to maven-publish, artifactory) Cherry-pick of 04fd411, 39d991a, 6483214, cf3056f, 65124c8, 0dbfeba and 35e0ae7. - [build] Bump/polish Gradle, add maven-publish and artifactory (#115) - bumped Gradle to 5.6.4 - removed propdeps (no optional dependency anyway) - removed outdated wrapper tasks and variables - externalized $reactorCoreVersion to `gradle.properties` - applied `setup.gradle` from inside configure(allProjects) - now applies `maven-publish` and `artifactory` plugins - removed useless `classpath` printing task - modified how the pdf is renamed when zipping docs (so that it is renamed late and can pick up a custom version) - minor polish of deprecated constructs / warnings - [build] Add releaser.gradle with groupId helper task (#115) - [build] Ensure rootProject.name is reactor-rabbitmq - Conditionnally add mavenLocal when releaser script is applied (#117) This is only activated when passing a non-false -PreleaserDryRun to Gradle. - fix #119 Ensure docsZip defines a -docs classifier - [build] Add bumpVersionsInReadme, better Artifactory creds, buildId - Added a bumpVersionsInReadme task that needs to be explicitly executed with oldVersion, currentVersion and nextVersion properties - For Artifactory, we declare an explicit credentials block using alternate properties like artifactory_publish_xxx, that can be set via an env var of the form ORG_GRADLE_PROJECT_artifactory_publish_xxx. - We give the build info a meaningful name and id and ensure we don't publish environment variables. - [build] Fix Bamboo publications by removing onlyIf clause
1 parent 9b7b6b8 commit 92fd34c

File tree

7 files changed

+94
-104
lines changed

7 files changed

+94
-104
lines changed

build.gradle

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ buildscript {
1919
maven { url "https://repo.spring.io/plugins-release" }
2020
}
2121
dependencies {
22-
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11',
23-
'io.spring.gradle:propdeps-plugin:0.0.9.RELEASE'
22+
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11'
2423
}
2524
}
2625
plugins {
2726
id 'org.asciidoctor.convert' version '1.5.6'
2827
id 'me.champeau.gradle.jmh' version '0.4.7'
28+
id "com.jfrog.artifactory" version "4.9.8" apply false
2929
}
3030

3131
ext {
3232
gradleScriptDir = "${rootProject.projectDir}/gradle"
3333

34-
reactorCoreVersion = "3.2.13.BUILD-SNAPSHOT"
35-
3634
// Logging
3735
slf4jVersion = '1.7.26'
3836
logbackVersion = '1.2.3'
@@ -57,9 +55,8 @@ ext {
5755
"https://rabbitmq.github.io/rabbitmq-java-client/api/current/",] as String[]
5856
}
5957

60-
apply from: "$gradleScriptDir/setup.gradle"
61-
apply from: "$gradleScriptDir/releaser.gradle"
6258
apply from: "$gradleScriptDir/doc.gradle"
59+
apply from: "$gradleScriptDir/releaser.gradle"
6360

6461
configurations.all {
6562
// check for snapshot updates every time
@@ -79,8 +76,8 @@ configure(allprojects) { project ->
7976
apply plugin: 'maven'
8077
apply plugin: 'eclipse'
8178
apply plugin: 'idea'
82-
apply plugin: 'propdeps'
8379
apply plugin: 'java'
80+
apply from: "$gradleScriptDir/setup.gradle"
8481

8582
sourceCompatibility = targetCompatibility = 1.8
8683

@@ -133,7 +130,7 @@ configure(rootProject) {
133130
jar {
134131
manifest {
135132
attributes("Automatic-Module-Name": "reactor.rabbitmq",
136-
"Implementation-Version": version)
133+
"Implementation-Version": project.version)
137134
}
138135
}
139136

@@ -142,12 +139,8 @@ configure(rootProject) {
142139
systemProperty 'rabbitmqctl.bin', System.getProperty('rabbitmqctl.bin') ?: 'sudo rabbitmqctl'
143140
}
144141

145-
artifacts {
146-
archives sourcesJar
147-
archives javadocJar
148-
archives docsZip
149-
}
150-
142+
//add specific task artifacts to the publication
143+
publishing.publications.mavenJava.artifact(docsZip)
151144
}
152145

153146
project(':reactor-rabbitmq-samples') {
@@ -179,18 +172,7 @@ project(':reactor-rabbitmq-samples') {
179172
classpath = sourceSets.main.runtimeClasspath
180173
}
181174

182-
task classpath {
183-
doLast {
184-
println sourceSets.main.runtimeClasspath.asPath
185-
}
186-
}
187-
188175
test {
189176
useJUnitPlatform()
190177
}
191-
192-
artifacts {
193-
archives sourcesJar
194-
archives javadocJar
195-
}
196178
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
version=1.2.1.BUILD-SNAPSHOT
2+
reactorCoreVersion=3.2.13.BUILD-SNAPSHOT

gradle/doc.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,18 @@ configure(rootProject) {
6363
stylesheet: 'golo.css',
6464
appversion: "$version",
6565
'source-highlighter': 'coderay'
66-
67-
doLast {
68-
file("$outputDir/pdf/index.pdf").
69-
renameTo("$outputDir/pdf/rabbitmq-reference-guide-${version}.pdf")
70-
}
7166
}
67+
7268
task docsZip(type: Zip, dependsOn: asciidoctor) {
73-
baseName = 'reactor-rabbitmq-docs'
74-
from("$buildDir/asciidoc/pdf/reactor-rabbitmq-reference-guide-${version}.pdf") { into("docs/") }
69+
archiveBaseName.set('reactor-rabbitmq')
70+
archiveClassifier.set('docs')
71+
afterEvaluate() {
72+
//we copy the pdf late, when a potential customVersion has been applied to rootProject
73+
from("$buildDir/asciidoc/pdf/index.pdf") {
74+
into ("docs/")
75+
rename("index.pdf", "reactor-rabbitmq-reference-guide-${rootProject.version}.pdf")
76+
}
77+
}
7578
from("$buildDir/asciidoc/html5/index.html") { into("docs/") }
7679
from("$buildDir/asciidoc/html5/images") { into("images/") }
7780
}

gradle/setup.gradle

Lines changed: 72 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,85 +14,88 @@
1414
* limitations under the License.
1515
*/
1616

17-
wrapper {
18-
group = 'Project Setup'
19-
gradleVersion = "$gradleVersion"
20-
}
21-
22-
configure(allprojects) { project ->
23-
24-
apply plugin: 'propdeps-maven'
25-
apply plugin: 'maven'
26-
install {
27-
repositories.mavenInstaller {
28-
customizePom(pom, project)
29-
}
30-
}
31-
32-
jar {
33-
manifest.attributes["Created-By"] = "${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
34-
manifest.attributes["Implementation-Title"] = project.name
35-
manifest.attributes["Implementation-Version"] = project.version
36-
from '../NOTICE'
37-
}
17+
apply plugin: 'maven-publish'
18+
apply plugin: 'com.jfrog.artifactory'
3819

39-
task sourcesJar(type: Jar) {
40-
classifier = 'sources'
41-
from sourceSets.main.allSource
42-
from '../NOTICE'
43-
}
20+
jar {
21+
manifest.attributes["Created-By"] = "${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
22+
manifest.attributes["Implementation-Title"] = project.name
23+
manifest.attributes["Implementation-Version"] = project.version
24+
from '../NOTICE'
25+
}
4426

45-
task javadocJar(type: Jar) {
46-
classifier = 'javadoc'
47-
from javadoc
48-
from '../NOTICE'
49-
}
27+
task sourcesJar(type: Jar) {
28+
archiveClassifier.set('sources')
29+
from sourceSets.main.allSource
30+
from '../NOTICE'
5031
}
5132

52-
def customizePom(def pom, def gradleProject) {
53-
pom.whenConfigured { generatedPom ->
54-
// eliminate test-scoped dependencies (no need in maven central poms)
55-
generatedPom.dependencies.removeAll { dep ->
56-
dep.scope == "test"
57-
}
33+
task javadocJar(type: Jar) {
34+
archiveClassifier.set('javadoc')
35+
from javadoc
36+
from '../NOTICE'
37+
}
5838

59-
// sort to make pom dependencies order consistent to ease comparison of older poms
60-
generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
61-
"$dep.scope:$dep.groupId:$dep.artifactId"
62-
}
39+
publishing {
40+
publications {
41+
mavenJava(MavenPublication) {
42+
from components.java
43+
artifact sourcesJar
44+
artifact javadocJar
45+
//other project-specific artifacts are added to publication in each project's specific configuration
6346

64-
// add all items necessary for maven central publication
65-
generatedPom.project {
66-
name = gradleProject.description
67-
description = gradleProject.description
68-
url = 'https://github.com/reactor/reactor-rabbitmq'
69-
organization {
70-
name = 'reactor'
71-
url = 'https://github.com/reactor'
72-
}
73-
licenses {
74-
license {
75-
name 'The Apache Software License, Version 2.0'
76-
url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
77-
distribution 'repo'
47+
pom {
48+
afterEvaluate {
49+
name = project.description
50+
description = project.description
7851
}
79-
}
80-
scm {
52+
53+
packaging = 'jar' //if not explicitly set, end up as `pom` in output. omitted in output if set as `jar`...
54+
8155
url = 'https://github.com/reactor/reactor-rabbitmq'
82-
connection = 'scm:git:git://github.com/reactor/reactor-rabbitmq'
83-
developerConnection = 'scm:git:git://github.com/reactor/reactor-rabbitmq'
84-
}
85-
developers {
86-
developer {
87-
id = 'acogoluegnes'
88-
name = 'Arnaud Cogoluègnes'
89-
56+
organization {
57+
name = 'reactor'
58+
url = 'https://github.com/reactor'
59+
}
60+
licenses {
61+
license {
62+
name = 'The Apache Software License, Version 2.0'
63+
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
64+
distribution = 'repo'
65+
}
66+
}
67+
scm {
68+
url = 'https://github.com/reactor/reactor-rabbitmq'
69+
connection = 'scm:git:git://github.com/reactor/reactor-rabbitmq'
70+
developerConnection = 'scm:git:git://github.com/reactor/reactor-rabbitmq'
71+
}
72+
developers {
73+
developer {
74+
id = 'acogoluegnes'
75+
name = 'Arnaud Cogoluègnes'
76+
77+
}
78+
}
79+
issueManagement {
80+
system = "GitHub Issues"
81+
url = "https://github.com/reactor/reactor-rabbitmq/issues"
82+
}
83+
84+
withXml {
85+
//groovy magic incantation to sort dependencies alphabetically (scope/group/name..)
86+
def sorted = asNode().dependencies[0].children().collect().sort { it.scope.text() + it.groupId.text() + it.artifactId.text() }
87+
asNode().dependencies[0].children().with { deps ->
88+
deps.clear()
89+
sorted.each { deps.add(it) }
90+
}
9091
}
91-
}
92-
issueManagement {
93-
system = "GitHub Issues"
94-
url = "https://github.com/reactor/reactor-rabbitmq/issues"
9592
}
9693
}
9794
}
9895
}
96+
97+
artifactoryPublish {
98+
//don't activate the onlyIf clause below yet, so that Bamboo builds will publish stuff...
99+
//onlyIf { project.hasProperty("artifactory_publish_password") }
100+
publications(publishing.publications.mavenJava)
101+
}
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-5.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ if $darwin; then
109109
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110110
fi
111111

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
112+
# For Cygwin or MSYS, switch paths to Windows format before running java
113+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114114
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115115
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116116
JAVACMD=`cygpath --unix "$JAVACMD"`

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
rootProject.name = 'reactor-rabbitmq'
1617
include 'reactor-rabbitmq-samples'
1718

0 commit comments

Comments
 (0)