Prepare for publishing to bintray and maven central.

This commit is contained in:
Ilya Gorbunov
2017-04-01 07:02:50 +03:00
parent 4bc85f9c0e
commit c5e52b124b
+18 -6
View File
@@ -98,6 +98,9 @@ static def configurePublishing(Project project) {
apply plugin: 'maven'
apply plugin: 'signing'
project.ext['signing.keyId'] = project.properties['kotlin.key.name']
project.ext['signing.password'] = project.properties['kotlin.key.passphrase']
signing {
required { (project.properties["signingRequired"] ?: false) }
sign configurations.archives
@@ -114,14 +117,23 @@ static def configurePublishing(Project project) {
}
uploadArchives {
def properties = project.properties
Map<String, String> repositoryProviders = ['sonatype-nexus-staging' : 'sonatype', 'sonatype-nexus-snapshots' : 'sonatype']
String repo = properties['deploy-repo']
String repoProvider = repositoryProviders.get(repo, repo)
String repoUrl = properties["deployRepoUrl"] ?: properties["deploy-url"] ?: "file://${rootProject.buildDir}/repo"
String username = properties["deployRepoUsername"] ?: properties["kotlin.${repoProvider}.user"]
String password = properties["deployRepoPassword"] ?: properties["kotlin.${repoProvider}.password"]
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: project.properties["deployRepoUrl"] ?: "file://${rootProject.buildDir}/repo") {
authentication(
userName: project.properties["deployRepoUsername"],
password: project.properties["deployRepoPassword"]
)
beforeDeployment { MavenDeployment deployment ->
if (signing.required)
signing.signPom(deployment)
}
repository(url: repoUrl) {
authentication(userName: username, password: password)
}
pom.project {
name "${project.group}:${project.name}"