commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [2/2] commons-release-plugin git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-release-plugin.git
Date Fri, 18 May 2018 17:02:09 GMT
Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/commons-release-plugin.git

Conflicts:
	src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java


Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/2c2402c3
Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/2c2402c3
Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/2c2402c3

Branch: refs/heads/master
Commit: 2c2402c3a205e6e5409dcd8611da0c3a6ad1eedb
Parents: 9ce2be1 bef9b22
Author: Gary Gregory <garydgregory@gmail.com>
Authored: Fri May 18 11:02:02 2018 -0600
Committer: Gary Gregory <garydgregory@gmail.com>
Committed: Fri May 18 11:02:02 2018 -0600

----------------------------------------------------------------------
 pom.xml                                         | 24 ++++---
 .../CommonsDistributionDetachmentMojo.java      | 69 +++++++++-----------
 .../vote-txt-template.txt                       |  1 +
 src/main/scripts/generate-xdocs.build.xml       |  6 +-
 4 files changed, 52 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/2c2402c3/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
index a3aee29,40fd2fc..376fd78
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
@@@ -21,7 -20,7 +21,6 @@@ import java.io.FileInputStream
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.PrintWriter;
--import java.nio.file.Files;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashSet;
@@@ -165,37 -154,10 +164,37 @@@ public class CommonsDistributionDetachm
                  .append(artifact.getArtifactId()).append('-')
                  .append(artifact.getVersion()).append('-')
                  .append(artifact.getType());
 -            artifactSha1s.put(
 -                artifactKey.toString(),
 -                DigestUtils.sha1Hex(Files.readAllBytes(artifact.getFile().toPath()))
 -            );
 +            try (FileInputStream fis = new FileInputStream(artifact.getFile())) {
 +                artifactSha1s.put(artifactKey.toString(), DigestUtils.sha1Hex(fis));
 +            }
 +        } catch (IOException e) {
 +            throw new MojoExecutionException(
 +                "Could not find artifact signature for: "
 +                    + artifact.getArtifactId()
 +                    + "-"
 +                    + artifact.getVersion()
 +                    + " type: "
-                     + artifact.getType()
-                 ,e);
++                    + artifact.getType(),
++                e);
 +        }
 +    }
 +
 +    /**
 +     * Takes an attached artifact and puts the signature in the map.
 +     * @param artifact is a maven {@link Artifact} taken from the project at start time
of mojo.
 +     * @throws MojoExecutionException if an {@link IOException} occurs when getting the
sha1 of the
 +     *                                artifact.
 +     */
 +    private void putAttachedArtifactInSha256Map(Artifact artifact) throws MojoExecutionException
{
 +        try {
 +            StringBuffer artifactKey = new StringBuffer();
 +            artifactKey
 +                .append(artifact.getArtifactId()).append('-')
 +                .append(artifact.getVersion()).append('-')
 +                .append(artifact.getType());
 +            try (FileInputStream fis = new FileInputStream(artifact.getFile())) {
 +                artifactSha256s.put(artifactKey.toString(), DigestUtils.sha256Hex(fis));
 +            }
          } catch (IOException e) {
              throw new MojoExecutionException(
                  "Could not find artifact signature for: "
@@@ -263,47 -211,23 +262,39 @@@
       *  the {@link CommonsDistributionStagingMojo}.
       *
       * @throws MojoExecutionException if some form of an {@link IOException} occurs, we
want it
-      *                                properly wrapped so that Maven can handle it.
+      *                                properly wrapped so that maven can handle it.
       */
 -    private void sha1AndMd5SignArtifacts() throws MojoExecutionException {
 +    private void hashArtifacts() throws MojoExecutionException {
          for (Artifact artifact : detachedArtifacts) {
              if (!artifact.getFile().getName().contains("asc")) {
                  try {
-                     {
-                         // MD5
-                         final String digest;
-                         try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
-                             digest = DigestUtils.md5Hex(fis);
-                         }
-                         getLog().info(artifact.getFile().getName() + " md5: " + digest);
-                         try (PrintWriter printWriter = new PrintWriter(
-                                 getMd5FilePath(workingDirectory, artifact.getFile()))) {
-                             printWriter.println(digest);
-                         }
 -                    String md5 = DigestUtils.md5Hex(Files.readAllBytes(artifact.getFile().toPath()));
 -                    getLog().info(artifact.getFile().getName() + " md5: " + md5);
 -                    try (PrintWriter md5Writer =
 -                        new PrintWriter(getMd5FilePath(workingDirectory, artifact.getFile())))
{
 -                        md5Writer.println(md5);
++                    // MD5
++                    String digest;
++                    try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
++                        digest = DigestUtils.md5Hex(fis);
++                    }
++                    getLog().info(artifact.getFile().getName() + " md5: " + digest);
++                    try (PrintWriter printWriter = new PrintWriter(
++                            getMd5FilePath(workingDirectory, artifact.getFile()))) {
++                        printWriter.println(digest);
++                    }
++                    // SHA-1
++                    try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
++                        digest = DigestUtils.sha1Hex(fis);
++                    }
++                    getLog().info(artifact.getFile().getName() + " sha1: " + digest);
++                    try (PrintWriter printWriter = new PrintWriter(
++                            getSha1FilePath(workingDirectory, artifact.getFile()))) {
++                        printWriter.println(digest);
                      }
-                     {
-                         // SHA-1
-                         final String digest;
-                         try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
-                             digest = DigestUtils.sha1Hex(fis);
-                         }
-                         getLog().info(artifact.getFile().getName() + " sha1: " + digest);
-                         try (PrintWriter printWriter = new PrintWriter(
-                                 getSha1FilePath(workingDirectory, artifact.getFile())))
{
-                             printWriter.println(digest);
-                         }
 -                    String sha1 = DigestUtils.sha1Hex(Files.readAllBytes(artifact.getFile().toPath()));
 -                    getLog().info(artifact.getFile().getName() + " sha1: " + sha1);
 -                    try (PrintWriter sha1Writer =
 -                        new PrintWriter(getSha1FilePath(workingDirectory, artifact.getFile())))
{
 -                        sha1Writer.println(sha1);
++                    // SHA-256
++                    try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
++                        digest = DigestUtils.sha256Hex(fis);
 +                    }
-                     {
-                         // SHA-256
-                         final String digest;
-                         try (FileInputStream fis = new FileInputStream(artifact.getFile()))
{
-                             digest = DigestUtils.sha256Hex(fis);
-                         }
-                         getLog().info(artifact.getFile().getName() + " sha256: " + digest);
-                         try (PrintWriter printWriter = new PrintWriter(
-                                 getSha256FilePath(workingDirectory, artifact.getFile())))
{
-                             printWriter.println(digest);
-                         }
++                    getLog().info(artifact.getFile().getName() + " sha256: " + digest);
++                    try (PrintWriter printWriter = new PrintWriter(
++                            getSha256FilePath(workingDirectory, artifact.getFile()))) {
++                        printWriter.println(digest);
                      }
                  } catch (IOException e) {
                      throw new MojoExecutionException("Could not sign file: " + artifact.getFile().getName(),
e);

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/2c2402c3/src/main/resources/commons-xdoc-templates/vote-txt-template.txt
----------------------------------------------------------------------
diff --cc src/main/resources/commons-xdoc-templates/vote-txt-template.txt
index 65c722f,65c722f..668609a
--- a/src/main/resources/commons-xdoc-templates/vote-txt-template.txt
+++ b/src/main/resources/commons-xdoc-templates/vote-txt-template.txt
@@@ -36,6 -36,6 +36,7 @@@ Maven artifacts are here
  These are the Maven artifacts and their hashes in Nexus:
  
  @SHA1LIST@
++@SHA256LIST@
  
  (no need for .asc hashes!)
  

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/2c2402c3/src/main/scripts/generate-xdocs.build.xml
----------------------------------------------------------------------
diff --cc src/main/scripts/generate-xdocs.build.xml
index be32372,be32372..0745599
--- a/src/main/scripts/generate-xdocs.build.xml
+++ b/src/main/scripts/generate-xdocs.build.xml
@@@ -56,9 -56,9 +56,12 @@@
          <!-- Create a temporary directory to load the template files into -->
          <mkdir dir="${commonsMojoTempDir}"/>
  
--    	<!-- Load SHA1 file created by the deploy goal -->
++    	<!-- Load SHA-1 file created by the deploy goal -->
      	<loadfile property="commons.sha1list" srcFile="target/commons-release-plugin/sha1.properties"/>
      	
++    	<!-- Load SHA-256 file created by the deploy goal -->
++    	<loadfile property="commons.sha256list" srcFile="target/commons-release-plugin/sha256.properties"/>
++    	
          <!-- Load the vote-txt template from mojo resources to temp directory -->
          <loadresource property="vote-txt">
              <javaresource name="${commonsMojoXdocDir}/vote-txt-template.txt"/>
@@@ -105,6 -105,6 +108,7 @@@
               <filter token="RMKEY"          value="${commons.releaseManagerKey}"/>
           	
               <filter token="RCREV"          value="${svn.rc.revision}"/>         
  	
               <filter token="SHA1LIST"       value="${commons.sha1list}"/>        
   	
++             <filter token="SHA256LIST"     value="${commons.sha256list}"/>      
     	
               <filter token="DISTURL"        value="${svn.dist.url}"/>            

               <filter token="TAGNAME"        value="${git.tag.name}"/>            

               <filter token="TAGCOMMIT"      value="${git.tag.commit}"/>          
 	


Mime
View raw message