push signing of artifacts into the main build instead of the groovy-release 
repo (tweaks)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/0b18edae
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0b18edae
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0b18edae

Branch: refs/heads/parrot
Commit: 0b18edae3ee9f1d97a08b5f0f1a4b9eb7938067b
Parents: bd4e2c7
Author: paulk <pa...@asert.com.au>
Authored: Fri Jan 6 10:27:11 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:04:13 2017 +1000

----------------------------------------------------------------------
 build.gradle          |  1 +
 gradle/signing.gradle |  1 +
 gradle/upload.gradle  | 95 ++++++++++++++++++++++++----------------------
 3 files changed, 51 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/0b18edae/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 455edc2..79922b2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -73,6 +73,7 @@ indyBanner()
 //apply plugin: 'antlr'
 
 ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
+ext.shouldSign = isReleaseVersion
 
 allprojects {
     apply plugin: 'java'

http://git-wip-us.apache.org/repos/asf/groovy/blob/0b18edae/gradle/signing.gradle
----------------------------------------------------------------------
diff --git a/gradle/signing.gradle b/gradle/signing.gradle
index 89c3a01..2885163 100644
--- a/gradle/signing.gradle
+++ b/gradle/signing.gradle
@@ -32,6 +32,7 @@ allprojects {
 gradle.taskGraph.whenReady { taskGraph ->
     if (taskGraph.allTasks.any { it instanceof Sign } || 
project.hasProperty('forceSign')) {
         // Use Java 6's console or Swing to read input (not suitable for CI)
+        project.ext.shouldSign = true
         if (!project.hasProperty('signing.keyId') ||
                 !project.hasProperty('signing.secretKeyRingFile') ||
                 !project.hasProperty('signing.password')) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/0b18edae/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 633df89..5668454 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -31,7 +31,6 @@ def removeJarjaredDependencies = { p ->
     })
 }
 
-
 allprojects {
     apply plugin: 'maven'
     apply from: "${rootProject.projectDir}/gradle/pomconfigurer.gradle"
@@ -60,16 +59,13 @@ allprojects {
         }
     }
 
-    configurations {
-        deployerJars
-    }
-
     uploadArchives {
         repositories {
             mavenDeployer {
-                configuration = configurations.deployerJars
                 pom pomConfigureClosure
-                beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+                if (shouldSign) {
+                    beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+                }
             }
         }
     }
@@ -78,7 +74,9 @@ allprojects {
         repositories {
             mavenInstaller {
                 pom pomConfigureClosure
-                beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+                if (shouldSign) {
+                    beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+                }
             }
         }
     }
@@ -112,17 +110,19 @@ allprojects {
 
     install {
         doFirst {
-            signArchiveTask(jar)
-            signArchiveTask(sourceJar)
-            signArchiveTask(javadocJar)
-            signArchiveTask(groovydocJar)
-            def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
-            if (indyJar.exists()) {
-                signWithClassifier('indy', indyJar)
-            }
-            def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 
'grooid')
-            if (grooidJar.exists()) {
-                signWithClassifier('grooid', grooidJar)
+            if (shouldSign) {
+                signArchiveTask(jar)
+                signArchiveTask(sourceJar)
+                signArchiveTask(javadocJar)
+                signArchiveTask(groovydocJar)
+                def indyJar = rootProject.ext.deriveFile(jar.archivePath, 
'indy')
+                if (indyJar.exists()) {
+                    signWithClassifier('indy', indyJar)
+                }
+                def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 
'grooid')
+                if (grooidJar.exists()) {
+                    signWithClassifier('grooid', grooidJar)
+                }
             }
         }
     }
@@ -168,33 +168,35 @@ allprojects {
 
 install {
     doFirst {
-        signArchiveTask(jarAll)
-        signArchiveTask(sourceAllJar)
-        signArchiveTask(javadocAllJar)
-        signArchiveTask(groovydocAllJar)
-        signArchiveTask(distBin)
-
-        // next three are done as a side effect since it was the easiest 
approach
-        signing.sign(distSrc.archivePath)
-        signing.sign(distDoc.archivePath)
-        signing.sign(dist.archivePath)
-
-        tasks.withType(Jar).matching { it.name.startsWith('backport') }.each { 
t ->
-            signing.sign(t.classifier, t.archivePath)
-            project.artifacts.add('archives', new File(t.destinationDir, 
t.archiveName + '.asc')) {
-                name = t.baseName
-                classifier = t.classifier
-                type = t.extension + '.asc'
+        if (shouldSign) {
+            signArchiveTask(jarAll)
+            signArchiveTask(sourceAllJar)
+            signArchiveTask(javadocAllJar)
+            signArchiveTask(groovydocAllJar)
+            signArchiveTask(distBin)
+
+            // next three are done as a side effect since it was the easiest 
approach
+            signing.sign(distSrc.archivePath)
+            signing.sign(distDoc.archivePath)
+            signing.sign(dist.archivePath)
+
+            tasks.withType(Jar).matching { it.name.startsWith('backport') 
}.each { t ->
+                signing.sign(t.classifier, t.archivePath)
+                project.artifacts.add('archives', new File(t.destinationDir, 
t.archiveName + '.asc')) {
+                    name = t.baseName
+                    classifier = t.classifier
+                    type = t.extension + '.asc'
+                }
             }
-        }
 
-        def indyJar = deriveFile(jarAll.archivePath, 'indy')
-        if (indyJar.exists()) {
-            signWithClassifier('indy', indyJar)
-        }
-        def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
-        if (grooidJar.exists()) {
-            signWithClassifier('grooid', grooidJar)
+            def indyJar = deriveFile(jarAll.archivePath, 'indy')
+            if (indyJar.exists()) {
+                signWithClassifier('indy', indyJar)
+            }
+            def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
+            if (grooidJar.exists()) {
+                signWithClassifier('grooid', grooidJar)
+            }
         }
     }
 }
@@ -257,7 +259,9 @@ ext.pomAll = {
         p.dependencies.clear()
     }
 
-    beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+    if (shouldSign) {
+        beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }
+    }
 }
 
 install {
@@ -275,4 +279,3 @@ uploadArchives {
         mavenDeployer pomAll
     }
 }
-

Reply via email to