[prev in list] [next in list] [prev in thread] [next in thread]
List: httpcomponents-commits
Subject: svn commit: r1521762 - in /httpcomponents/project-release-tools/trunk: build.gradle rc.gradle
From: olegk () apache ! org
Date: 2013-09-11 8:57:02
Message-ID: 20130911085702.8E1BC23888A6 () eris ! apache ! org
[Download RAW message or body]
Author: olegk
Date: Wed Sep 11 08:57:02 2013
New Revision: 1521762
URL: http://svn.apache.org/r1521762
Log:
Integrated RC dist generation tasks into build.gradle
Removed:
httpcomponents/project-release-tools/trunk/rc.gradle
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=1521762&r1=1521761&r2=1521762&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/build.gradle (original)
+++ httpcomponents/project-release-tools/trunk/build.gradle Wed Sep 11 08:57:02 2013
@@ -26,6 +26,7 @@
*/
apply plugin: MvnWrapperPlugin
+apply plugin: 'signing'
/////////////////////////// Release current state /////////////////////////////
@@ -49,21 +50,25 @@ String rcQualifier = rcQualifierFile.exi
File rcTagFile = new File(project.buildDir, 'rc-tag.txt')
URI rcTag = rcTagFile.exists() ? new URI(rcTagFile.text.trim()) : null
+File rcReadyFile = new File(project.buildDir, 'rc-ready.txt')
+String rcReady = rcReadyFile.exists() ? new URI(rcReadyFile.text.trim()) : null
+
File nextVerFile = new File(project.buildDir, 'next-ver.txt')
String nextVer = nextVerFile.exists() ? nextVerFile.text.trim() : null
-/////////////////////////// Release tasks /////////////////////////////////////
+/////////////////////////// Repositories //////////////////////////////////////
-task clean() << {
- if (project.buildDir.exists()) {
- GFileUtils.cleanDirectory(project.buildDir)
- }
+// Only local Maven repo
+repositories {
+ mavenLocal()
}
+/////////////////////////// Release tasks /////////////////////////////////////
+
task startReleaseProcess() << {
if (project.buildDir.exists()) {
- [devRepoFile, releaseVerFile, releaseTagFile,
- rcQualifierFile, rcTagFile, nextVerFile].each { File file ->
+ [devRepoFile, releaseVerFile, releaseTagFile, rcQualifierFile, rcTagFile, \
rcReadyFile, nextVerFile] + .each { File file ->
if (file && file.exists()) {
file.delete()
}
@@ -89,6 +94,8 @@ if (devRepo) {
}
task chooseReleaseVersion(dependsOn: 'checkoutSnapshot') << {
+ Svn.revert(checkoutSnapshot.localDir)
+
if (!releaseVer) {
File pomFile = new File(checkoutSnapshot.localDir, 'pom.xml')
def pomModel = new XmlSlurper().parse(pomFile)
@@ -105,12 +112,10 @@ if (devRepo) {
releaseVer = s
}
- Svn.revert(checkoutSnapshot.localDir)
-
releaseTag = Release.rewriteAsReleaseTag(devRepo, releaseVer)
Release.rewritePom(checkoutSnapshot.localDir, releaseVer, releaseTag)
- [rcQualifierFile, rcTagFile, nextVerFile].each { File file ->
+ [rcQualifierFile, rcTagFile, rcReadyFile, nextVerFile].each { File file ->
if (file && file.exists()) {
file.delete()
}
@@ -154,6 +159,12 @@ if (releaseVer) {
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()
+ }
+ }
+
rcTagFile.text = rcTag.toASCIIString()
println "RC tag: ${rcTag}"
@@ -188,6 +199,7 @@ if (rcTag) {
println "Building ${name} ${releaseVer} based on ${rcQualifier}"
mvn.exec(checkoutRC.localDir, 'clean', 'install')
+ rcReadyFile.text = 'true'
}
task promoteRC() << {
@@ -226,6 +238,146 @@ if (rcTag) {
"can be found at ${checkoutSnapshot.localDir}"
}
+ if (rcReady) {
+
+ File dir = checkoutRC.localDir
+ Pom pom = Mvn.parsePom(dir)
+
+ 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 prepareDistStage(type: SvnGet) {
+ if (!HC_DIST_STAGING) {
+ throw InvalidUserDataException("HC_DIST_STAGING not set")
+ }
+ repo = new URI(HC_DIST_STAGING)
+ }
+
+ configurations {
+ dist
+ }
+
+ task distWinBin(type: Zip) {
+ with docs(dir, pom, Line.CRLF), atrifacts(configurations.rc)
+ classifier = 'bin'
+ }
+
+ task distUxBin(type: Tar) {
+ with docs(dir, pom, Line.LF), atrifacts(configurations.rc)
+ classifier = 'bin'
+ }
+
+ task distWinOSGiBin(type: Zip) {
+ with docs(dir, pom, Line.CRLF), osgiBundle(dir, pom)
+ classifier = 'osgi-bin'
+ }
+
+ task distUxOSGiBin(type: Tar) {
+ with docs(dir, pom, Line.LF), osgiBundle(dir, pom)
+ classifier = 'osgi-bin'
+ }
+
+ task distWinSrc(type: Zip) {
+ with sources(dir, pom, Line.CRLF)
+ into "${pom.artifactId}-${pom.version}"
+ classifier = 'src'
+ }
+
+ task distUxSrc(type: Tar) {
+ with sources(dir, pom, Line.LF)
+ into "${pom.artifactId}-${pom.version}"
+ classifier = 'src'
+ }
+
+ 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(AbstractArchiveTask) { AbstractArchiveTask archive ->
+ archive.dependsOn prepareDistStage
+ archive.baseName = pom.artifactId
+ archive.version = pom.version
+ archive.destinationDir = \
file("${prepareDistStage.localDir}/${rcFullName}") + }
+
+ tasks.withType(Tar) { Tar tar ->
+ tar.extension = "tar.gz"
+ tar.compression = Compression.GZIP
+ }
+
+ tasks.withType(Tar) { Tar tar ->
+ tar.extension = "tar.gz"
+ tar.compression = Compression.GZIP
+ }
+
+ task sign(type: Sign, dependsOn: prepareDistStage) {
+ sign configurations.dist
+ }
+
+ task digest(type: Digest, dependsOn: prepareDistStage) {
+ digest configurations.dist
+ }
+
+ task docs(type: Copy, dependsOn: prepareDistStage) {
+ from "${checkoutRC.localDir}/RELEASE_NOTES.txt"
+ into "${prepareDistStage.localDir}/${rcFullName}"
+ rename { releaseNotes }
+ }
+
+ 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'
+ }
+ }
+
+ assemble.dependsOn = [sign, digest, docs]
+
+ task svnmucc() << {
+ println 'svnmucc file'
+ println '----------------8<-------------[ cut here ]------------------'
+ println "rm"
+ println "release/httpcomponents/${rcName}/${releaseNotes}"
+ println ""
+ Configuration cfg = configurations.archives
+ cfg.artifacts.each { PublishArtifact artifact ->
+ println "mv"
+ println "dev/httpcomponents/${rcFullName}/${artifact.file.name}"
+ switch(artifact.classifier) {
+ case ~/^(osgi-)?bin/:
+ println \
"release/httpcomponents/${rcName}/binary/${artifact.file.name}" + \
break + case "src":
+ println \
"release/httpcomponents/${rcName}/source/${artifact.file.name}" + \
break + default:
+ println \
"release/httpcomponents/${rcName}/${artifact.file.name}" + \
break + }
+ println ""
+ }
+ println "rm"
+ println "dev/httpcomponents/${rcFullName}"
+ println '----------------8<-------------[ cut here ]------------------'
+ }
+
+ }
+
}
if (nextVer) {
@@ -247,7 +399,7 @@ if (nextVer) {
/////////////////////////// Helper utilities //////////////////////////////////
-static String getProductName(String artifactId) {
+String getProductName(String artifactId) {
def projectMap = [
'httpcomponents-core':'HttpCore',
'httpcomponents-client':'HttpClient',
@@ -256,3 +408,91 @@ static String getProductName(String arti
String s = projectMap[artifactId]
s ? s : artifactId
}
+
+/////////////////////////// Copy specs ////////////////////////////////////////
+
+CopySpec docs(File dir, Pom pom, String delim) {
+ CopySpec spec = copySpec {
+ from (dir) {
+ include 'README.txt'
+ include 'LICENSE.txt'
+ include 'NOTICE.txt'
+ include 'RELEASE_NOTES.txt'
+ filter(Line.delim(delim), Line.filter())
+ }
+ from ("${dir}/target/site/apidocs") {
+ into 'javadoc'
+ }
+ from ("${dir}/target/site/tutorial") {
+ into 'tutorial'
+ }
+ }
+ pom.modules.each { String submodule ->
+ spec.from ("${dir}/${submodule}/target/site/examples") {
+ into 'examples'
+ filter(Line.delim(delim), Line.filter())
+ }
+ }
+ spec
+}
+
+CopySpec atrifacts(Configuration cfg) {
+ CopySpec spec = copySpec {
+ into 'lib'
+ }
+ cfg.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact artifact ->
+ spec.from(artifact.file.absolutePath) {
+ include artifact.file.name
+ }
+ }
+ spec
+}
+
+CopySpec osgiBundle(File dir, Pom pom) {
+ CopySpec spec = copySpec {
+ }
+ pom.modules.each { String submodule ->
+ if (submodule.endsWith('-osgi')) {
+ spec.from("${dir}/${submodule}/target") {
+ include "*.jar"
+ exclude "*-sources.jar"
+ exclude "*-javadoc.jar"
+ }
+ }
+ }
+ spec
+}
+
+CopySpec sources(File dir, Pom pom, String delim) {
+ copySpec {
+ from (dir) {
+ include '**/src/**'
+ include '**/*.txt'
+ include '**/*.xml'
+ exclude '**/resources/**/*.keystore'
+ exclude '**/resources/**/*.truststore'
+ exclude '**/resources/**/*.png'
+ exclude '**/resources/**/*.jpg'
+ exclude '**/resources/**/*.gif'
+ exclude '**/bin/**'
+ exclude '**/target/**'
+ exclude '**/build/**'
+ exclude '**/lib/**'
+ exclude '**/.*/**'
+ filter(Line.delim(delim), Line.filter())
+ }
+ from (dir) {
+ include '**/resources/**/*.keystore'
+ include '**/resources/**/*.truststore'
+ include '**/resources/**/*.png'
+ include '**/resources/**/*.jpg'
+ include '**/resources/**/*.gif'
+ exclude '**/bin/**'
+ exclude '**/target/**'
+ exclude '**/build/**'
+ exclude '**/lib/**'
+ exclude '**/.*/**'
+ }
+ }
+
+}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic