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/07/14 22:03:54 UTC
svn commit: r1503044 - in /httpcomponents/project-release-tools/trunk:
buildSrc/src/main/groovy/Digest.groovy buildSrc/src/main/groovy/MD5.groovy
gradle.properties.template rc.gradle
Author: olegk
Date: Sun Jul 14 20:03:54 2013
New Revision: 1503044
URL: http://svn.apache.org/r1503044
Log:
Added tasks to generate MD5 digest and signatures for release dists
Added:
httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Digest.groovy
httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/MD5.groovy
Modified:
httpcomponents/project-release-tools/trunk/gradle.properties.template
httpcomponents/project-release-tools/trunk/rc.gradle
Added: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Digest.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Digest.groovy?rev=1503044&view=auto
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Digest.groovy (added)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Digest.groovy Sun Jul 14 20:03:54 2013
@@ -0,0 +1,79 @@
+/*
+ * ====================================================================
+ * 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.api.DefaultTask
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.PublishArtifact
+import org.gradle.api.file.FileCollection
+import org.gradle.api.file.FileTree
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputFiles
+import org.gradle.api.tasks.TaskAction
+
+class Digest extends DefaultTask {
+
+ private Set<PublishArtifact> artifacts = new HashSet()
+
+ void digest(PublishArtifact... artifacts) {
+ for (PublishArtifact artifact in artifacts) {
+ this.artifacts.add(artifact)
+ dependsOn(artifact)
+ }
+ }
+
+ void digest(Configuration... configurations) {
+ for (Configuration configuration in configurations) {
+ configuration.allArtifacts.all { PublishArtifact artifact ->
+ digest(artifact)
+ }
+ }
+ }
+
+ @InputFiles
+ List<File> getSourceFiles() {
+ artifacts*.file
+ }
+
+ @OutputFiles
+ List<File> getDigestFiles() {
+ artifacts.collect { PublishArtifact artifact ->
+ File file = artifact.file
+ new File(file.parent, file.name + ".md5")
+ }
+ }
+
+ @TaskAction
+ void generate() {
+ artifacts.each { PublishArtifact artifact ->
+ File file = artifact.file
+ File digest = new File(file.parent, file.name + ".md5")
+ digest.text = MD5.digest(file)
+ digest
+ }
+ }
+
+}
\ No newline at end of file
Added: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/MD5.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/MD5.groovy?rev=1503044&view=auto
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/MD5.groovy (added)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/MD5.groovy Sun Jul 14 20:03:54 2013
@@ -0,0 +1,41 @@
+/*
+ * ====================================================================
+ * 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 java.security.MessageDigest
+
+/**
+ * Copied from Tapestry 5.
+ */
+class MD5 {
+
+ static String digest(File file) {
+ MessageDigest digest = MessageDigest.getInstance("MD5")
+ digest.update(file.bytes)
+ new BigInteger(1, digest.digest()).toString(16).padLeft(32, "0")
+ }
+
+}
Modified: httpcomponents/project-release-tools/trunk/gradle.properties.template
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/gradle.properties.template?rev=1503044&r1=1503043&r2=1503044&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/gradle.properties.template (original)
+++ httpcomponents/project-release-tools/trunk/gradle.properties.template Sun Jul 14 20:03:54 2013
@@ -9,3 +9,7 @@ HC_PUBLISHED_RELEASES=\
http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/
HC_RC=http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/
+
+signing.keyId=
+signing.password=
+signing.secretKeyRingFile=$HOME.gnupg/secring.gpg
\ No newline at end of file
Modified: httpcomponents/project-release-tools/trunk/rc.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/rc.gradle?rev=1503044&r1=1503043&r2=1503044&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/rc.gradle (original)
+++ httpcomponents/project-release-tools/trunk/rc.gradle Sun Jul 14 20:03:54 2013
@@ -25,6 +25,8 @@
*
*/
+apply plugin: 'signing'
+
repositories {
mavenLocal()
}
@@ -56,13 +58,6 @@ rc.pom.modules.each { String submodule -
}
}
-task clean << {
- File dst = file("${buildDir}/dists")
- if (dst.exists()) {
- GFileUtils.cleanDirectory(dst)
- }
-}
-
task generate << {
logger.info("Generating RC artifacts ${rc.pom.artifactId}:${rc.pom.version}")
mvn.exec(rc.localDir,
@@ -123,8 +118,20 @@ task distUxSrc(type: Tar) {
extension = "tar.gz"
}
-task dist(dependsOn: ['distWinBin', 'distUxBin',
- 'distWinOSGiBin', 'distUxOSGiBin', 'distWinSrc', 'distUxSrc']) {
+configurations {
+ dist
+}
+
+artifacts {
+ dist distWinBin, distUxBin, distWinOSGiBin, distUxOSGiBin, distWinSrc, distUxSrc
+}
+
+task sign(type: Sign) {
+ sign configurations.dist
+}
+
+task digest(type: Digest) {
+ digest configurations.dist
}
CopySpec docs(HCProject hcProject, String delim) {