hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1534624 - in /httpcomponents/project-release-tools/trunk: build.gradle buildSrc/src/main/groovy/Svn.groovy
Date Tue, 22 Oct 2013 13:03:42 GMT
Author: olegk
Date: Tue Oct 22 13:03:42 2013
New Revision: 1534624

URL: http://svn.apache.org/r1534624
Log:
Improved RC cancel task - automatically deletes RC dist if committed to the repository

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

Modified: httpcomponents/project-release-tools/trunk/build.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/build.gradle?rev=1534624&r1=1534623&r2=1534624&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/build.gradle (original)
+++ httpcomponents/project-release-tools/trunk/build.gradle Tue Oct 22 13:03:42 2013
@@ -97,12 +97,11 @@ task prepareRelease(dependsOn: checkoutS
         }
 
         releaseTag = Release.rewriteAsReleaseTag(checkoutSnapshot.repo, releaseVer)
-        Release.rewritePom(checkoutSnapshot.localDir, releaseVer, releaseTag)
 
         releaseVerFile.text = releaseVer
         releaseTagFile.text = releaseTag.toASCIIString()
 
-        println "Release tag: ${releaseTag}"
+        println "Release tag to be created: ${releaseTag}"
     }
 }
 
@@ -124,6 +123,7 @@ task prepareRC(dependsOn: prepareRelease
     inputs.files files(releaseVerFile, releaseTagFile)
     outputs.files files(rcQualifierFile, rcTagFile)
     doLast {
+        String releaseVer = releaseVerFile.text.trim()
         URI releaseTag = new URI(releaseTagFile.text.trim())
         String rcQualifier = rcQualifierFile.exists() ? rcQualifierFile.text.trim() : 'RC1'
         console.println("Please enter release candidate qualifier: [defaults to ${rcQualifier}]")
@@ -135,31 +135,13 @@ task prepareRC(dependsOn: prepareRelease
         URI rcTag = new URI(releaseTag.scheme, releaseTag.userInfo, releaseTag.host, releaseTag.port,
                 releaseTag.path + '-' + rcQualifier, null, null)
 
+        println "Rewriting POMs"
+        Release.rewritePom(checkoutSnapshot.localDir, releaseVer, releaseTag)
+
         rcQualifierFile.text = rcQualifier
         rcTagFile.text = rcTag.toASCIIString()
 
-        println "RC tag: ${rcTag}"
-    }
-}
-
-task cancelRC(dependsOn: [prepareRelease, updateSnapshot]) {
-    group = 'Release'
-    description = "Cancels current RC."
-    doLast {
-        GFileUtils.deleteQuietly(rcRevisionFile)
-
-        String rcQualifier = rcQualifierFile.exists() ? rcQualifierFile.text.trim() : null
-        if (rcQualifier) {
-            def m = rcQualifier =~ 'RC(\\d)'
-            if (m.find()) {
-                int n = Integer.parseInt(m.group(1))
-                rcQualifier = 'RC' + (++n)
-            }
-        }
-        if (!rcQualifier) {
-            rcQualifier = 'RC1'
-        }
-        rcQualifierFile.text = rcQualifier
+        println "RC tag to be created: ${rcTag}"
     }
 }
 
@@ -444,6 +426,46 @@ if (rcTagFile.exists() && rcRevisionFile
         }
     }
 
+    task cancelRC(dependsOn: checkoutDistStage) {
+        group = 'Release'
+        description = "Cancels current RC."
+        doLast {
+
+            String releaseVer = releaseVerFile.text.trim()
+            String rcQualifier = rcQualifierFile.text.trim()
+
+            Pom pom = Mvn.parsePom(dir)
+            String rcName = getProductName(pom.artifactId).toLowerCase(Locale.US)
+            String rcFullName = "${rcName}-${pom.version}-${rcQualifier}"
+
+            if (distRevisionFile.exists()) {
+
+                println "Removing ${name} ${releaseVer} ${rcQualifier} dist packages from
repository"
+                URI distUri = new URI("${checkoutDistStage.repo.toASCIIString()}${rcFullName}")
+                Svn.deleteRemote(distUri, "Removed ${rcFullName} dist")
+            }
+
+            if (rcQualifier) {
+                def m = rcQualifier =~ 'RC(\\d)'
+                if (m.find()) {
+                    int n = Integer.parseInt(m.group(1))
+                    rcQualifier = 'RC' + (++n)
+                }
+            }
+            if (!rcQualifier) {
+                rcQualifier = 'RC1'
+            }
+
+            GFileUtils.deleteQuietly(rcQualifierFile)
+            GFileUtils.deleteQuietly(rcTagFile)
+            GFileUtils.deleteQuietly(rcRevisionFile)
+            GFileUtils.deleteQuietly(distRevisionFile)
+
+            rcQualifierFile.text = rcQualifier
+        }
+    }
+
+
     if (distRevisionFile.exists()) {
 
         task prepareVote() {

Modified: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy?rev=1534624&r1=1534623&r2=1534624&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy Tue Oct
22 13:03:42 2013
@@ -45,6 +45,7 @@ import org.tmatesoft.svn.core.wc2.SvnCop
 import org.tmatesoft.svn.core.wc2.SvnGetStatus
 import org.tmatesoft.svn.core.wc2.SvnOperationFactory
 import org.tmatesoft.svn.core.wc2.SvnRemoteCopy
+import org.tmatesoft.svn.core.wc2.SvnRemoteDelete
 import org.tmatesoft.svn.core.wc2.SvnRevert
 import org.tmatesoft.svn.core.wc2.SvnScheduleForAddition
 import org.tmatesoft.svn.core.wc2.SvnStatus
@@ -204,4 +205,17 @@ class Svn {
         }
     }
 
+    static void deleteRemote(URI src, String message) {
+        SVNCommandEnvironment env = getSVNCommandEnvironment()
+        SvnOperationFactory opfactory = createOperationFactory(env)
+        try {
+            SvnRemoteDelete deleteOp = opfactory.createRemoteDelete()
+            deleteOp.setSingleTarget(SvnTarget.fromURL(SVNURL.parseURIEncoded(src.toASCIIString())))
+            deleteOp.setCommitMessage(message)
+            deleteOp.run()
+        } finally {
+            opfactory.dispose()
+        }
+    }
+
 }



Mime
View raw message