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 2016/02/26 12:40:42 UTC

svn commit: r1732458 - in /httpcomponents/project-release-tools/trunk: build.gradle buildSrc/src/main/groovy/Mvn.groovy buildSrc/src/main/groovy/Pom.groovy buildSrc/src/main/groovy/PomModule.groovy

Author: olegk
Date: Fri Feb 26 11:40:42 2016
New Revision: 1732458

URL: http://svn.apache.org/viewvc?rev=1732458&view=rev
Log:
Updated release scripts to support 5.0 HC branches

Added:
    httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PomModule.groovy
      - copied, changed from r1625996, httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy
Modified:
    httpcomponents/project-release-tools/trunk/build.gradle
    httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Mvn.groovy
    httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy

Modified: httpcomponents/project-release-tools/trunk/build.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/build.gradle?rev=1732458&r1=1732457&r2=1732458&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/build.gradle (original)
+++ httpcomponents/project-release-tools/trunk/build.gradle Fri Feb 26 11:40:42 2016
@@ -295,11 +295,11 @@ if (rcTagFile.exists() && rcRevisionFile
 
         Configuration binCfg = project.configurations.create('rc')
         // Declare dependencies (excluding OSGi bundle)
-        pom.modules.each { String submodule ->
-            if (!submodule.endsWith('-osgi')) {
+        pom.modules.each { PomModule submodule ->
+            if (!submodule.name.endsWith('-osgi')) {
                 project.dependencies.add(
                         binCfg.name,
-                        ['group': pom.groupId, 'name': submodule, 'version': pom.version])
+                        ['group': submodule.artifact.groupId, 'name': submodule.artifact.id, 'version': submodule.artifact.version])
             }
         }
 
@@ -309,37 +309,37 @@ if (rcTagFile.exists() && rcRevisionFile
 
         task distWinBin(type: Zip) {
             with docs(dir, pom, Line.CRLF), atrifacts(configurations.rc)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'bin'
         }
 
         task distUxBin(type: Tar) {
             with docs(dir, pom, Line.LF), atrifacts(configurations.rc)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'bin'
         }
 
         task distWinOSGiBin(type: Zip) {
             with docs(dir, pom, Line.CRLF), osgiBundle(dir, pom)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'osgi-bin'
         }
 
         task distUxOSGiBin(type: Tar) {
             with docs(dir, pom, Line.LF), osgiBundle(dir, pom)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'osgi-bin'
         }
 
         task distWinSrc(type: Zip) {
             with sources(dir, pom, Line.CRLF)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'src'
         }
 
         task distUxSrc(type: Tar) {
             with sources(dir, pom, Line.LF)
-            into "${pom.artifactId}-${pom.version}"
+            into "${getPackageName(pom.artifactId)}-${pom.version}"
             classifier = 'src'
         }
 
@@ -350,7 +350,7 @@ if (rcTagFile.exists() && rcRevisionFile
 
         tasks.withType(AbstractArchiveTask) { AbstractArchiveTask archive ->
             archive.dependsOn checkoutDistStage
-            archive.baseName = pom.artifactId
+            archive.baseName = getPackageName(pom.artifactId)
             archive.version = pom.version
             archive.destinationDir = file("${checkoutDistStage.localDir}/${rcFullName}")
         }
@@ -487,10 +487,7 @@ if (rcTagFile.exists() && rcRevisionFile
             description = "Generates release vote message content."
             doLast {
                 Pom pom = Mvn.parsePom(checkoutRC.localDir)
-                String name = pom.name
-                if (name.startsWith('Apache ')) {
-                    name = name.substring(7)
-                }
+                String name = "${getProductName(pom.artifactId)}"
                 String rcQualifier = rcQualifierFile.text.trim()
                 String rcName = getProductName(pom.artifactId).toLowerCase(Locale.US)
                 String rcFullName = "${rcName}-${pom.version}-${rcQualifier}"
@@ -716,18 +713,6 @@ if (releaseTagFile.exists() && releaseRe
 
 }
 
-/////////////////////////// Helper utilities //////////////////////////////////
-
-String getProductName(String artifactId) {
-    Map<String, String> projectMap = [
-            'httpcomponents-core':'HttpCore',
-            'httpcomponents-client':'HttpClient',
-            'httpcomponents-asyncclient':'HttpAsyncClient'
-    ]
-    String s = projectMap[artifactId]
-    s ? s : artifactId
-}
-
 /////////////////////////// Copy specs ////////////////////////////////////////
 
 CopySpec docs(File dir, Pom pom, String delim) {
@@ -746,8 +731,8 @@ CopySpec docs(File dir, Pom pom, String
             into 'tutorial'
         }
     }
-    pom.modules.each { String submodule ->
-        spec.from ("${dir}/${submodule}/target/site/examples") {
+    pom.modules.each { PomModule submodule ->
+        spec.from ("${dir}/${submodule.name}/target/site/examples") {
             into 'examples'
             filter(Line.delim(delim), Line.filter())
         }
@@ -770,9 +755,9 @@ CopySpec atrifacts(Configuration cfg) {
 CopySpec osgiBundle(File dir, Pom pom) {
     CopySpec spec = copySpec {
     }
-    pom.modules.each { String submodule ->
-        if (submodule.endsWith('-osgi')) {
-            spec.from("${dir}/${submodule}/target") {
+    pom.modules.each { PomModule submodule ->
+        if (submodule.name.endsWith('-osgi')) {
+            spec.from("${dir}/${submodule.name}/target") {
                 include "*.jar"
                 exclude "*-sources.jar"
                 exclude "*-javadoc.jar"
@@ -922,18 +907,18 @@ task siteStage(dependsOn: [checkoutSiteS
         tasks.withType(SvnGet) { SvnGet releaseCheckout ->
             if (releaseCheckout.name.startsWith('checkoutPublishedRelease')) {
                 Pom releasePom = Mvn.parsePom(releaseCheckout.localDir)
-                String releaseSeries = "${releasePom.artifactId}-${releasePom.major}.${releasePom.minor}.x"
+                String releaseSeries = "${getPackageName(releasePom.artifactId)}-${releasePom.major}.${releasePom.minor}.x"
                 String releaseStaging = "${checkoutSiteStage.localDir}/${releaseSeries}"
-                println("Copying content of release ${releasePom.artifactId}:${releasePom.version} to ${releaseStaging}")
+                println("Copying content of release ${getPackageName(releasePom.artifactId)}:${releasePom.version} to ${releaseStaging}")
                 copy {
                     into "${checkoutSiteStage.localDir}/${releaseSeries}"
                     with siteContent(releaseCheckout.localDir)
                 }
-                releasePom.modules.each { String submodule ->
-                    println("Copying content of release module ${submodule}:${releasePom.version} to ${releaseStaging}/${submodule}")
+                releasePom.modules.each { PomModule submodule ->
+                    println("Copying content of release module ${submodule.name}:${releasePom.version} to ${releaseStaging}/${submodule.name}")
                     copy {
-                        into "${checkoutSiteStage.localDir}/${releaseSeries}/${submodule}"
-                        with siteContent(file("${releaseCheckout.localDir}/${submodule}"))
+                        into "${checkoutSiteStage.localDir}/${releaseSeries}/${submodule.name}"
+                        with siteContent(file("${releaseCheckout.localDir}/${submodule.name}"))
                     }
                 }
                 fixLinks(releasePom, file(releaseStaging))
@@ -997,8 +982,8 @@ void fixLinks(Pom pom, File dstDir) {
             })
     }
 
-    pom.modules.each { String submodule ->
-        project.fileTree(dir: new File(dstDir, submodule), include: '*.html').each {
+    pom.modules.each { PomModule submodule ->
+        project.fileTree(dir: new File(dstDir, submodule.name), include: '*.html').each {
             File f ->
                 Html.rewriteLinks(f, { URI href, String localName ->
                     if (!href.isAbsolute()) {
@@ -1024,8 +1009,8 @@ void rewriteSiteCss(Pom pom, File dstDir
             w  << '@import url("../../css/hc-maven.css");'
         }
     }
-    pom.modules.each { String submodule ->
-        File moduleDstDir = new File(dstDir, submodule)
+    pom.modules.each { PomModule submodule ->
+        File moduleDstDir = new File(dstDir, submodule.name)
         File moduleSiteCss = new File(moduleDstDir, 'css/site.css')
         if (moduleSiteCss.exists()) {
             moduleSiteCss.withWriter { Writer w ->
@@ -1065,4 +1050,31 @@ gradle.taskGraph.whenReady { TaskExecuti
     taskGraph.allTasks.findAll { Task task -> task instanceof Sign }.each { Sign task ->
         task.doFirst { askPassphrase() }
     }
-}
\ No newline at end of file
+}
+
+/////////////////////////// Helper utilities //////////////////////////////////
+
+String getPackageName(String artifactId) {
+
+    def packageNameMap = [
+            'httpcore5-parent':'httpcomponents-core',
+            'httpclient5-parent':'httpcomponents-client'
+    ]
+
+    String s = packageNameMap[artifactId]
+    s ? s : artifactId
+}
+
+String getProductName(String artifactId) {
+
+    def projectNameMap = [
+            'httpcore5-parent':'HttpCore',
+            'httpclient5-parent':'HttpClient',
+            'httpcomponents-core':'HttpCore',
+            'httpcomponents-client':'HttpClient',
+            'httpcomponents-asyncclient':'HttpAsyncClient'
+    ]
+
+    String s = projectNameMap[artifactId]
+    s ? s : artifactId
+}

Modified: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Mvn.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Mvn.groovy?rev=1732458&r1=1732457&r2=1732458&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Mvn.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Mvn.groovy Fri Feb 26 11:40:42 2016
@@ -61,7 +61,20 @@ class Mvn {
                 pomModel.artifactId.text(),
                 pomModel.version.text())
         String name = pomModel.name
-        new Pom(name, pomParent, artifact, pomModel.modules.module*.text())
+
+        List<PomModule> modules = new ArrayList<>();
+        pomModel.modules.module.each { module ->
+
+            File modulePomFile = new File(new File(dir, module.text()), 'pom.xml')
+            def modulePomModel = new XmlSlurper().parse(modulePomFile)
+            PomArtifact moduleArtifact = new PomArtifact(
+                    artifact.groupId ? artifact.groupId : pomParent.groupId,
+                    modulePomModel.artifactId.text(),
+                    artifact.version)
+            PomModule pomModule = new PomModule(module.text(), moduleArtifact)
+            modules.add(pomModule)
+        }
+        new Pom(name, pomParent, artifact, modules)
     }
 
 }

Modified: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy?rev=1732458&r1=1732457&r2=1732458&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy Fri Feb 26 11:40:42 2016
@@ -30,9 +30,9 @@ class Pom {
     private final String name
     private final PomArtifact parent
     private final PomArtifact artifact
-    private final List<String> modules
+    private final List<PomModule> modules
 
-    Pom(String name, PomArtifact parent, PomArtifact artifact, modules) {
+    Pom(String name, PomArtifact parent, PomArtifact artifact, List<PomModule> modules) {
         this.name = name
         this.parent = parent
         this.artifact = artifact
@@ -79,7 +79,7 @@ class Pom {
         artifact.qualifier
     }
 
-    List<String> getModules() {
+    List<PomModule> getModules() {
         modules
     }
 

Copied: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PomModule.groovy (from r1625996, httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy)
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PomModule.groovy?p2=httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PomModule.groovy&p1=httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy&r1=1625996&r2=1732458&rev=1732458&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Pom.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/PomModule.groovy Fri Feb 26 11:40:42 2016
@@ -25,62 +25,22 @@
  *
  */
 
-class Pom {
+class PomModule {
 
-    private final String name
-    private final PomArtifact parent
-    private final PomArtifact artifact
-    private final List<String> modules
+    final String name
+    final PomArtifact artifact
 
-    Pom(String name, PomArtifact parent, PomArtifact artifact, modules) {
+    PomModule(String name, PomArtifact artifact) {
         this.name = name
-        this.parent = parent
         this.artifact = artifact
-        this.modules = modules
     }
 
     String getName() {
         return name
     }
 
-    String getGroupId() {
-        if (artifact.groupId) {
-            artifact.groupId
-        } else {
-            parent ? parent.groupId : null
-        }
-    }
-
-    String getArtifactId() {
-        artifact.id
-    }
-
-    String getVersion() {
-        artifact.version
-    }
-
-    int getMajor() {
-        artifact.major
-    }
-
-    int getMinor() {
-        artifact.minor
-    }
-
-    int getIncremental() {
-        artifact.incremental
-    }
-
-    int getBuildNumber() {
-        artifact.buildNumber
-    }
-
-    String getQualifier() {
-        artifact.qualifier
-    }
-
-    List<String> getModules() {
-        modules
+    PomArtifact getArtifact() {
+        return artifact
     }
 
 }