Skip to content

Commit 3835bee

Browse files
authored
build: use jreleaser for making release (#1635)
Signed-off-by: Bala.FA <[email protected]>
1 parent 9eba7a7 commit 3835bee

File tree

1 file changed

+161
-65
lines changed

1 file changed

+161
-65
lines changed

build.gradle

Lines changed: 161 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@
1919
/********************************/
2020

2121
plugins {
22-
id "com.github.johnrengelman.shadow" version "8.1.1"
23-
id "com.github.spotbugs" version "6.1.3"
24-
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
25-
id "com.diffplug.spotless" version "6.13.0"
22+
id 'com.github.johnrengelman.shadow' version '8.1.1'
23+
id 'com.github.spotbugs' version '6.1.3'
24+
id 'org.jreleaser' version '1.17.0'
25+
id 'com.diffplug.spotless' version '6.13.0'
2626
}
2727

28-
/*
29-
* Root project definitions
30-
*/
31-
apply plugin: 'io.github.gradle-nexus.publish-plugin'
28+
/* Root project definitions */
3229

3330
allprojects {
3431
group = 'io.minio'
@@ -41,34 +38,34 @@ allprojects {
4138
subprojects {
4239
apply plugin: 'java-library'
4340
apply plugin: 'com.github.spotbugs'
44-
apply plugin: "com.diffplug.spotless"
41+
apply plugin: 'com.diffplug.spotless'
4542

4643
repositories {
4744
mavenLocal()
4845
mavenCentral()
4946
}
5047

5148
dependencies {
52-
api "com.carrotsearch.thirdparty:simple-xml-safe:2.7.1"
53-
api "com.google.guava:guava:33.4.0-jre"
54-
api "com.squareup.okhttp3:okhttp:4.12.0"
55-
api "com.fasterxml.jackson.core:jackson-annotations:2.18.2"
56-
api "com.fasterxml.jackson.core:jackson-core:2.18.2"
57-
api "com.fasterxml.jackson.core:jackson-databind:2.18.2"
58-
api "org.bouncycastle:bcprov-jdk18on:1.80"
59-
api "org.apache.commons:commons-compress:1.27.1"
60-
api "commons-codec:commons-codec:1.18.0"
61-
api "org.xerial.snappy:snappy-java:1.1.10.7"
62-
compileOnly "com.github.spotbugs:spotbugs-annotations:4.8.6"
63-
64-
testImplementation "com.squareup.okhttp3:mockwebserver:4.12.0"
65-
testImplementation "junit:junit:4.13.2"
49+
api 'com.carrotsearch.thirdparty:simple-xml-safe:2.7.1'
50+
api 'com.google.guava:guava:33.4.0-jre'
51+
api 'com.squareup.okhttp3:okhttp:4.12.0'
52+
api 'com.fasterxml.jackson.core:jackson-annotations:2.18.2'
53+
api 'com.fasterxml.jackson.core:jackson-core:2.18.2'
54+
api 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
55+
api 'org.bouncycastle:bcprov-jdk18on:1.80'
56+
api 'org.apache.commons:commons-compress:1.27.1'
57+
api 'commons-codec:commons-codec:1.18.0'
58+
api 'org.xerial.snappy:snappy-java:1.1.10.7'
59+
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.6'
60+
61+
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
62+
testImplementation 'junit:junit:4.13.2'
6663
}
6764

6865
[compileJava, compileTestJava].each() {
6966
it.options.fork = true
70-
it.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:-options", "-Werror", "-Xdiags:verbose"]
71-
it.options.encoding = "UTF-8"
67+
it.options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation', '-Xlint:-options', '-Werror', '-Xdiags:verbose']
68+
it.options.encoding = 'UTF-8'
7269
}
7370

7471
spotbugs {
@@ -98,7 +95,7 @@ subprojects {
9895
}
9996

10097
task localeTest(type: Test) {
101-
description = "Runs tests with locale de.DE"
98+
description = 'Runs tests with locale de.DE'
10299
System.setProperty('user.language', 'de')
103100
System.setProperty('user.country', 'DE')
104101
systemProperties = System.properties
@@ -138,12 +135,12 @@ project(':api') {
138135

139136
jar {
140137
manifest {
141-
attributes('Implementation-Title': base.archivesName,
142-
'Implementation-Version': archiveVersion.get(),
143-
'Built-By': 'MinIO, inc',
144-
'Built-JDK': System.getProperty('java.version'),
145-
'Source-Compatibility': sourceCompatibility,
146-
'Target-Compatibility': targetCompatibility)
138+
attributes('Implementation-Title': base.archivesName.get(),
139+
'Implementation-Version': archiveVersion.get(),
140+
'Built-By': 'MinIO, inc',
141+
'Built-JDK': System.getProperty('java.version'),
142+
'Source-Compatibility': sourceCompatibility,
143+
'Target-Compatibility': targetCompatibility)
147144
}
148145
}
149146

@@ -174,10 +171,17 @@ project(':api') {
174171
archives javadocJar, sourcesJar, shadowJar
175172
}
176173

174+
tasks.withType(Jar) { task ->
175+
task.doLast {
176+
ant.checksum algorithm: 'md5', file: it.archivePath
177+
ant.checksum algorithm: 'sha1', file: it.archivePath
178+
}
179+
}
180+
177181
publishing {
178182
publications {
179-
mavenJava(MavenPublication) {
180-
artifactId = base.archivesName
183+
minioJava(MavenPublication) {
184+
artifactId = base.archivesName.get()
181185
from components.java
182186
pom {
183187
name = 'minio'
@@ -209,22 +213,24 @@ project(':api') {
209213
}
210214
}
211215
}
212-
}
213216

214-
signing {
215-
if (project.properties.containsKey('signing.keyId')) {
216-
sign publishing.publications.mavenJava
217+
repositories {
218+
maven {
219+
name = 'LocalMavenWithChecksums'
220+
url = uri(layout.buildDirectory.dir('staging-deploy'))
221+
}
222+
223+
maven {
224+
name = 'PreDeploy'
225+
url = uri(layout.buildDirectory.dir('pre-deploy'))
226+
}
217227
}
218228
}
219229

220-
nexusPublishing {
221-
packageGroup = group
222-
repositories {
223-
sonatype {
224-
stagingProfileId = '9b746c9f8abc1'
225-
username = project.properties['nexusUsername']
226-
password = project.properties['nexusPassword']
227-
}
230+
signing {
231+
setRequired {
232+
gradle.taskGraph.allTasks.any { it.name.contains('LocalMavenWithChecksums') }
233+
sign publishing.publications.minioJava
228234
}
229235
}
230236
}
@@ -242,18 +248,18 @@ project(':adminapi') {
242248

243249
dependencies {
244250
api project(':api')
245-
api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2"
251+
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
246252
testImplementation project(':api')
247253
}
248254

249255
jar {
250256
manifest {
251-
attributes('Implementation-Title': base.archivesName,
252-
'Implementation-Version': archiveVersion.get(),
253-
'Built-By': 'MinIO, inc',
254-
'Built-JDK': System.getProperty('java.version'),
255-
'Source-Compatibility': sourceCompatibility,
256-
'Target-Compatibility': targetCompatibility)
257+
attributes('Implementation-Title': base.archivesName.get(),
258+
'Implementation-Version': archiveVersion.get(),
259+
'Built-By': 'MinIO, inc',
260+
'Built-JDK': System.getProperty('java.version'),
261+
'Source-Compatibility': sourceCompatibility,
262+
'Target-Compatibility': targetCompatibility)
257263
}
258264
}
259265

@@ -284,10 +290,17 @@ project(':adminapi') {
284290
archives javadocJar, sourcesJar, shadowJar
285291
}
286292

293+
tasks.withType(Jar) { task ->
294+
task.doLast {
295+
ant.checksum algorithm: 'md5', file: it.archivePath
296+
ant.checksum algorithm: 'sha1', file: it.archivePath
297+
}
298+
}
299+
287300
publishing {
288301
publications {
289-
mavenJava(MavenPublication) {
290-
artifactId = base.archivesName
302+
minioJava(MavenPublication) {
303+
artifactId = base.archivesName.get()
291304
from components.java
292305
pom {
293306
name = 'minio'
@@ -319,22 +332,31 @@ project(':adminapi') {
319332
}
320333
}
321334
}
322-
}
323335

324-
signing {
325-
if (project.properties.containsKey('signing.keyId')) {
326-
sign publishing.publications.mavenJava
336+
repositories {
337+
maven {
338+
name = 'LocalMavenWithChecksums'
339+
url = uri(layout.buildDirectory.dir('staging-deploy'))
340+
}
341+
342+
maven {
343+
name = 'PreDeploy'
344+
url = uri(layout.buildDirectory.dir('pre-deploy'))
345+
}
327346
}
328347
}
329348

330-
nexusPublishing {
331-
packageGroup = group
349+
signing {
350+
setRequired {
351+
gradle.taskGraph.allTasks.any { it.name.contains('LocalMavenWithChecksumsRepository') }
352+
sign publishing.publications.minioJava
353+
}
332354
}
333355
}
334356

335357
project(':examples') {
336358
dependencies {
337-
compileOnly "me.tongfei:progressbar:0.9.5"
359+
compileOnly 'me.tongfei:progressbar:0.9.5'
338360
compileOnly project(':api')
339361
}
340362

@@ -354,7 +376,7 @@ import org.gradle.internal.os.OperatingSystem;
354376

355377
project(':functional') {
356378
dependencies {
357-
implementation "junit:junit:4.13.2"
379+
implementation 'junit:junit:4.13.2'
358380
implementation project(':api')
359381
implementation project(':adminapi')
360382
}
@@ -394,10 +416,84 @@ project(':functional') {
394416
ext.region = rootProject.properties['region']
395417
}
396418

397-
maxHeapSize = "4096m"
398-
jvmArgs "-Xms256m"
419+
maxHeapSize = '4096m'
420+
jvmArgs '-Xms256m'
399421
if (rootProject.hasProperty('endpoint')) {
400422
args = [ext.endpoint, ext.accessKey, ext.secretKey, ext.region]
401423
}
402424
}
403425
}
426+
427+
jreleaser {
428+
project {
429+
copyright = 'MinIO Inc.'
430+
description = 'MinIO Java SDK for Amazon S3 Compatible Cloud Storage'
431+
}
432+
433+
signing {
434+
active = 'ALWAYS'
435+
armored = true
436+
mode = 'FILE'
437+
}
438+
439+
deploy {
440+
maven {
441+
nexus2 {
442+
'maven-central' {
443+
stagingProfileId = '9b746c9f8abc1'
444+
active = 'ALWAYS'
445+
url = 'https://oss.sonatype.org/service/local'
446+
snapshotUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
447+
closeRepository = true
448+
releaseRepository = true
449+
stagingRepository('api/build/pre-deploy')
450+
}
451+
}
452+
}
453+
maven {
454+
nexus2 {
455+
'maven-central' {
456+
stagingProfileId = '9b746c9f8abc1'
457+
active = 'ALWAYS'
458+
url = 'https://oss.sonatype.org/service/local'
459+
snapshotUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
460+
closeRepository = true
461+
releaseRepository = true
462+
stagingRepository('adminapi/build/pre-deploy')
463+
}
464+
}
465+
}
466+
// For newly created repositories
467+
// maven {
468+
// mavenCentral {
469+
// sonatype {
470+
// applyMavenCentralRules = true
471+
// active = 'ALWAYS'
472+
// url = 'https://central.sonatype.com/api/v1/publisher'
473+
// username = findProperty('nexusUsername') ?: System.getenv('NEXUS_USERNAME')
474+
// password = findProperty('nexusPassword') ?: System.getenv('NEXUS_PASSWORD')
475+
// stagingRepository('api/build/pre-deploy')
476+
// }
477+
// }
478+
// }
479+
//
480+
// maven {
481+
// mavenCentral {
482+
// sonatype {
483+
// applyMavenCentralRules = true
484+
// active = 'ALWAYS'
485+
// url = 'https://central.sonatype.com/api/v1/publisher'
486+
// username = findProperty('nexusUsername') ?: System.getenv('NEXUS_USERNAME')
487+
// password = findProperty('nexusPassword') ?: System.getenv('NEXUS_PASSWORD')
488+
// stagingRepository('adminapi/build/pre-deploy')
489+
// }
490+
// }
491+
// }
492+
}
493+
494+
release {
495+
github {
496+
enabled = false
497+
}
498+
}
499+
}

0 commit comments

Comments
 (0)