mirror of
https://github.com/corda/corda.git
synced 2025-02-20 09:26:41 +00:00
All gradle plugins can now be published with the publishing plugin.
This commit is contained in:
parent
e751d80c00
commit
6ac7b9384d
@ -21,7 +21,7 @@ apply plugin: 'net.corda.plugins.publish-utils'
|
||||
|
||||
allprojects {
|
||||
version "$gradle_plugins_version"
|
||||
group 'net.corda'
|
||||
group 'net.corda.plugins'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -1,6 +1,12 @@
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
|
||||
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile gradleApi()
|
||||
@ -9,47 +15,3 @@ dependencies {
|
||||
compile "com.typesafe:config:1.3.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
cordformation(MavenPublication) {
|
||||
from components.java
|
||||
groupId 'net.corda.plugins'
|
||||
artifactId 'cordformation'
|
||||
|
||||
artifact sourceJar
|
||||
artifact javadocJar
|
||||
|
||||
pom.withXml {
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
name 'cordformation'
|
||||
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
|
||||
url 'https://github.com/corda/corda'
|
||||
scm {
|
||||
url 'https://github.com/corda/corda'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Apache-2.0'
|
||||
url 'https://www.apache.org/licenses/LICENSE-2.0'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'R3'
|
||||
name 'R3'
|
||||
email 'dev@corda.net'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import org.gradle.api.*
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.maven.MavenPom
|
||||
|
||||
/**
|
||||
* A utility plugin that when applied will automatically create source and javadoc publishing tasks
|
||||
@ -14,7 +16,84 @@ import org.gradle.api.Project
|
||||
* in BintrayConfigExtension.
|
||||
*/
|
||||
class PublishTasks implements Plugin<Project> {
|
||||
Project project
|
||||
|
||||
void apply(Project project) {
|
||||
this.project = project
|
||||
|
||||
createTasks()
|
||||
createExtensions()
|
||||
|
||||
def bintrayConfig = project.rootProject.extensions.findByName('bintrayConfig')
|
||||
if((bintrayConfig != null) && (bintrayConfig.publications)) {
|
||||
def publications = bintrayConfig.publications.findAll { it == project.name }
|
||||
println("HI")
|
||||
if(publications.size > 0) {
|
||||
project.logger.info("Configuring bintray for ${project.name}")
|
||||
project.configure(project) {
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
}
|
||||
def bintray = project.extensions.findByName("bintray")
|
||||
configureBintray(bintray, bintrayConfig)
|
||||
project.publishing.publications.create(project.name, MavenPublication) {
|
||||
from project.components.java
|
||||
groupId project.group
|
||||
artifactId project.name
|
||||
|
||||
artifact project.tasks.sourceJar
|
||||
artifact project.tasks.javadocJar
|
||||
|
||||
extendPomForMavenCentral(pom)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Maven central requires all of the below fields for this to be a valid POM
|
||||
void extendPomForMavenCentral(MavenPom pom) {
|
||||
pom.withXml {
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
name project.name
|
||||
description project.description
|
||||
url 'https://github.com/corda/corda'
|
||||
scm {
|
||||
url 'https://github.com/corda/corda'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Apache-2.0'
|
||||
url 'https://www.apache.org/licenses/LICENSE-2.0'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'R3'
|
||||
name 'R3'
|
||||
email 'dev@corda.net'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void configureBintray(def bintray, def bintrayConfig) {
|
||||
bintray.user = bintrayConfig.user
|
||||
bintray.key = bintrayConfig.key
|
||||
bintray.publications = [ project.name ]
|
||||
bintray.dryRun = bintrayConfig.dryRun ?: false
|
||||
bintray.pkg.repo = bintrayConfig.repo
|
||||
bintray.pkg.name = project.name
|
||||
bintray.pkg.userOrg = bintrayConfig.org
|
||||
bintray.pkg.licenses = bintrayConfig.licenses
|
||||
bintray.pkg.version.gpg.sign = bintrayConfig.gpgSign ?: false
|
||||
bintray.pkg.version.gpg.passphrase = bintrayConfig.gpgPassphrase
|
||||
}
|
||||
|
||||
void createTasks() {
|
||||
if(project.hasProperty('classes')) {
|
||||
project.task("sourceJar", type: Jar, dependsOn: project.classes) {
|
||||
classifier = 'sources'
|
||||
@ -28,28 +107,11 @@ class PublishTasks implements Plugin<Project> {
|
||||
from project.javadoc.destinationDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.extensions.create("bintrayConfig", BintrayConfigExtension)
|
||||
|
||||
def bintrayConfig = project.rootProject.extensions.findByName('bintrayConfig')
|
||||
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 = bintrayConfig.publications.findAll { it == project.name }
|
||||
bintray.dryRun = bintrayConfig.dryRun ?: false
|
||||
bintray.pkg.repo = bintrayConfig.repo
|
||||
bintray.pkg.name = project.name
|
||||
bintray.pkg.userOrg = bintrayConfig.org
|
||||
bintray.pkg.licenses = bintrayConfig.licenses
|
||||
bintray.pkg.version.gpg.sign = bintrayConfig.gpgSign ?: false
|
||||
bintray.pkg.version.gpg.passphrase = bintrayConfig.gpgPassphrase
|
||||
void createExtensions() {
|
||||
if(project == project.rootProject) {
|
||||
project.extensions.create("bintrayConfig", BintrayConfigExtension)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +1,14 @@
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
|
||||
dependencies {
|
||||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
}
|
||||
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
"quasar-utils"(MavenPublication) {
|
||||
from components.java
|
||||
groupId 'net.corda.plugins'
|
||||
artifactId 'quasar-utils'
|
||||
|
||||
artifact sourceJar
|
||||
artifact javadocJar
|
||||
|
||||
pom.withXml {
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
name 'quasar-utils'
|
||||
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
|
||||
url 'https://github.com/corda/corda'
|
||||
scm {
|
||||
url 'https://github.com/corda/corda'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Apache-2.0'
|
||||
url 'https://www.apache.org/licenses/LICENSE-2.0'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'R3'
|
||||
name 'R3'
|
||||
email 'dev@corda.net'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user