-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use
gradle-maven-publish-plugin
as it creates staging repository it…
…self and doesn't rely on auto-staging (#273)
- Loading branch information
Showing
6 changed files
with
56 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,96 +14,54 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
val githubUsername: String? by project | ||
val githubPassword: String? by project | ||
|
||
val sonatypeUsername: String? by project | ||
val sonatypePassword: String? by project | ||
|
||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
import com.vanniktech.maven.publish.* | ||
|
||
// TODO: refactor publication a bit, so that version in gradle.properties will not contain SNAPSHOT | ||
val versionSuffix = providers.gradleProperty("rsocketbuild.versionSuffix").orNull | ||
if (versionSuffix != null) { | ||
val versionString = project.version.toString() | ||
require(versionString.endsWith("-SNAPSHOT")) | ||
project.version = versionString.replace("-", "-${versionSuffix}-") | ||
println("Current version: ${project.version}") | ||
plugins { | ||
id("com.vanniktech.maven.publish.base") | ||
} | ||
|
||
// empty javadoc for maven central | ||
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } | ||
|
||
// this is somewhat a hack because we have a single javadoc artifact which is used for all publications | ||
tasks.withType<Sign>().configureEach { dependsOn(javadocJar) } | ||
tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(tasks.withType<Sign>()) } | ||
mavenPublishing { | ||
publishToMavenCentral(SonatypeHost.S01) | ||
signAllPublications() | ||
|
||
publishing { | ||
publications.withType<MavenPublication> { | ||
artifact(javadocJar) | ||
pom { | ||
name.set(project.name) | ||
description.set(provider { | ||
checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" } | ||
}) | ||
url.set("http://rsocket.io") | ||
pom { | ||
name.set(project.name) | ||
description.set(provider { | ||
checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" } | ||
}) | ||
url.set("https://rsocket.io") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("whyoleg") | ||
name.set("Oleg Yukhnevich") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("OlegDokuka") | ||
name.set("Oleh Dokuka") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("https://github.com/rsocket/rsocket-kotlin.git") | ||
developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git") | ||
url.set("https://github.com/rsocket/rsocket-kotlin") | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
// TODO: drop github and use sonatype (?) | ||
maven { | ||
name = "github" | ||
url = uri("https://maven.pkg.github.com/rsocket/rsocket-kotlin") | ||
credentials { | ||
username = githubUsername | ||
password = githubPassword | ||
developers { | ||
developer { | ||
id.set("whyoleg") | ||
name.set("Oleg Yukhnevich") | ||
email.set("[email protected]") | ||
} | ||
} | ||
maven { | ||
name = "sonatype" | ||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
developer { | ||
id.set("OlegDokuka") | ||
name.set("Oleh Dokuka") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("https://github.com/rsocket/rsocket-kotlin.git") | ||
developerConnection.set("https://github.com/rsocket/rsocket-kotlin.git") | ||
url.set("https://github.com/rsocket/rsocket-kotlin") | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
isRequired = sonatypeUsername != null && sonatypePassword != null | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign(publishing.publications) | ||
} | ||
// javadocJar setup | ||
// we have a single javadoc artifact which is used for all publications, | ||
// and so we need to manually create task dependencies to make Gradle happy | ||
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } | ||
tasks.withType<Sign>().configureEach { dependsOn(javadocJar) } | ||
tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(tasks.withType<Sign>()) } | ||
publishing.publications.withType<MavenPublication>().configureEach { artifact(javadocJar) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters