Permalink
Browse files

update gradle to 2.13. removed nebula-publishing plugin.

* fixed publishing with local signing (jars and pom) and upload to bintray

  This is a way to complicated. nebula publishing dropped the signing stuff after
  bintray makes it possible to sign the artifacts automatically with their key or
  with a private/public keypair linked and stored within the repository.

  See nebula-plugins/nebula-publishing-plugin#61 and
  https://bintray.com/docs/usermanual/uploads/uploads_gpgsigning.html

* add singned pom to publication only if not skipped.

* set name and description for pom

* fallback to buildscript block to apply plugins only to the subprojects
  • Loading branch information...
1 parent 5e5cfaf commit 1bdc3b4e861ee9ebde16b3faf0640945135dfe94 @ancho ancho committed May 23, 2016
@@ -1,15 +1,17 @@
+apply plugin: 'application'
+
dependencies {
compile project(':asciidoctorj')
compile project(':asciidoctorj-diagram')
compile project(':asciidoctorj-epub3')
compile project(':asciidoctorj-pdf')
}
-// we're creating a dist, not a jar, silly Gradle
jar.enabled = false
-configurations.all { artifacts.clear() }
-apply plugin: 'application'
+configurations.all {
+ artifacts.clear()
+}
tasks.withType(AbstractArchiveTask) {
baseName rootProject.name
View
@@ -1,27 +1,26 @@
-// legacy plugins config; necessary to accomodate Java 6
+/*
+ adding the plugin jars to the classpath to apply them later.
+ currently the new plugins DSL does apply them directly.
+ there are other limitations too. See https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block
+ we don't need to apply the jruby and bintray plugin on the rootProject.
+*/
buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- if (JavaVersion.current().isJava7Compatible()) {
- classpath 'com.netflix.nebula:nebula-publishing-plugin:2.0.0'
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath "com.github.jruby-gradle:jruby-gradle-plugin:0.1.17"
+ classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6"
}
- }
-}
-
-// modern plugins config
-plugins {
- id 'com.github.jruby-gradle.base' version '0.1.17'
- // Adding the nebula-publishing plugin when using JDK6 causes the build to abort
- //id 'nebula.nebula-publishing' version '2.0.0'
- id 'com.jfrog.bintray' version '1.0'
}
// TIP use -PpublishRelease=true to active release behavior regardless of the version
status = project.hasProperty('publishRelease') && project.publishRelease.toBoolean() ?
'release' : ((version == 'unspecified' || version.endsWith('-SNAPSHOT')) ? 'snapshot' : 'release')
+// using ExpandoMetaClass to add isDistribution() Method to Project instances...
+Project.metaClass.isDistribution = { delegate.getName().endsWith("-distribution") }
+
ext {
buildDateTime = new Date()
(buildDateOnly, buildTimeOnly) = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSSZ').format(buildDateTime).split(' ')
@@ -64,6 +63,10 @@ subprojects {
// NOTE applying Java plugin changes the status; take steps to preserve value
def _status = status
apply plugin: 'java'
+ if (JavaVersion.current().isJava7Compatible()) {
+ apply from: rootProject.file('gradle/publish.gradle')
+ apply from: rootProject.file('gradle/deploy.gradle')
+ }
status = _status
// NOTE sourceCompatibility & targetCompatibility are set in gradle.properties to meet requirements of Gradle
@@ -74,31 +77,10 @@ subprojects {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
- // QUESTION can we switch to jcenter() only?
- mavenCentral()
- maven {
- name 'rubygems-release'
- url 'http://rubygems-proxy.torquebox.org/releases'
- }
- maven {
- name 'rubygems-prerelease'
- url 'http://rubygems-proxy.torquebox.org/prereleases'
- }
- }
- plugins.withType(JavaPlugin) {
-
- project.tasks.withType(JavaCompile) { task ->
- task.sourceCompatibility = project.sourceCompatibility
- task.targetCompatibility = project.targetCompatibility
- }
-
- project.tasks.withType(GroovyCompile) { task ->
- task.sourceCompatibility = project.sourceCompatibility
- task.targetCompatibility = project.targetCompatibility
- }
+ jcenter()
}
-
+
dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
@@ -128,7 +110,21 @@ subprojects {
}
// apply JRuby and sources/javadocs packaging stuff for all subprojects except the distribution
-configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
+configure(subprojects.findAll { !it.isDistribution() }) {
+
+ apply plugin: 'com.github.jruby-gradle.base'
+ apply from: rootProject.file('gradle/eclipse.gradle')
+
+ repositories {
+ maven {
+ name 'rubygems-release'
+ url 'http://rubygems-proxy.torquebox.org/releases'
+ }
+ maven {
+ name 'rubygems-prerelease'
+ url 'http://rubygems-proxy.torquebox.org/prereleases'
+ }
+ }
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
@@ -154,8 +150,6 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
archives sourcesJar, javadocJar
}
- apply plugin: 'com.github.jruby-gradle.base'
-
jruby {
defaultRepositories = false
defaultVersion = jrubyVersion
@@ -166,22 +160,4 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
// QUESTION is this the right place to insert this task dependency in the lifecycle?
// IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows
processResources.dependsOn jrubyPrepareGems
-
- apply from: rootProject.file('gradle/eclipse.gradle')
- if (JavaVersion.current().isJava7Compatible()) {
- apply from: rootProject.file('gradle/publish.gradle')
- }
-}
-
-subprojects {
- if (JavaVersion.current().isJava7Compatible()) {
- apply from: rootProject.file('gradle/sign.gradle')
- apply from: rootProject.file('gradle/deploy.gradle')
- }
-}
-
-// disable bintrayUpload on root project to prevent build from failing
-// NOTE seems to only get added when we use the modern plugin syntax
-if (tasks.findByName('bintrayUpload')) {
- bintrayUpload.enabled = false
}
View
@@ -3,32 +3,18 @@ apply plugin: 'com.jfrog.bintray'
bintray {
user = System.env['BINTRAY_USER'] ?: (project.hasProperty('bintrayUsername') ? project.bintrayUsername : '')
key = System.env['BINTRAY_KEY'] ?: (project.hasProperty('bintrayApiKey') ? project.bintrayApiKey : '')
- if (project.name.endsWith('-distribution')) {
- // NOTE ignore warning that install task does not exist; the plugin is looking for the wrong task!!
- configurations = ['archives']
- // FIXME asc for distribution zip doesn't get added by nebula-sign
- // NOTE it is added by normal signing plugin, but .asc extension replaces the archive extension instead of being appended to it
- filesSpec {
- def distsDir = "${project.buildDir}/${project.distsDirName}"
- // ideally, this is: from project.tasks.signJars.getSignatureFiles()
- // FIXME WTF??? <flips table>
- // NOTE we have to plant a placeholder so filesSpec resolves the location of the signature file during the initialization phase
- file(distsDir).mkdirs()
- // QUESTION can we use the archivePath property of the distPath to get this location?
- file("$distsDir/${project(':asciidoctorj').name}-${project.version}-bin.zip.asc").createNewFile()
- from(distsDir) { include '*.asc' }
- into "${project.group.replace('.', '/')}/${project(':asciidoctorj').name}/${project.version}"
- }
- }
- else {
- publications = ['mavenNebula']
+
+ if ( !project.isDistribution() ) {
+ publications = ['jars']
}
+ configurations = ['archives']
+
dryRun = project.hasProperty('dryRun') && project.dryRun.toBoolean()
publish = project.statusIsRelease
pkg {
repo = System.env['BINTRAY_REPO'] ?: (project.hasProperty('bintrayRepo') ? project.bintrayRepo : 'maven')
- if (!project.hasProperty('bintrayPersonal') || !project.bintrayPrivate.toBoolean()) {
+ if (!project.hasProperty('bintrayPersonal')) {
userOrg = 'asciidoctor'
}
@@ -62,4 +48,5 @@ bintray {
}
}
-bintrayUpload.dependsOn preparePublish
+bintrayUpload.dependsOn build
+bintrayUpload.dependsOn signPom
Oops, something went wrong.

0 comments on commit 1bdc3b4

Please sign in to comment.