Prepare for publishing to bintray and maven central.
This commit is contained in:
+18
-6
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user