fault tolerance if signing properties not set

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

Branch: refs/heads/GROOVY_2_4_X
Commit: 08b79316a7c6365df93a86fe2c78d0a9f152677c
Parents: a8c23eb
Author: paulk <[email protected]>
Authored: Tue Jan 10 18:18:50 2017 +1000
Committer: paulk <[email protected]>
Committed: Tue Jan 10 18:18:50 2017 +1000

----------------------------------------------------------------------
 gradle/upload.gradle | 48 +++++++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/08b79316/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 3a191be..a50cd50 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -45,10 +45,13 @@ allprojects {
     ext.signWithClassifier = { String c, File f ->
         if (rootProject.isReleaseVersion) {
             signing.sign(c, f)
-            project.artifacts.add('archives', new File(f.parent, f.name + 
'.asc')) {
-                classifier = c
-                type = 'asc'
-                extension = 'jar.asc'
+            def ascFile = new File(f.parent, f.name + '.asc')
+            if (ascFile.exists()) {
+                project.artifacts.add('archives', ascFile) {
+                    classifier = c
+                    type = 'asc'
+                    extension = 'jar.asc'
+                }
             }
         }
     }
@@ -56,11 +59,14 @@ allprojects {
     ext.signArchiveTask = { archiveTask ->
         if (rootProject.isReleaseVersion) {
             signing.sign(archiveTask.classifier, archiveTask.archivePath)
-            project.artifacts.add('archives', new 
File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')) {
-                name = archiveTask.baseName
-                classifier = archiveTask.classifier
-                type = 'asc'
-                extension = archiveTask.extension + '.asc'
+            def ascFile = new File(archiveTask.destinationDir, 
archiveTask.archiveName + '.asc')
+            if (ascFile.exists()) {
+                project.artifacts.add('archives', ascFile) {
+                    name = archiveTask.baseName
+                    classifier = archiveTask.classifier
+                    type = 'asc'
+                    extension = archiveTask.extension + '.asc'
+                }
             }
         }
     }
@@ -159,10 +165,13 @@ allprojects {
         // TODO rework these?
         if (isReleaseVersion) {
             signing.sign(distBin.archivePath)
-            project.artifacts.add('archives', new File(distBin.destinationDir, 
distBin.archiveName + '.asc')) {
-                name = 'groovy-binary'
-                type = 'asc'
-                extension = 'zip.asc'
+            def ascFile = new File(distBin.destinationDir, distBin.archiveName 
+ '.asc')
+            if (ascFile.exists()) {
+                project.artifacts.add('archives', ascFile) {
+                    name = 'groovy-binary'
+                    type = 'asc'
+                    extension = 'zip.asc'
+                }
             }
             signing.sign(distSrc.archivePath)
             signing.sign(distDoc.archivePath)
@@ -177,11 +186,14 @@ allprojects {
             }
             if (isReleaseVersion) {
                 signing.sign(t.classifier, t.archivePath)
-                project.artifacts.add('archives', new File(t.destinationDir, 
t.archiveName + '.asc')) {
-                    name = t.baseName
-                    classifier = t.classifier
-                    type = 'asc'
-                    extension = t.extension + '.asc'
+                def ascFile = new File(t.destinationDir, t.archiveName + 
'.asc')
+                if (ascFile.exists()) {
+                    project.artifacts.add('archives', ascFile) {
+                        name = t.baseName
+                        classifier = t.classifier
+                        type = 'asc'
+                        extension = t.extension + '.asc'
+                    }
                 }
             }
         }

Reply via email to