You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/09/12 10:30:45 UTC

svn commit: r1522479 - in /httpcomponents/project-release-tools/trunk: build.gradle buildSrc/src/main/groovy/HCPlugin.groovy gradle.properties.template

Author: olegk
Date: Thu Sep 12 08:30:45 2013
New Revision: 1522479

URL: http://svn.apache.org/r1522479
Log:
Cleaned up release management and release candidate tasks

Removed:
    httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/HCPlugin.groovy
Modified:
    httpcomponents/project-release-tools/trunk/build.gradle
    httpcomponents/project-release-tools/trunk/gradle.properties.template

Modified: httpcomponents/project-release-tools/trunk/build.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/build.gradle?rev=1522479&r1=1522478&r2=1522479&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/build.gradle (original)
+++ httpcomponents/project-release-tools/trunk/build.gradle Thu Sep 12 08:30:45 2013
@@ -53,6 +53,9 @@ URI rcTag = rcTagFile.exists() ? new URI
 File rcReadyFile = new File(project.buildDir, 'rc-ready.txt')
 String rcReady = rcReadyFile.exists() ? new URI(rcReadyFile.text.trim()) : null
 
+File rcPromotedFile = new File(project.buildDir, 'rc-promoted.txt')
+String rcPromoted = rcPromotedFile.exists() ? new URI(rcPromotedFile.text.trim()) : null
+
 File nextVerFile = new File(project.buildDir, 'next-ver.txt')
 String nextVer = nextVerFile.exists() ? nextVerFile.text.trim() : null
 
@@ -65,290 +68,289 @@ repositories {
 
 /////////////////////////// Release tasks /////////////////////////////////////
 
-task startReleaseProcess() << {
-    if (project.buildDir.exists()) {
-        [devRepoFile, releaseVerFile, releaseTagFile, rcQualifierFile, rcTagFile, rcReadyFile, nextVerFile]
-        .each { File file ->
-            if (file && file.exists()) {
-                file.delete()
+task startReleaseProcess() {
+    group = 'Release management'
+    description = "Selects source repository and starts release process."
+    doLast {
+        if (project.buildDir.exists()) {
+            [devRepoFile, releaseVerFile, releaseTagFile, rcQualifierFile, rcTagFile,
+                    rcReadyFile, rcPromotedFile, nextVerFile]
+                    .each { File file ->
+                if (file && file.exists()) {
+                    file.delete()
+                }
             }
         }
+        console.println("Please enter development repository URL:")
+        String s = console.readLine()
+        if (!s) {
+            throw new InvalidUserDataException("Development repository URL is empty")
+        }
+        devRepo = new URI(s)
+        devRepoFile.text = devRepo.toASCIIString()
     }
-    console.println("Please enter development repository URL:")
-    String s = console.readLine()
-    if (!s) {
-        throw new InvalidUserDataException("Development repository URL is empty")
-    }
-    devRepo = new URI(s)
-    devRepoFile.text = devRepo.toASCIIString()
 }
 
 if (devRepo) {
 
     task checkoutSnapshot(type: SvnGet) {
+        group = 'Repository'
+        description = "Checks out project snapshot from '${devRepo}'."
         repo = devRepo
     }
 
-    task updateSnapshot(type: SvnUpdate, dependsOn: 'checkoutSnapshot') {
+    task updateSnapshot(type: SvnUpdate, dependsOn: checkoutSnapshot) {
+        group = 'Repository'
+        description = "Updates project snapshot from '${devRepo}'."
         repo = checkoutSnapshot.repo
     }
 
-    task chooseReleaseVersion(dependsOn: 'checkoutSnapshot') << {
-        Svn.revert(checkoutSnapshot.localDir)
-
-        if (!releaseVer) {
-            File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
-            def pomModel = new XmlSlurper().parse(pomFile)
-            String ver = pomModel.version
-            if (ver.endsWith('-SNAPSHOT')) {
-                ver = ver - '-SNAPSHOT'
+    task prepareRelease(dependsOn: checkoutSnapshot) {
+        group = 'Release candidate'
+        description = "Prepares release."
+        doLast {
+            Svn.revert(checkoutSnapshot.localDir)
+
+            if (!releaseVer) {
+                File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
+                def pomModel = new XmlSlurper().parse(pomFile)
+                String ver = pomModel.version
+                if (ver.endsWith('-SNAPSHOT')) {
+                    ver = ver - '-SNAPSHOT'
+                }
+                releaseVer = ver
             }
-            releaseVer = ver
-        }
 
-        console.println("Please enter release version: [defaults to ${releaseVer}]")
-        String s = console.readLine()
-        if (s) {
-            releaseVer = s
-        }
+            console.println("Please enter release version: [defaults to ${releaseVer}]")
+            String s = console.readLine()
+            if (s) {
+                releaseVer = s
+            }
 
-        releaseTag = Release.rewriteAsReleaseTag(devRepo, releaseVer)
-        Release.rewritePom(checkoutSnapshot.localDir, releaseVer, releaseTag)
+            releaseTag = Release.rewriteAsReleaseTag(devRepo, releaseVer)
+            Release.rewritePom(checkoutSnapshot.localDir, releaseVer, releaseTag)
 
-        [rcQualifierFile, rcTagFile, rcReadyFile, nextVerFile].each { File file ->
-            if (file && file.exists()) {
-                file.delete()
+            [rcQualifierFile, rcTagFile, rcReadyFile, rcPromotedFile, nextVerFile]
+                    .each { File file ->
+                if (file && file.exists()) {
+                    file.delete()
+                }
             }
-        }
-
-        releaseVerFile.text = releaseVer
-        releaseTagFile.text = releaseTag.toASCIIString()
 
-        println "Release tag: ${releaseTag}"
-    }
+            releaseVerFile.text = releaseVer
+            releaseTagFile.text = releaseTag.toASCIIString()
 
-    task prepareRelease(dependsOn: 'chooseReleaseVersion') << {
-        Svn.status(checkoutSnapshot.localDir)
-        println "Local changeset for release version ${releaseVer} " +
-                "can be found at ${checkoutSnapshot.localDir}"
+            println "Release tag: ${releaseTag}"
+        }
     }
 
-}
-
-if (releaseVer) {
-
-    task chooseRCTag() << {
-        if (rcQualifier) {
-            def m = rcQualifier =~ 'RC(\\d)'
-            if (m.find()) {
-                int n = Integer.parseInt(m.group(1))
-                rcQualifier = 'RC' + (++n)
+    task prepareRCTag(dependsOn: prepareRelease) {
+        group = 'Release candidate'
+        description = "Prepares release candidate (RC) tag."
+        doLast {
+            if (rcQualifier) {
+                def m = rcQualifier =~ 'RC(\\d)'
+                if (m.find()) {
+                    int n = Integer.parseInt(m.group(1))
+                    rcQualifier = 'RC' + (++n)
+                }
+            }
+            if (!rcQualifier) {
+                rcQualifier = 'RC1'
             }
-        }
-        if (!rcQualifier) {
-            rcQualifier = 'RC1'
-        }
 
-        console.println("Please enter release candidate qualifier: [defaults to ${rcQualifier}]")
-        String s = console.readLine()
-        if (s) {
-            rcQualifier = s
-        }
-        rcQualifierFile.text = rcQualifier
+            console.println("Please enter release candidate qualifier: [defaults to ${rcQualifier}]")
+            String s = console.readLine()
+            if (s) {
+                rcQualifier = s
+            }
+            rcQualifierFile.text = rcQualifier
 
-        rcTag = new URI(releaseTag.scheme, releaseTag.userInfo, releaseTag.host, releaseTag.port,
-                releaseTag.path + '-' + rcQualifier, null, null)
+            rcTag = new URI(releaseTag.scheme, releaseTag.userInfo, releaseTag.host, releaseTag.port,
+                    releaseTag.path + '-' + rcQualifier, null, null)
 
-        [rcReadyFile].each { File file ->
-            if (file && file.exists()) {
-                file.delete()
+            [rcReadyFile, rcPromotedFile, nextVerFile]
+                    .each { File file ->
+                if (file && file.exists()) {
+                    file.delete()
+                }
             }
-        }
 
-        rcTagFile.text = rcTag.toASCIIString()
+            Svn.status(checkoutSnapshot.localDir)
+            println "Local changeset for release ${releaseVer} " +
+                    "can be found at ${checkoutSnapshot.localDir}"
 
-        println "RC tag: ${rcTag}"
+            rcTagFile.text = rcTag.toASCIIString()
+        }
     }
 
 }
 
 if (rcTag) {
 
-    task commitRCTag() << {
-        File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
-        def pomModel = new XmlSlurper().parse(pomFile)
-        String artifactId = pomModel.artifactId
-        String name = getProductName(artifactId)
+    task commitRCTag() {
+        group = 'Release candidate'
+        description = "Commits release candidate (RC) tag."
+        doLast {
+            File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
 
-        println "Creating ${name} ${ver} ${rcQualifier} tag"
+            println "Creating ${name} ${ver} ${rcQualifier} tag"
 
-        Svn.copyLocal(checkoutSnapshot.localDir, rcTag, "${name} ${releaseVer} ${rcQualifier} tag")
+            Svn.copyLocal(checkoutSnapshot.localDir, rcTag, "${name} ${releaseVer} ${rcQualifier} tag")
 
-        println ""
+            println ""
+        }
     }
 
     task checkoutRC(type: SvnGet) {
+        group = 'Repository'
+        description = "Checks out RC from '${rcTag}'."
         repo = rcTag
     }
 
-    task buildRC(dependsOn: 'checkoutRC') << {
-        File pomFile = new File(checkoutRC.localDir, 'pom.xml')
-        def pomModel = new XmlSlurper().parse(pomFile)
-        String artifactId = pomModel.artifactId
-        String name = getProductName(artifactId)
+    task buildRC(dependsOn: checkoutRC) {
+        group = 'Release candidate'
+        description = "Compiles and builds artifacts based on RC."
+        doLast {
+            File pomFile = new File(checkoutRC.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
 
-        println "Building ${name} ${releaseVer} based on ${rcQualifier}"
-        mvn.exec(checkoutRC.localDir, 'clean', 'install')
-        rcReadyFile.text = 'true'
+            println "Building ${name} ${releaseVer} based on ${rcQualifier}"
+            mvn.exec(checkoutRC.localDir, 'clean', 'install')
+            rcReadyFile.text = 'true'
+        }
     }
 
-    task promoteRC() << {
-        File pomFile = new File(checkoutRC.localDir, 'pom.xml')
-        def pomModel = new XmlSlurper().parse(pomFile)
-        String artifactId = pomModel.artifactId
-        String name = getProductName(artifactId)
+}
 
-        println "Promoting ${name} ${releaseVer} ${rcQualifier } to official release"
+if (rcReady) {
 
-        println "Copying ${rcTag} to ${releaseTag}"
-        Svn.copyRemote(rcTag, releaseTag, "${name} ${releaseVer} release tag")
-    }
+    File dir = checkoutRC.localDir
+    Pom pom = Mvn.parsePom(dir)
 
-    task chooseNextVersion(dependsOn: 'checkoutRC') << {
-        nextVer = Release.upgradeVersion(releaseVer)
-        console.println("Please enter new development version: [defaults to ${nextVer}]")
-        String s = console.readLine()
-        if (s) {
-            nextVer = s
-        }
-        if (!nextVer.endsWith('-SNAPSHOT')) {
-            nextVer = nextVer + '-SNAPSHOT'
+    Configuration binCfg = project.configurations.create('rc')
+    // Declare dependencies (excluding OSGi bundle)
+    pom.modules.each { String submodule ->
+        if (!submodule.endsWith('-osgi')) {
+            project.dependencies.add(
+                    binCfg.name,
+                    ['group': pom.groupId, 'name': submodule, 'version': pom.version])
         }
+    }
 
-        Release.rewritePom(checkoutSnapshot.localDir, nextVer, devRepo)
-
-        nextVerFile.text = nextVer
-
-        println "New development version: ${nextVer}"
+    if (!HC_DIST_STAGING) {
+        throw InvalidUserDataException("HC_DIST_STAGING not set")
     }
 
-    task prepareNextVersion(dependsOn: 'chooseNextVersion') << {
-        Svn.status(checkoutSnapshot.localDir)
-        println "Local changeset for next development version ${nextVer} " +
-                "can be found at ${checkoutSnapshot.localDir}"
+    task checkoutDistStage(type: SvnGet) {
+        group = 'Repository'
+        description = "Checks out dist staging from '${HC_DIST_STAGING}'."
+        repo = new URI(HC_DIST_STAGING)
     }
 
-    if (rcReady) {
+    task updateDistStage(type: SvnUpdate, dependsOn: checkoutDistStage) {
+        group = 'Repository'
+        description = "Checks out dist staging from '${HC_DIST_STAGING}'."
+        repo = checkoutDistStage.repo
+    }
 
-        File dir = checkoutRC.localDir
-        Pom pom = Mvn.parsePom(dir)
+    configurations {
+        dist
+    }
 
-        Configuration binCfg = project.configurations.create('rc')
-        // Declare dependencies (excluding OSGi bundle)
-        pom.modules.each { String submodule ->
-            if (!submodule.endsWith('-osgi')) {
-                project.dependencies.add(
-                        binCfg.name,
-                        ['group': pom.groupId, 'name': submodule, 'version': pom.version])
-            }
-        }
+    task distWinBin(type: Zip) {
+        with docs(dir, pom, Line.CRLF), atrifacts(configurations.rc)
+        classifier = 'bin'
+    }
 
-        task prepareDistStage(type: SvnGet) {
-            if (!HC_DIST_STAGING) {
-                throw InvalidUserDataException("HC_DIST_STAGING not set")
-            }
-            repo = new URI(HC_DIST_STAGING)
-        }
+    task distUxBin(type: Tar) {
+        with docs(dir, pom, Line.LF), atrifacts(configurations.rc)
+        classifier = 'bin'
+    }
 
-        configurations {
-            dist
-        }
+    task distWinOSGiBin(type: Zip) {
+        with docs(dir, pom, Line.CRLF), osgiBundle(dir, pom)
+        classifier = 'osgi-bin'
+    }
 
-        task distWinBin(type: Zip) {
-            with docs(dir, pom, Line.CRLF), atrifacts(configurations.rc)
-            classifier = 'bin'
-        }
+    task distUxOSGiBin(type: Tar) {
+        with docs(dir, pom, Line.LF), osgiBundle(dir, pom)
+        classifier = 'osgi-bin'
+    }
 
-        task distUxBin(type: Tar) {
-            with docs(dir, pom, Line.LF), atrifacts(configurations.rc)
-            classifier = 'bin'
-        }
+    task distWinSrc(type: Zip) {
+        with sources(dir, pom, Line.CRLF)
+        into "${pom.artifactId}-${pom.version}"
+        classifier = 'src'
+    }
 
-        task distWinOSGiBin(type: Zip) {
-            with docs(dir, pom, Line.CRLF), osgiBundle(dir, pom)
-            classifier = 'osgi-bin'
-        }
+    task distUxSrc(type: Tar) {
+        with sources(dir, pom, Line.LF)
+        into "${pom.artifactId}-${pom.version}"
+        classifier = 'src'
+    }
 
-        task distUxOSGiBin(type: Tar) {
-            with docs(dir, pom, Line.LF), osgiBundle(dir, pom)
-            classifier = 'osgi-bin'
-        }
+    String rcName = getProductName(pom.artifactId).toLowerCase(Locale.US)
+    String rcFullName = "${rcName}-${pom.version}-${rcQualifier}"
+    String releaseNotes = "RELEASE_NOTES-${pom.major}.${pom.minor}.x.txt"
 
-        task distWinSrc(type: Zip) {
-            with sources(dir, pom, Line.CRLF)
-            into "${pom.artifactId}-${pom.version}"
-            classifier = 'src'
-        }
+    tasks.withType(AbstractArchiveTask) { AbstractArchiveTask archive ->
+        archive.dependsOn checkoutDistStage
+        archive.baseName = pom.artifactId
+        archive.version = pom.version
+        archive.destinationDir = file("${checkoutDistStage.localDir}/${rcFullName}")
+    }
 
-        task distUxSrc(type: Tar) {
-            with sources(dir, pom, Line.LF)
-            into "${pom.artifactId}-${pom.version}"
-            classifier = 'src'
-        }
+    tasks.withType(Tar) { Tar tar ->
+        tar.extension = "tar.gz"
+        tar.compression = Compression.GZIP
+    }
 
-        String rcName = getProductName(pom.artifactId).toLowerCase(Locale.US)
-        String rcFullName = "${rcName}-${pom.version}-${rcQualifier}"
-        String releaseNotes = "RELEASE_NOTES-${pom.major}.${pom.minor}.x.txt"
+    tasks.withType(Tar) { Tar tar ->
+        tar.extension = "tar.gz"
+        tar.compression = Compression.GZIP
+    }
 
-        tasks.withType(AbstractArchiveTask) { AbstractArchiveTask archive ->
-            archive.dependsOn prepareDistStage
-            archive.baseName = pom.artifactId
-            archive.version = pom.version
-            archive.destinationDir = file("${prepareDistStage.localDir}/${rcFullName}")
-        }
+    task sign(type: Sign, dependsOn: checkoutDistStage) {
+        sign configurations.dist
+    }
 
-        tasks.withType(Tar) { Tar tar ->
-            tar.extension = "tar.gz"
-            tar.compression = Compression.GZIP
-        }
+    task digest(type: Digest, dependsOn: checkoutDistStage) {
+        digest configurations.dist
+    }
 
-        tasks.withType(Tar) { Tar tar ->
-            tar.extension = "tar.gz"
-            tar.compression = Compression.GZIP
-        }
+    task docs(type: Copy, dependsOn: checkoutDistStage) {
+        from "${checkoutRC.localDir}/RELEASE_NOTES.txt"
+        into "${checkoutDistStage.localDir}/${rcFullName}"
+        rename { releaseNotes }
+    }
 
-        task sign(type: Sign, dependsOn: prepareDistStage) {
-            sign configurations.dist
+    artifacts {
+        tasks.withType(AbstractArchiveTask) { AbstractArchiveTask archive ->
+            dist archive
         }
-
-        task digest(type: Digest, dependsOn: prepareDistStage) {
-            digest configurations.dist
+        sign.signatures.each { PublishArtifact artifact ->
+            archives artifact
         }
-
-        task docs(type: Copy, dependsOn: prepareDistStage) {
-            from "${checkoutRC.localDir}/RELEASE_NOTES.txt"
-            into "${prepareDistStage.localDir}/${rcFullName}"
-            rename { releaseNotes }
+        digest.hashes.each { PublishArtifact artifact ->
+            archives artifact
         }
-
-        artifacts {
-            tasks.withType(AbstractArchiveTask) { AbstractArchiveTask archive ->
-                dist archive
-            }
-            sign.signatures.each { PublishArtifact artifact ->
-                archives artifact
-            }
-            digest.hashes.each { PublishArtifact artifact ->
-                archives artifact
-            }
-            archives(new File(docs.destinationDir, releaseNotes)) {
-                classifier = 'doc'
-            }
+        archives(new File(docs.destinationDir, releaseNotes)) {
+            classifier = 'doc'
         }
+    }
 
-        assemble.dependsOn = [sign, digest, docs]
+    assemble.dependsOn = [sign, digest, docs]
 
-        task svnmucc() << {
+    task svnmucc() {
+        group = 'Release candidate'
+        description = "Generates svnmucc command file."
+        doLast {
             println 'svnmucc file'
             println '----------------8<-------------[ cut here ]------------------'
             println "rm"
@@ -375,24 +377,74 @@ if (rcTag) {
             println "dev/httpcomponents/${rcFullName}"
             println '----------------8<-------------[ cut here ]------------------'
         }
+    }
+
+    task promoteRC() {
+        group = 'Release candidate'
+        description = "Promotes RC to official release."
+        doLast {
+            File pomFile = new File(checkoutRC.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
+
+            println "Promoting ${name} ${releaseVer} ${rcQualifier } to official release"
+
+            println "Copying ${rcTag} to ${releaseTag}"
+            Svn.copyRemote(rcTag, releaseTag, "${name} ${releaseVer} release tag")
+
+            rcPromotedFile.text = 'true'
+        }
+    }
+
+}
+
+
+if (rcPromoted) {
+
+    task prepareNextVersion() {
+        group = 'Release management'
+        description = "Prepares next development version."
+        doLast {
+            nextVer = Release.upgradeVersion(releaseVer)
+            console.println("Please enter new development version: [defaults to ${nextVer}]")
+            String s = console.readLine()
+            if (s) {
+                nextVer = s
+            }
+            if (!nextVer.endsWith('-SNAPSHOT')) {
+                nextVer = nextVer + '-SNAPSHOT'
+            }
+
+            Release.rewritePom(checkoutSnapshot.localDir, nextVer, devRepo)
 
+            Svn.status(checkoutSnapshot.localDir)
+            println "Local changeset for next development version ${nextVer} " +
+                    "can be found at ${checkoutSnapshot.localDir}"
+
+            nextVerFile.text = nextVer
+        }
     }
 
 }
 
 if (nextVer) {
 
-    task commitNextVersion() << {
-        File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
-        def pomModel = new XmlSlurper().parse(pomFile)
-        String artifactId = pomModel.artifactId
-        String name = getProductName(artifactId)
+    task commitNextVersion() {
+        group = 'Release management'
+        description = "Commits next development version."
+        doLast {
+            File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
+            def pomModel = new XmlSlurper().parse(pomFile)
+            String artifactId = pomModel.artifactId
+            String name = getProductName(artifactId)
 
-        println "Upgrading ${name} version to ${nextVer}"
+            println "Upgrading ${name} version to ${nextVer}"
 
-        Svn.commit(checkoutSnapshot.localDir, "Upgraded ${name} version to ${nextVer}")
+            Svn.commit(checkoutSnapshot.localDir, "Upgraded ${name} version to ${nextVer}")
 
-        println ""
+            println ""
+        }
     }
 
 }

Modified: httpcomponents/project-release-tools/trunk/gradle.properties.template
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/gradle.properties.template?rev=1522479&r1=1522478&r2=1522479&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/gradle.properties.template (original)
+++ httpcomponents/project-release-tools/trunk/gradle.properties.template Thu Sep 12 08:30:45 2013
@@ -1,16 +1,11 @@
 MAVEN_HOME=/opt/maven
 
+HC_DIST_STAGING=https://dist.apache.org/repos/dist/dev/httpcomponents/
 HC_SITE_STAGING=http://svn.apache.org/repos/asf/httpcomponents/site/
-
 HC_PROJECT_SITE=http://svn.apache.org/repos/asf/httpcomponents/project-website/trunk/
-HC_PUBLISHED_RELEASES=\
-  http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/ \
-  http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/ \
-  http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/
 
-HC_RC=http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/
-HC_DIST_STAGING=https://dist.apache.org/repos/dist/dev/httpcomponents/
+HC_PUBLISHED_RELEASES=
 
 signing.keyId=
 signing.password=
-signing.secretKeyRingFile=$HOME.gnupg/secring.gpg
\ No newline at end of file
+signing.secretKeyRingFile=$HOME/.gnupg/secring.gpg
\ No newline at end of file