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/07 04:08:33 UTC

[1/6] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo

Repository: groovy
Updated Branches:
  refs/heads/master d32a39b18 -> 36a55d11b


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


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

Branch: refs/heads/master
Commit: bd4e2c7121a26ed9c1b2d16fdaed81e477e7a5f8
Parents: d32a39b
Author: paulk <pa...@asert.com.au>
Authored: Fri Jan 6 00:00:44 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:03:52 2017 +1000

----------------------------------------------------------------------
 build.gradle                              |  20 +++--
 gradle/assemble.gradle                    |  10 +--
 gradle/backports.gradle                   |   1 +
 gradle/signing.gradle                     |  92 +++++++++++++++++++++
 gradle/upload.gradle                      | 108 ++++++++++++++++++++++---
 subprojects/groovy-templates/build.gradle |   2 +-
 6 files changed, 207 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index a23496b..455edc2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -72,6 +72,8 @@ indyBanner()
 // TODO use antlr plugin
 //apply plugin: 'antlr'
 
+ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
+
 allprojects {
     apply plugin: 'java'
 
@@ -472,6 +474,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'
@@ -487,14 +498,7 @@ 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'
 
 licenseReport {
     excludeGroups = [

http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 8922eea..12f2917 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -340,7 +340,7 @@ task jarAll(type: Jar, dependsOn: replaceJarWithJarJar) {
     inputs.files(allprojects.jar.archivePath)
 
     ext.metaInfDir = "$buildDir/tmp/groovy-all-metainf"
-    appendix = 'all'
+    baseName = 'groovy-all'
     includeEmptyDirs = false
     if (rootProject.useIndy()) {
         classifier = 'indy'
@@ -447,7 +447,7 @@ task sourceAllJar(type: Jar, dependsOn: { modules()*.sourceJar + rootProject.sou
     modules()*.sourceJar.each {
         with it.rootSpec
     }
-    appendix = 'all'
+    baseName = 'groovy-all'
     classifier = rootProject.useIndy() ? 'indy-sources' : 'sources'
 }
 
@@ -463,13 +463,13 @@ allprojects {
 }
 
 task javadocAllJar(type: Jar, dependsOn: javadocAll) {
-    appendix = 'all'
+    baseName = 'groovy-all'
     classifier = rootProject.useIndy() ? 'indy-javadoc' : 'javadoc'
     from javadocAll.destinationDir
 }
 
 task groovydocAllJar(type: Jar, dependsOn: groovydocAll) {
-    appendix = 'all'
+    baseName = 'groovy-all'
     classifier = rootProject.useIndy() ? 'indy-groovydoc' : 'groovydoc'
     from groovydocAll.destinationDir
 }
@@ -531,7 +531,7 @@ ext.distSpec = copySpec {
     }
     into('embeddable') {
         from jarAll.archivePath
-        from { new File(jarAll.archivePath.parent, "${jarAll.baseName}-${jarAll.appendix}-${jarAll.version}-indy.jar") }
+        from { new File(jarAll.destinationDir, "${jarAll.baseName}-${jarAll.version}-indy.jar") }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/gradle/backports.gradle
----------------------------------------------------------------------
diff --git a/gradle/backports.gradle b/gradle/backports.gradle
index d111c26..0d8e5ed 100644
--- a/gradle/backports.gradle
+++ b/gradle/backports.gradle
@@ -43,6 +43,7 @@ backports.each { pkg, classList ->
         from zipTree(jar.archivePath)
         include classList
         baseName = "groovy-backports-$pkg"
+        classifier = ''
     }
 
     // the following two jars are empty. No wonder, Maven Central *requires* a javadoc and sources classifier

http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/gradle/signing.gradle
----------------------------------------------------------------------
diff --git a/gradle/signing.gradle b/gradle/signing.gradle
new file mode 100644
index 0000000..89c3a01
--- /dev/null
+++ b/gradle/signing.gradle
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+import org.gradle.plugins.signing.Sign
+
+allprojects {
+    apply plugin: 'signing'
+    signing {
+        required {
+            isReleaseVersion &&
+                    (gradle.taskGraph.hasTask('artifactoryPublish') || project.hasProperty('forceSign'))
+        }
+    }
+}
+
+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)
+        if (!project.hasProperty('signing.keyId') ||
+                !project.hasProperty('signing.secretKeyRingFile') ||
+                !project.hasProperty('signing.password')) {
+            printf "\n\nWe have to sign some things in this build." +
+                    "\n\nPlease enter your signing details.\n\n"
+            System.out.flush()
+
+            if (!project.hasProperty('signing.keyId')) {
+                project.ext.'signing.keyId' = promptUser('PGP Key Id')
+            }
+            if (!project.hasProperty('signing.secretKeyRingFile')) {
+                project.ext.'signing.secretKeyRingFile' = promptUser('PGP Secret Key Ring File (absolute path)')
+            }
+            if (!project.hasProperty('signing.password')) {
+                project.ext.'signing.password' = promptUser('PGP Private Key Password')
+            }
+
+            printf "\nThanks.\n\n"
+            System.out.flush()
+        }
+        allprojects { ext.'signing.keyId' = project.getProperty('signing.keyId') }
+        allprojects { ext.'signing.secretKeyRingFile' = project.getProperty('signing.secretKeyRingFile') }
+        allprojects { ext.'signing.password' = project.getProperty('signing.password') }
+    }
+}
+
+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
+                    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)
+                    show: true
+            ){
+                vbox { //Put everything below each other
+                    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
+                    })
+                }
+            }
+        }
+    }
+    else{
+        response = new String(System.console().readPassword("\n$prompt: "))
+    }
+
+    if(response.size() <= 0){
+        throw new InvalidUserDataException("Null response detected!")
+    }
+    response
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 7659a1d..633df89 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -40,7 +40,25 @@ allprojects {
 
 apply from: 'gradle/backports.gradle'
 
+ext.basename = { String s -> s.take(s.lastIndexOf('.')) }
+ext.deriveFile = { File archive, String suffix -> new File(archive.parent, basename(archive.name) + "-${suffix}.jar") }
+
 allprojects {
+    ext.signWithClassifier = { String c, File f ->
+        signing.sign(c, f)
+        project.artifacts.add('archives', new File(f.parent, f.name + '.asc')) {
+            classifier = c
+            type = 'jar.asc'
+        }
+    }
+
+    ext.signArchiveTask = { archiveTask ->
+        signing.sign(archiveTask.classifier, archiveTask.archivePath)
+        project.artifacts.add('archives', new File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')) {
+            classifier = archiveTask.classifier
+            type = archiveTask.extension + '.asc'
+        }
+    }
 
     configurations {
         deployerJars
@@ -51,6 +69,7 @@ allprojects {
             mavenDeployer {
                 configuration = configurations.deployerJars
                 pom pomConfigureClosure
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -59,6 +78,7 @@ allprojects {
         repositories {
             mavenInstaller {
                 pom pomConfigureClosure
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -79,49 +99,111 @@ allprojects {
                 new GradleException('You cannot use uploadArchives or install task with the flag [indy] turned'
                         +' on because the build handles indy artifacts by itself in that case.')
             }
-            def archive = jar.archivePath
-            def indyJar = new File(archive.parent, archive.name[0..archive.name.lastIndexOf('.')-1]+'-indy.jar')
+            def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
             if (indyJar.exists()) {
                 project.artifacts.add('archives', indyJar)
             }
-            def grooidJar = new File(archive.parent, archive.name[0..archive.name.lastIndexOf('.')-1]+'-grooid.jar')
+            def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
             if (grooidJar.exists()) {
                 project.artifacts.add('archives', grooidJar)
             }
         }
     }
+
+    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)
+            }
+        }
+    }
 }
 
 // the root project generates an alternate 'groovy-all' artifact
 [uploadArchives, install]*.with {
     dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin])
     doFirst {
-        project.artifacts.add('archives', jarAll)
-        project.artifacts.add('archives', sourceAllJar)
-        project.artifacts.add('archives', javadocAllJar)
-        project.artifacts.add('archives', groovydocAllJar)
-        project.artifacts.add('archives', distBin)
+        project.artifacts.add('archives', jarAll) {
+            name = 'groovy-all'
+        }
+        project.artifacts.add('archives', sourceAllJar) {
+            name = 'groovy-all'
+        }
+        project.artifacts.add('archives', javadocAllJar) {
+            name = 'groovy-all'
+        }
+        project.artifacts.add('archives', groovydocAllJar) {
+            name = 'groovy-all'
+        }
+        project.artifacts.add('archives', distBin) {
+            name = 'groovy-binary'
+        }
         tasks.withType(Jar).matching { it.name.startsWith('backport') }.each { t ->
             project.artifacts.add('archives', t.archivePath) {
                 name = t.baseName
                 type = 'jar'
+                classifier = t.classifier
             }
         }
 
-        def archive = jarAll.archivePath
-        def indyJar = new File(archive.parent, archive.name[0..archive.name.lastIndexOf('.')-1] + '-indy.jar')
+        def indyJar = deriveFile(jarAll.archivePath, 'indy')
         if (indyJar.exists()) {
             project.artifacts.add('archives', indyJar)
         }
-        def grooidJar = new File(archive.parent, archive.name[0..archive.name.lastIndexOf('.')-1]+'-grooid.jar')
+        def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
         if (grooidJar.exists()) {
             project.artifacts.add('archives', grooidJar)
         }
     }
 }
+
+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'
+            }
+        }
+
+        def indyJar = deriveFile(jarAll.archivePath, 'indy')
+        if (indyJar.exists()) {
+            signWithClassifier('indy', indyJar)
+        }
+        def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
+        if (grooidJar.exists()) {
+            signWithClassifier('grooid', grooidJar)
+        }
+    }
+}
+
 ext.pomAll = {
     addFilter('groovy') { artifact, file ->
-        !(artifact.name.contains('groovy-all')) && !(artifact.name.contains('groovy-binary')) && !(artifact.name.contains('backport'))
+        !(artifact.name.contains('groovy-all')) &&
+                !(artifact.name.contains('groovy-binary')) &&
+                !(artifact.name.contains('backport'))
     }
     addFilter('all') { artifact, file ->
         artifact.name.contains('groovy-all')
@@ -174,6 +256,8 @@ ext.pomAll = {
     binarypom.whenConfigured { p ->
         p.dependencies.clear()
     }
+
+    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
 }
 
 install {

http://git-wip-us.apache.org/repos/asf/groovy/blob/bd4e2c71/subprojects/groovy-templates/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-templates/build.gradle b/subprojects/groovy-templates/build.gradle
index 4805b1c..906f37c 100644
--- a/subprojects/groovy-templates/build.gradle
+++ b/subprojects/groovy-templates/build.gradle
@@ -27,7 +27,7 @@ dependencies {
 }
 
 task backportJar(type:Jar) {
-    appendix = 'markup-backport'
+    name = 'groovy-markup-backport'
     dependsOn classes
     from sourceSets.main.output
     include 'groovy/text/markup/**'


[4/6] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo (still more tweaks)

Posted by pa...@apache.org.
push signing of artifacts into the main build instead of the groovy-release repo (still more tweaks)


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

Branch: refs/heads/master
Commit: adab2200db7c8855242c979aa15856de00d84a75
Parents: e79fcdb
Author: paulk <pa...@asert.com.au>
Authored: Sat Jan 7 01:14:05 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:07:21 2017 +1000

----------------------------------------------------------------------
 gradle/bintray.gradle | 59 +++++++++++++++++++++++++++++++++++++---------
 gradle/upload.gradle  | 42 ++++++++++++---------------------
 2 files changed, 63 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/adab2200/gradle/bintray.gradle
----------------------------------------------------------------------
diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle
index 2477659..01142ce 100644
--- a/gradle/bintray.gradle
+++ b/gradle/bintray.gradle
@@ -62,33 +62,70 @@ artifactoryPublish {
         def curDate = new Date()
         def additionalFiles = [
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", null,
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}.jar")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.jar"),
+                        curDate, file("$projectDir/target/libs/groovy-all-${version}.jar")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.jar"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'sources',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-sources.jar")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-sources.jar"),
+                        curDate, file("$projectDir/target/libs/groovy-all-${version}-sources.jar")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-sources.jar"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'javadoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-javadoc.jar")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-javadoc.jar"),
+                        curDate, file("$projectDir/target/libs/groovy-all-${version}-javadoc.jar")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-javadoc.jar"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'groovydoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-groovydoc.jar")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-groovydoc.jar"),
+                        curDate, file("$projectDir/target/libs/groovy-all-${version}-groovydoc.jar")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-groovydoc.jar"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'indy',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-indy.jar")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-indy.jar"),
+                        curDate, file("$projectDir/target/libs/groovy-all-${version}-indy.jar")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-indy.jar"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom", "pom", null,
-                        curDate, file("$projectDir/target/poms/pom-all.xml")), 'artifacts', "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom"),
+                        curDate, file("$projectDir/target/poms/pom-all.xml")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom"),
+                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom.asc", "pom.asc", null,
+                        curDate, file("$projectDir/target/poms/pom-all.xml.asc")), 'artifacts',
+                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom.asc"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip", "zip", null,
-                        curDate, distBin.archivePath), 'artifacts', "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip"),
+                        curDate, distBin.archivePath), 'artifacts',
+                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip"),
+                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip.asc", "zip.asc", null,
+                        curDate, new File(distBin.destinationDir, distBin.archiveName + '.asc')), 'artifacts',
+                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip.asc"),
                 gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom", "pom", null,
-                        curDate, file("$projectDir/target/poms/pom-binary.xml")), 'artifacts', "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom"),
+                        curDate, file("$projectDir/target/poms/pom-binary.xml")), 'artifacts',
+                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom"),
+                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom.asc", "pom.asc", null,
+                        curDate, file("$projectDir/target/poms/pom-binary.xml.asc")), 'artifacts',
+                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom.asc"),
 
         ]
         tasks.withType(Jar).matching { it.name.startsWith('backport') }.all {
+            String baseDir = "org/codehaus/groovy/${baseName}/${version}"
             additionalFiles << gradleDeployDetails(
                     new DefaultPublishArtifact(baseName, "jar", "jar", classifier, curDate, archivePath),
                     'artifacts',
-                    "org/codehaus/groovy/${baseName}/${version}/${archiveName}")
+                    "$baseDir/${archiveName}")
+            additionalFiles << gradleDeployDetails(
+                    new DefaultPublishArtifact(baseName, "jar.asc", "jar.asc", classifier, curDate, new File(destinationDir, archiveName + '.asc')),
+                    'artifacts',
+                    "$baseDir/${archiveName}.asc")
             if (!classifier) {
+                def pomLocation = "$projectDir/target/poms/pom-${baseName - 'groovy-'}.xml"
+                additionalFiles << gradleDeployDetails(
+                        new DefaultPublishArtifact(baseName, "pom", "pom", null, curDate, file(pomLocation)),
+                        'artifacts',
+                        "$baseDir/${baseName}-${version}.pom")
+                additionalFiles << gradleDeployDetails(
+                        new DefaultPublishArtifact(baseName, "pom.asc", "pom.asc", null, curDate, file(pomLocation + '.asc')),
+                        'artifacts',
+                        "$baseDir/${baseName}-${version}.pom.asc")
+            }
+        }
+        allprojects {
+            configurations.archives.artifacts.findAll{ it.name == project.name && it.type == 'jar' && it.extension == 'jar' }.each {
+                def pomLocation = "$project.projectDir/target/poms/pom-${project == rootProject ? 'groovy' : 'default'}.xml"
+                String baseDir = "org/codehaus/groovy/${it.name}/${version}"
                 additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(baseName, "pom", "pom", null, curDate, file("$projectDir/target/poms/pom-${baseName - 'groovy-'}.xml")),
+                        new DefaultPublishArtifact(it.name, "pom.asc", "pom.asc", null, curDate, file(pomLocation + '.asc')),
                         'artifacts',
-                        "org/codehaus/groovy/${baseName}/${version}/${baseName}-${version}.pom")
+                        "$baseDir/${it.name}-${version}.pom.asc")
             }
         }
         additionalFiles.each { deployDetails.add(it) }

http://git-wip-us.apache.org/repos/asf/groovy/blob/adab2200/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 419b6f8..8515d07 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -24,10 +24,10 @@ if (isUsingBintray) {
     logger.lifecycle 'Deployment environment set to Bintray'
 }
 
+def embedded = ['asm', 'asm-util', 'asm-analysis', 'asm-tree', 'asm-commons', 'antlr', 'commons-cli', 'openbeans']
 def removeJarjaredDependencies = { p ->
     p.dependencies.removeAll(p.dependencies.findAll {
-        it.groupId == 'org.codehaus.groovy' ||
-                (['asm', 'asm-util', 'asm-analysis', 'asm-tree', 'asm-commons', 'antlr', 'commons-cli', 'openbeans'].contains(it.artifactId))
+        it.groupId == 'org.codehaus.groovy' || embedded.contains(it.artifactId)
     })
 }
 
@@ -48,14 +48,17 @@ allprojects {
         project.artifacts.add('archives', new File(f.parent, f.name + '.asc')) {
             classifier = c
             type = 'jar.asc'
+            extension = 'jar.asc'
         }
     }
 
     ext.signArchiveTask = { archiveTask ->
         signing.sign(archiveTask.classifier, archiveTask.archivePath)
         project.artifacts.add('archives', new File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')) {
+            name = archiveTask.baseName
             classifier = archiveTask.classifier
             type = archiveTask.extension + '.asc'
+            extension = archiveTask.extension + '.asc'
         }
     }
 
@@ -124,7 +127,7 @@ allprojects {
 
 // the root project generates an alternate 'groovy-all' artifact
 [uploadArchives, install]*.with {
-    dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin])
+    dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin, distDoc, dist, distBin])
     doFirst {
         project.artifacts.add('archives', jarAll) {
             name = 'groovy-all'
@@ -141,40 +144,23 @@ allprojects {
         project.artifacts.add('archives', distBin) {
             name = 'groovy-binary'
         }
-        tasks.withType(Jar).matching { it.name.startsWith('backport') }.each { t ->
-            project.artifacts.add('archives', t.archivePath) {
-                name = t.baseName
-                type = 'jar'
-                classifier = t.classifier
-            }
-        }
-
-        def indyJar = deriveFile(jarAll.archivePath, 'indy')
-        if (indyJar.exists()) {
-            project.artifacts.add('archives', indyJar)
-        }
-        def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
-        if (grooidJar.exists()) {
-            project.artifacts.add('archives', grooidJar)
-        }
-    }
-}
-
-install {
-    dependsOn([distDoc, dist, distBin])
-    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
+        // TODO rework these?
+        signing.sign(distBin)
         signing.sign(distSrc.archivePath)
         signing.sign(distDoc.archivePath)
         signing.sign(dist.archivePath)
 
         tasks.withType(Jar).matching { it.name.startsWith('backport') }.each { t ->
+            project.artifacts.add('archives', t.archivePath) {
+                name = t.baseName
+                type = 'jar'
+                classifier = t.classifier
+            }
             signing.sign(t.classifier, t.archivePath)
             project.artifacts.add('archives', new File(t.destinationDir, t.archiveName + '.asc')) {
                 name = t.baseName
@@ -185,10 +171,12 @@ install {
 
         def indyJar = deriveFile(jarAll.archivePath, 'indy')
         if (indyJar.exists()) {
+            project.artifacts.add('archives', indyJar)
             signWithClassifier('indy', indyJar)
         }
         def grooidJar = deriveFile(jarAll.archivePath, 'grooid')
         if (grooidJar.exists()) {
+            project.artifacts.add('archives', grooidJar)
             signWithClassifier('grooid', grooidJar)
         }
     }


[2/6] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo (tweaks)

Posted by pa...@apache.org.
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/master
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
     }
 }
-


[6/6] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo (more tweaks - fix zip sigs)

Posted by pa...@apache.org.
push signing of artifacts into the main build instead of the groovy-release repo (more tweaks - fix zip sigs)


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

Branch: refs/heads/master
Commit: 36a55d11b78234eb4e73d66678087701793c4f90
Parents: cf07fc0
Author: paulk <pa...@asert.com.au>
Authored: Sat Jan 7 13:59:15 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:07:54 2017 +1000

----------------------------------------------------------------------
 gradle/bintray.gradle | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/36a55d11/gradle/bintray.gradle
----------------------------------------------------------------------
diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle
index ee3a50b..20d4b5d 100644
--- a/gradle/bintray.gradle
+++ b/gradle/bintray.gradle
@@ -73,8 +73,8 @@ artifactoryPublish {
             // as the artifactId, so we add the transformed one ourselves
             // this also covers signatures which we already added during install
             deployDetails.add(makeTransformedDetails(it))
-            if (it.type == 'jar' && it.extension == 'jar' && !it.classifier) {
-                // and the pom and its signature
+            if (!it.classifier && (it.type == 'jar' || it.type == 'zip')) {
+                // add the pom and its signature
                 deployDetails.add(makeTransformedPomDetails(it))
                 deployDetails.add(makeTransformedPomSigDetails(it))
             }


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

Posted by pa...@apache.org.
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/e79fcdbd
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e79fcdbd
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e79fcdbd

Branch: refs/heads/master
Commit: e79fcdbd5ac6cce3677dd7270f028d5feff985af
Parents: 0b18eda
Author: paulk <pa...@asert.com.au>
Authored: Fri Jan 6 15:11:01 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:05:52 2017 +1000

----------------------------------------------------------------------
 build.gradle          |  4 +--
 gradle/signing.gradle | 31 ++++++++---------
 gradle/upload.gradle  | 85 +++++++++++++++++++++-------------------------
 3 files changed, 53 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e79fcdbd/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 79922b2..70f8732 100644
--- a/build.gradle
+++ b/build.gradle
@@ -72,9 +72,6 @@ indyBanner()
 // TODO use antlr plugin
 //apply plugin: 'antlr'
 
-ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
-ext.shouldSign = isReleaseVersion
-
 allprojects {
     apply plugin: 'java'
 
@@ -173,6 +170,7 @@ ext {
     xmlunitVersion = '1.6'
     xstreamVersion = '1.4.9'
     spockVersion = '1.0-groovy-2.4'
+    isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
 }
 
 dependencies {

http://git-wip-us.apache.org/repos/asf/groovy/blob/e79fcdbd/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/e79fcdbd/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 5668454..419b6f8 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -63,9 +63,7 @@ allprojects {
         repositories {
             mavenDeployer {
                 pom pomConfigureClosure
-                if (shouldSign) {
-                    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                }
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -74,9 +72,7 @@ allprojects {
         repositories {
             mavenInstaller {
                 pom pomConfigureClosure
-                if (shouldSign) {
-                    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                }
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
             }
         }
     }
@@ -110,19 +106,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)
             }
         }
     }
@@ -167,36 +161,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)
         }
     }
 }
@@ -259,9 +252,7 @@ ext.pomAll = {
         p.dependencies.clear()
     }
 
-    if (shouldSign) {
-        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-    }
+    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
 }
 
 install {


[5/6] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo (more tweaks - exclude extra artifacts from root project publication)

Posted by pa...@apache.org.
push signing of artifacts into the main build instead of the groovy-release repo (more tweaks - exclude extra artifacts from root project publication)


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

Branch: refs/heads/master
Commit: cf07fc0a4840a1df56cf1a74047b278bd3fa7328
Parents: adab220
Author: paulk <pa...@asert.com.au>
Authored: Sat Jan 7 13:22:36 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sat Jan 7 14:07:42 2017 +1000

----------------------------------------------------------------------
 gradle/bintray.gradle | 88 ++++++++++++----------------------------------
 gradle/upload.gradle  | 20 ++++++++---
 2 files changed, 38 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/cf07fc0a/gradle/bintray.gradle
----------------------------------------------------------------------
diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle
index 01142ce..ee3a50b 100644
--- a/gradle/bintray.gradle
+++ b/gradle/bintray.gradle
@@ -46,6 +46,7 @@ allprojects {
         }
         publish {
             repository {
+                excludePatterns = 'org/codehaus/groovy/groovy/*/groovy-all*,org/codehaus/groovy/groovy/*/groovy-backports*,org/codehaus/groovy/groovy/*/groovy-binary*'
                 repoKey = project.hasProperty('bintrayRepoKey') ? project.bintrayRepoKey : 'oss-snapshot-local' //The Artifactory repository key to publish to
                 //when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
                 //~/.gradle/gradle.properties, otherwise to be set in the build server
@@ -57,78 +58,35 @@ allprojects {
 }
 
 artifactoryPublish {
+    def curDate = new Date()
+    def pomSource = { a -> "$projectDir/target/poms/pom-${a.name - 'groovy-'}.xml" }
+    def destBase = { a -> "org/codehaus/groovy/${a.name}/${version}/${a.name}-${version}${a.classifier ? '-' + a.classifier : ''}" }
+    def newDetails = { orig, newFile, newExt, newType -> gradleDeployDetails(new DefaultPublishArtifact(
+            orig.name, newExt, newType, orig.classifier, curDate, newFile), 'artifacts', destBase(orig) + '.' + newExt) }
+    def makeTransformedDetails = { orig -> newDetails(orig, orig.file, orig.extension, orig.extension) }
+    def makeTransformedPomDetails = { orig -> newDetails(orig, file(pomSource(orig)), 'pom', 'pom') }
+    def makeTransformedPomSigDetails = { orig -> newDetails(orig, file(pomSource(orig) + '.asc'), 'pom.asc', 'asc') }
     mavenDescriptor = new File("$projectDir/target/poms/pom-groovy.xml")
     doFirst{
-        def curDate = new Date()
-        def additionalFiles = [
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", null,
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}.jar")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'sources',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-sources.jar")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-sources.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'javadoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-javadoc.jar")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-javadoc.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'groovydoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-groovydoc.jar")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-groovydoc.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar", 'indy',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-indy.jar")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-indy.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom", "pom", null,
-                        curDate, file("$projectDir/target/poms/pom-all.xml")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom.asc", "pom.asc", null,
-                        curDate, file("$projectDir/target/poms/pom-all.xml.asc")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom.asc"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip", "zip", null,
-                        curDate, distBin.archivePath), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip.asc", "zip.asc", null,
-                        curDate, new File(distBin.destinationDir, distBin.archiveName + '.asc')), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip.asc"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom", "pom", null,
-                        curDate, file("$projectDir/target/poms/pom-binary.xml")), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom.asc", "pom.asc", null,
-                        curDate, file("$projectDir/target/poms/pom-binary.xml.asc")), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom.asc"),
-
-        ]
-        tasks.withType(Jar).matching { it.name.startsWith('backport') }.all {
-            String baseDir = "org/codehaus/groovy/${baseName}/${version}"
-            additionalFiles << gradleDeployDetails(
-                    new DefaultPublishArtifact(baseName, "jar", "jar", classifier, curDate, archivePath),
-                    'artifacts',
-                    "$baseDir/${archiveName}")
-            additionalFiles << gradleDeployDetails(
-                    new DefaultPublishArtifact(baseName, "jar.asc", "jar.asc", classifier, curDate, new File(destinationDir, archiveName + '.asc')),
-                    'artifacts',
-                    "$baseDir/${archiveName}.asc")
-            if (!classifier) {
-                def pomLocation = "$projectDir/target/poms/pom-${baseName - 'groovy-'}.xml"
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(baseName, "pom", "pom", null, curDate, file(pomLocation)),
-                        'artifacts',
-                        "$baseDir/${baseName}-${version}.pom")
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(baseName, "pom.asc", "pom.asc", null, curDate, file(pomLocation + '.asc')),
-                        'artifacts',
-                        "$baseDir/${baseName}-${version}.pom.asc")
+        configurations.archives.artifacts.findAll{ it.name != project.name }.each {
+            // the plugin we are using uses the project name rather than the artifact name
+            // as the artifactId, so we add the transformed one ourselves
+            // this also covers signatures which we already added during install
+            deployDetails.add(makeTransformedDetails(it))
+            if (it.type == 'jar' && it.extension == 'jar' && !it.classifier) {
+                // and the pom and its signature
+                deployDetails.add(makeTransformedPomDetails(it))
+                deployDetails.add(makeTransformedPomSigDetails(it))
             }
         }
+
         allprojects {
-            configurations.archives.artifacts.findAll{ it.name == project.name && it.type == 'jar' && it.extension == 'jar' }.each {
-                def pomLocation = "$project.projectDir/target/poms/pom-${project == rootProject ? 'groovy' : 'default'}.xml"
-                String baseDir = "org/codehaus/groovy/${it.name}/${version}"
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(it.name, "pom.asc", "pom.asc", null, curDate, file(pomLocation + '.asc')),
-                        'artifacts',
-                        "$baseDir/${it.name}-${version}.pom.asc")
+            configurations.archives.artifacts.findAll{ it.name == project.name && it.type == 'jar' && it.extension == 'jar' && !it.classifier }.each {
+                // add pom signatures
+                def pomSigLocation = "$project.projectDir/target/poms/pom-${project == rootProject ? 'groovy' : 'default'}.xml.asc"
+                deployDetails.add(newDetails(it, file(pomSigLocation), 'pom.asc', 'pom'))
             }
         }
-        additionalFiles.each { deployDetails.add(it) }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/cf07fc0a/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 8515d07..d99ad18 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -47,7 +47,7 @@ allprojects {
         signing.sign(c, f)
         project.artifacts.add('archives', new File(f.parent, f.name + '.asc')) {
             classifier = c
-            type = 'jar.asc'
+            type = 'asc'
             extension = 'jar.asc'
         }
     }
@@ -57,7 +57,7 @@ allprojects {
         project.artifacts.add('archives', new File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')) {
             name = archiveTask.baseName
             classifier = archiveTask.classifier
-            type = archiveTask.extension + '.asc'
+            type = 'asc'
             extension = archiveTask.extension + '.asc'
         }
     }
@@ -109,6 +109,8 @@ allprojects {
 
     install {
         doFirst {
+            // gradle doesn't expect us to mutate configurations like we do here
+            // so signing the configuration won't work and we do it manually here
             signArchiveTask(jar)
             signArchiveTask(sourceJar)
             signArchiveTask(javadocJar)
@@ -125,7 +127,9 @@ allprojects {
     }
 }
 
-// the root project generates an alternate 'groovy-all' artifact
+// the root project generates several alternate artifacts, e.g. 'groovy-all'
+// we don't want them in the root project so add them as artifacts with a modified name
+// we'll exclude the original artifacts during publication with an exclude pattern
 [uploadArchives, install]*.with {
     dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin, distDoc, dist, distBin])
     doFirst {
@@ -150,7 +154,12 @@ allprojects {
         signArchiveTask(groovydocAllJar)
 
         // TODO rework these?
-        signing.sign(distBin)
+        signing.sign(distBin.archivePath)
+        project.artifacts.add('archives', new File(distBin.destinationDir, distBin.archiveName + '.asc')) {
+            name = 'groovy-binary'
+            type = 'asc'
+            extension = 'zip.asc'
+        }
         signing.sign(distSrc.archivePath)
         signing.sign(distDoc.archivePath)
         signing.sign(dist.archivePath)
@@ -165,7 +174,8 @@ allprojects {
             project.artifacts.add('archives', new File(t.destinationDir, t.archiveName + '.asc')) {
                 name = t.baseName
                 classifier = t.classifier
-                type = t.extension + '.asc'
+                type = 'asc'
+                extension = t.extension + '.asc'
             }
         }