You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/01/06 05:11:16 UTC

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

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X a95ce9a7b -> ef6a187cb


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


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

Branch: refs/heads/GROOVY_2_4_X
Commit: ef6a187cbf487ce7d669e7f04e51941ecb4edcae
Parents: a95ce9a
Author: paulk <pa...@asert.com.au>
Authored: Fri Jan 6 15:11:01 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Jan 6 15:11:01 2017 +1000

----------------------------------------------------------------------
 build.gradle          | 23 ++++++-------
 gradle/signing.gradle | 31 ++++++++---------
 gradle/upload.gradle  | 85 +++++++++++++++++++++-------------------------
 3 files changed, 63 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ef6a187c/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 645c929..0ff13a7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -54,9 +54,6 @@ indyBanner()
 // TODO use antlr plugin
 //apply plugin: 'antlr'
 
-ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
-ext.shouldSign = isReleaseVersion
-
 allprojects {
     apply plugin: 'java'
 
@@ -152,6 +149,7 @@ ext {
     slf4jVersion = '1.7.6'
     xmlunitVersion = '1.5'
     xstreamVersion = '1.4.7'
+    isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
 }
 
 dependencies {
@@ -445,6 +443,15 @@ task checkCompatibility {
     }
 }
 
+if (!JavaVersion.current().java7Compatible) {
+    logger.lifecycle '''
+    **************************************** WARNING ********************************************
+    ******   You are running the build with an older JDK. NEVER try to release with 1.6.   ******
+    ******   You must use a JDK 1.7+ in order to compile all features of the language.     ******
+    *********************************************************************************************
+'''
+}
+
 apply from: 'gradle/test.gradle'
 apply from: 'gradle/groovydoc.gradle'
 apply from: 'gradle/docs.gradle'
@@ -454,21 +461,13 @@ apply from: 'gradle/idea.gradle'
 apply from: 'gradle/eclipse.gradle'
 apply from: 'gradle/codehaus.gradle'
 apply from: 'gradle/quality.gradle'
-apply from: 'gradle/signing.gradle'
 
 // If a local configuration file for tweaking the build is present, apply it
 if (file('user.gradle').exists()) {
     apply from: 'user.gradle'
 }
 
-if (!JavaVersion.current().java7Compatible) {
-    logger.lifecycle '''
-    **************************************** WARNING ********************************************
-    ******   You are running the build with an older JDK. NEVER try to release with 1.6.   ******
-    ******   You must use a JDK 1.7+ in order to compile all features of the language.     ******
-    *********************************************************************************************
-'''
-}
+apply from: 'gradle/signing.gradle'
 
 // UNCOMMENT THE FOLLOWING TASKS IF YOU WANT TO RUN LICENSE CHECKING
 //task licenseFormatCustom(type:nl.javadude.gradle.plugins.license.License) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/ef6a187c/gradle/signing.gradle
----------------------------------------------------------------------
diff --git a/gradle/signing.gradle b/gradle/signing.gradle
index 2885163..544c533 100644
--- a/gradle/signing.gradle
+++ b/gradle/signing.gradle
@@ -17,22 +17,20 @@
  *  under the License.
  */
 
-import org.gradle.plugins.signing.Sign
-
 allprojects {
     apply plugin: 'signing'
     signing {
         required {
-            isReleaseVersion &&
-                    (gradle.taskGraph.hasTask('artifactoryPublish') || project.hasProperty('forceSign'))
+            rootProject.ext.isReleaseVersion &&
+                    (gradle.taskGraph.hasTask(':artifactoryPublish') || rootProject.hasProperty('forceSign'))
         }
     }
 }
 
 gradle.taskGraph.whenReady { taskGraph ->
-    if (taskGraph.allTasks.any { it instanceof Sign } || project.hasProperty('forceSign')) {
+    if (project.ext.isReleaseVersion &&
+            (taskGraph.hasTask(':artifactoryPublish') || 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')) {
@@ -63,30 +61,29 @@ def promptUser(String prompt) {
     def response = ''
     if (System.console() == null) {
         new groovy.swing.SwingBuilder().edt {
-            dialog(modal: true, //Otherwise the build will continue running
-                    title: 'Reponse required', //Dialog title
+            dialog(modal: true, // pause build
+                    title: 'Reponse required', // dialog title
                     alwaysOnTop: true,
                     resizable: false,
-                    locationRelativeTo: null, //Place dialog in center of the screen
-                    pack: true, //We need to pack the dialog (so it will take the size of its children)
+                    locationRelativeTo: null, // centered on screen
+                    pack: true,
                     show: true
-            ){
-                vbox { //Put everything below each other
+            ) {
+                vbox {
                     label(text: "$prompt:")
                     input = passwordField()
                     button(defaultButton: true, text: 'OK', actionPerformed: {
-                        response = new String(input.password); //set pass variable to value of input field
-                        dispose(); //close dialog
+                        response = new String(input.password)
+                        dispose()
                     })
                 }
             }
         }
-    }
-    else{
+    } else {
         response = new String(System.console().readPassword("\n$prompt: "))
     }
 
-    if(response.size() <= 0){
+    if (!response) {
         throw new InvalidUserDataException("Null response detected!")
     }
     response

http://git-wip-us.apache.org/repos/asf/groovy/blob/ef6a187c/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 41f1f09..48c660f 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -62,9 +62,7 @@ allprojects {
         repositories {
             mavenDeployer {
                 pom pomConfigureClosure
-                if (shouldSign) {
-                    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                }
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -73,9 +71,7 @@ allprojects {
         repositories {
             mavenInstaller {
                 pom pomConfigureClosure
-                if (shouldSign) {
-                    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                }
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -109,19 +105,17 @@ allprojects {
 
     install {
         doFirst {
-            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)
-                }
+            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)
             }
         }
     }
@@ -166,36 +160,35 @@ allprojects {
 }
 
 install {
+    dependsOn([distDoc, dist, distBin])
     doFirst {
-        if (shouldSign) {
-            signArchiveTask(jarAll)
-            signArchiveTask(sourceAllJar)
-            signArchiveTask(javadocAllJar)
-            signArchiveTask(groovydocAllJar)
-            signArchiveTask(distBin)
+        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)
+        // 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'
-                }
+        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)
         }
     }
 }
@@ -258,9 +251,7 @@ ext.pomAll = {
         p.dependencies.clear()
     }
 
-    if (shouldSign) {
-        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-    }
+    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
 }
 
 install {