Publish utils no longer needs a configuration block per project, just one bintray configuration per project providing it fits certain criteria.

This commit is contained in:
Clinton Alexander 2016-12-02 12:00:25 +00:00
parent 4eb7d3db11
commit 46ddd3bd0e
6 changed files with 8 additions and 35 deletions

View File

@ -36,6 +36,7 @@ bintrayConfig {
licenses = ['Apache-2.0']
gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['cordformation', 'quasar-utils']
}
// Aliasing the publishToMavenLocal for simplicity.

View File

@ -13,12 +13,6 @@ repositories {
mavenCentral()
}
bintrayPublish {
name = 'cordformation'
publications = ['cordformation']
dryRun = false
}
publishing {
publications {
cordformation(MavenPublication) {

View File

@ -8,4 +8,6 @@ class BintrayConfigExtension {
String[] licenses
Boolean gpgSign
String gpgPassphrase
String[] publications
Boolean dryRun
}

View File

@ -1,7 +0,0 @@
package net.corda.plugins
class BintrayPublishExtension {
String name
Boolean dryRun
String[] publications
}

View File

@ -27,33 +27,22 @@ class PublishTasks implements Plugin<Project> {
}
project.extensions.create("bintrayConfig", BintrayConfigExtension)
project.extensions.create("bintrayPublish", BintrayPublishExtension)
def bintrayValues = project.extensions.findByName("bintrayPublish")
def bintrayConfig = project.rootProject.extensions.findByName('bintrayConfig')
if((bintrayConfig != null) && (bintrayValues != null)) {
// TODO AM:
// Problem 1. Bootstrapping - do not want root to depend on this project
// Problem 2. This project's extension is not available here
// Problem 3. Bintray's extension is already configured after evaluation
// Possible solutions:
// name: project.name
// publications: project.name (make it a forced convention)
// dryRun: move to root.
// Problem 4: Root project therefore cannot be published
// Solution: Why use this plugin if you only have a root project?
if((bintrayConfig != null) && (bintrayConfig.publications)) {
project.configure(project) {
apply plugin: 'com.jfrog.bintray'
}
def bintray = project.extensions.findByName("bintray")
println(bintrayConfig.publications.findAll { it == project.name })
project.logger.info("Configuring bintray for ${project.name}")
bintray.user = bintrayConfig.user
bintray.key = bintrayConfig.key
bintray.publications = bintrayValues.publications
bintray.dryRun = bintrayValues.dryRun ?: false
bintray.publications = bintrayConfig.publications.findAll { it == project.name }
bintray.dryRun = bintrayConfig.dryRun ?: false
bintray.pkg.repo = bintrayConfig.repo
bintray.pkg.name = bintrayValues.name ?: project.name
bintray.pkg.name = project.name
bintray.pkg.userOrg = bintrayConfig.org
bintray.pkg.licenses = bintrayConfig.licenses
bintray.pkg.version.gpg.sign = bintrayConfig.gpgSign ?: false

View File

@ -11,12 +11,6 @@ repositories {
mavenCentral()
}
bintrayPublish {
name = 'quasar-utils'
publications = ['quasarUtils']
dryRun = false
}
publishing {
publications {
quasarUtils(MavenPublication) {