You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/09/01 18:06:59 UTC

[maven-source-plugin] branch MSOURCES-120 updated: force Unix mode value to avoid depending on local umask

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MSOURCES-120
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git


The following commit(s) were added to refs/heads/MSOURCES-120 by this push:
     new d1a5338  force Unix mode value to avoid depending on local umask
d1a5338 is described below

commit d1a53383b367a475a4a210856d6551ecdd726a90
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Sep 1 20:06:55 2019 +0200

    force Unix mode value to avoid depending on local umask
---
 src/it/reproducible/verify.groovy                                 | 2 +-
 .../org/apache/maven/plugins/source/AbstractSourceJarMojo.java    | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
index 69b5b1e..46e4124 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -47,6 +47,6 @@ zipFile.close();
 
 String buf = r.toString()
 
-String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c1a0f57e19f6f400da66bee06084a4bdb0d2fc00' : 'c6d46509dffb7ef86212a6089c0a239dccb58b71'
+String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c1a0f57e19f6f400da66bee06084a4bdb0d2fc00' : '7bd062f9b45afb7423f3c004c8080ebad4e98754'
 
 assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = $expectedSha1" )
diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index 255be6a..074ceb5 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -283,8 +283,9 @@ public abstract class AbstractSourceJarMojo
         
         if ( sourceDateEpoch != 0 )
         {
-            archiver.getArchiver().setLastModifiedDate( new Date( 1000L * sourceDateEpoch ) );
-            archiver.getArchiver().setFilenameComparator( new Comparator<String>()
+            JarArchiver j = archiver.getArchiver();
+            j.setLastModifiedDate( new Date( 1000L * sourceDateEpoch ) );
+            j.setFilenameComparator( new Comparator<String>()
             {
                 @Override
                 public int compare( String s1, String s2 )
@@ -292,7 +293,8 @@ public abstract class AbstractSourceJarMojo
                     return s1.compareTo( s2 );
                 }
             } );
-            archiver.getArchiver().setIgnorePermissions( true );
+            j.setFileMode( Archiver.DEFAULT_FILE_MODE ); // notice: will override execute bit on Unix (that is ignored on Windows)
+            j.setDirectoryMode( Archiver.DEFAULT_DIR_MODE );
         }
 
         for ( MavenProject pItem : theProjects )