hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1532830 - in /httpcomponents/project-release-tools/trunk: build.gradle buildSrc/src/main/groovy/PGPSign.groovy
Date Wed, 16 Oct 2013 17:52:41 GMT
Author: olegk
Date: Wed Oct 16 17:52:41 2013
New Revision: 1532830

URL: http://svn.apache.org/r1532830
Log:
Added tasks to commit RC dist and to deploy RC artifacts to staging

Added:
    httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PGPSign.groovy
Modified:
    httpcomponents/project-release-tools/trunk/build.gradle

Modified: httpcomponents/project-release-tools/trunk/build.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/build.gradle?rev=1532830&r1=1532829&r2=1532830&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/build.gradle (original)
+++ httpcomponents/project-release-tools/trunk/build.gradle Wed Oct 16 17:52:41 2013
@@ -71,6 +71,7 @@ File releaseTagFile        = new File(pr
 File rcQualifierFile       = new File(project.buildDir, 'rc-qualifier.txt')
 File rcTagFile             = new File(project.buildDir, 'rc-tag.txt')
 File rcRevisionFile        = new File(project.buildDir, 'rc-revision.txt')
+File distRevisionFile      = new File(project.buildDir, 'dist-revision.txt')
 File releaseRevisionFile   = new File(project.buildDir, 'release-revision.txt')
 File nextVerFile           = new File(project.buildDir, 'next-ver.txt')
 File nextVerRevisionFile   = new File(project.buildDir, 'next-ver-revision.txt')
@@ -227,9 +228,27 @@ if (rcTagFile.exists() && rcRevisionFile
         repo = new URI(rcTagFile.text.trim())
     }
 
+    task deployRC(dependsOn: checkoutRC) {
+        group = 'Release'
+        description = "Deploys RC artifacts to Apache staging repository."
+        doLast {
+            String releaseVer = releaseVerFile.text.trim()
+            String rcQualifier = rcQualifierFile.text.trim()
+
+            File pomFile = new File(checkoutRC.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
+
+            println "Deploying ${name} ${releaseVer} based on ${rcQualifier}"
+            mvn.exec(checkoutRC.localDir, 'deploy', '-Prelease')
+        }
+    }
+
+
     task buildRC(dependsOn: checkoutRC) {
         group = 'Release'
-        description = "Compiles and builds artifacts based on RC."
+        description = "Compiles and builds RC artifacts."
         inputs.files fileTree(dir: checkoutRC.localDir, excludes:['**/target/**','**/.svn/**'])
         outputs.files fileTree(dir: checkoutRC.localDir, includes:['**/target/*.jar'])
         doLast {
@@ -242,7 +261,7 @@ if (rcTagFile.exists() && rcRevisionFile
             String name = getProductName(artifactId)
 
             println "Building ${name} ${releaseVer} based on ${rcQualifier}"
-            mvn.exec(checkoutRC.localDir, 'clean', 'install')
+            mvn.exec(checkoutRC.localDir, 'install', 'site')
         }
     }
 
@@ -319,7 +338,7 @@ if (rcTagFile.exists() && rcRevisionFile
             tar.compression = Compression.GZIP
         }
 
-        task sign(type: Sign, dependsOn: checkoutDistStage) {
+        task sign(type: PGPSign, dependsOn: checkoutDistStage) {
             sign configurations.dist
         }
 
@@ -384,6 +403,47 @@ if (rcTagFile.exists() && rcRevisionFile
 
     }
 
+    task prepareDist(dependsOn: assemble) {
+        group = 'Release'
+        description = "Prepares and stages release dist packages based on RC."
+        doLast {
+            Svn.scheduleForAddition(checkoutDistStage.localDir)
+        }
+    }
+
+    task previewDist(type: SvnStatus, dependsOn: prepareDist) {
+        group = 'Release'
+        description = "Displays local changes for staged release dist packages."
+        repo = checkoutDistStage.repo
+        doFirst {
+            println "Local changes for release dist ${checkoutDistStage.repo}"
+            println "${checkoutDistStage.localDir}"
+        }
+    }
+
+    task commitDist(dependsOn: prepareDist) {
+        group = 'Release'
+        description = "Commits staged release dist packages."
+        inputs.files files(releaseVerFile, rcTagFile, rcQualifierFile)
+        outputs.files file(distRevisionFile)
+        doLast {
+            String releaseVer = releaseVerFile.text.trim()
+            String rcQualifier = rcQualifierFile.text.trim()
+
+            File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
+
+            println "Committing ${name} ${releaseVer} ${rcQualifier} dist packages from local
content"
+
+            long revision = Svn.commit(checkoutDistStage.localDir, "${name} ${releaseVer}
${rcQualifier} dist")
+            println ""
+
+            distRevisionFile.text = revision
+        }
+    }
+
     task promoteRC(dependsOn: checkoutRC) {
         group = 'Release'
         description = "Promotes RC to official release."

Added: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PGPSign.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PGPSign.groovy?rev=1532830&view=auto
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PGPSign.groovy (added)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PGPSign.groovy Wed
Oct 16 17:52:41 2013
@@ -0,0 +1,47 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+import org.gradle.plugins.signing.Sign
+import org.gradle.plugins.signing.signatory.Signatory
+
+class PGPSign extends Sign {
+
+    @Override
+    Signatory getSignatory() {
+        Console console = System.console()
+        if (!console) {
+            throw new IllegalStateException("Console not available")
+        }
+        String password = project.ext.'signing.password'
+        if (!password) {
+            String keyId = project.ext.'signing.keyId'
+            passowrd = console.readPassword("Please provide password for PGP key ${keyId}:
")
+            project.ext.'signing.password' = passowrd
+        }
+        return super.getSignatory()
+    }
+}
\ No newline at end of file



Mime
View raw message