From 4ffd5b9c7f020b545f05042caf2ab49c30442b48 Mon Sep 17 00:00:00 2001 From: gordonmu <70778512+gordonmu@users.noreply.github.com> Date: Sat, 24 Apr 2021 21:58:38 +0200 Subject: [PATCH] setup maven central manual publish --- build.gradle | 19 +++------- gordonmu-coio-tls/build.gradle | 68 +++++++++++++++++++++++++--------- gordonmu-coio/build.gradle | 68 +++++++++++++++++++++++++--------- 3 files changed, 107 insertions(+), 48 deletions(-) diff --git a/build.gradle b/build.gradle index 3a392d0..4fd52be 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,6 @@ buildscript { ext.repos = { mavenLocal() mavenCentral() - jcenter() maven { url 'https://plugins.gradle.org/m2/' } @@ -36,7 +35,6 @@ buildscript { classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "$kotlin_version" classpath group: 'com.google.protobuf', name: 'protobuf-gradle-plugin', version: "$protobufgradle_version" classpath group: 'org.ysb33r.gradle', name: 'doxygen', version: "$doxygen_version" - classpath group: 'com.jfrog.bintray.gradle', name: 'gradle-bintray-plugin', version: '1.+' } if (project.hasProperty("executeAllTests") && project.findProperty("executeAllTests").toBoolean()) { @@ -44,10 +42,6 @@ buildscript { } } -if (!project.hasProperty('bintrayUser')) - ext.bintrayUser = '' -if (!project.hasProperty('bintrayApikey')) - ext.bintrayApikey = '' ext.pomConfig = { licenses { license { @@ -68,7 +62,7 @@ allprojects { apply plugin: 'kotlin' apply plugin: 'maven-publish' - group 'com.github.gordonmu.coio' + group 'io.github.gordonmu' version = '0.8.0' if (!project.hasProperty("release")) { version += '-SNAPSHOT' @@ -103,20 +97,17 @@ allprojects { useJUnitPlatform() } - javadoc.options.addStringOption('Xdoclint:none', '-quiet') - javadoc.failOnError = false task javadocJar(type: Jar, dependsOn: javadoc) { - from javadoc.destinationDir - archiveClassifier.set('javadoc') + archiveClassifier = 'javadoc' + from javadoc } task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' from sourceSets.main.allSource - archiveClassifier.set('sources') } artifacts { - archives sourcesJar - archives javadocJar + archives sourcesJar, javadocJar } } diff --git a/gordonmu-coio-tls/build.gradle b/gordonmu-coio-tls/build.gradle index 5e5f838..fdcf55f 100644 --- a/gordonmu-coio-tls/build.gradle +++ b/gordonmu-coio-tls/build.gradle @@ -1,5 +1,5 @@ -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' +apply plugin: 'maven' +apply plugin: 'signing' dependencies { implementation project(":gordonmu-coio") @@ -46,21 +46,55 @@ publishing { } } -bintray { - user = bintrayUser - key = bintrayApikey - publications = ['maven'] +if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) { + signing { + sign configurations.archives + } +} + +if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) { + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } - pkg { - repo = 'jvm' - name = project.name - description = 'A CoIO extension to use TLS over any CoIOStream.' - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/gordonmu/coio.git' - version { - name = project.version - desc = project.version - released = new Date() + pom.project { + name project.name + packaging 'jar' + // optionally artifactId can be defined here + description 'A CoIO extension to use TLS over any CoIOStream.' + url 'https://github.com/gordonmu/coio' + + scm { + connection 'scm:git:https://github.com/gordonmu/coio.git' + developerConnection 'scm:git:https://github.com/gordonmu/coio.git' + url 'https://github.com/gordonmu/coio' + } + + licenses { + license { + name 'The Apache License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + + developers { + developer { + id 'gordonmu' + name 'Gordon Mu' + email '70778512+gordonmu@users.noreply.github.com' + } + } + } + } } } -} \ No newline at end of file +} diff --git a/gordonmu-coio/build.gradle b/gordonmu-coio/build.gradle index e70c6cb..b9794a2 100644 --- a/gordonmu-coio/build.gradle +++ b/gordonmu-coio/build.gradle @@ -1,5 +1,5 @@ -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' +apply plugin: 'maven' +apply plugin: 'signing' dependencies { implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: "$kotlin_version" @@ -41,21 +41,55 @@ publishing { } } -bintray { - user = bintrayUser - key = bintrayApikey - publications = ['maven'] - - pkg { - repo = 'jvm' - name = project.name - description = 'A library for a simple coroutine IO API, wrapping efficient non-blocking Java IO libs for easy use.' - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/gordonmu/coio.git' - version { - name = project.version - desc = project.version - released = new Date() +if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) { + signing { + sign configurations.archives + } +} + +if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) { + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { + name project.name + packaging 'jar' + // optionally artifactId can be defined here + description 'A library for a simple coroutine IO API, wrapping efficient non-blocking Java IO libs for easy use.' + url 'https://github.com/gordonmu/coio' + + scm { + connection 'scm:git:https://github.com/gordonmu/coio.git' + developerConnection 'scm:git:https://github.com/gordonmu/coio.git' + url 'https://github.com/gordonmu/coio' + } + + licenses { + license { + name 'The Apache License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + + developers { + developer { + id 'gordonmu' + name 'Gordon Mu' + email '70778512+gordonmu@users.noreply.github.com' + } + } + } + } } } }