[maven-source-plugin] branch MSOURCES-120 updated: MSOURCES-120 moved reusable code to plexus-archiver PR #121

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-source-plugin] branch MSOURCES-120 updated: MSOURCES-120 moved reusable code to plexus-archiver PR #121

hboutemy
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 3f5f97f  MSOURCES-120 moved reusable code to plexus-archiver PR #121
3f5f97f is described below

commit 3f5f97fe0927f5166d85e8d5f0b28657bd6ea1c9
Author: Hervé Boutemy <[hidden email]>
AuthorDate: Sun Sep 8 10:26:22 2019 +0200

    MSOURCES-120 moved reusable code to plexus-archiver PR #121
   
    https://github.com/codehaus-plexus/plexus-archiver/pull/121
---
 .../plugins/source/AbstractSourceJarMojo.java      | 26 +---------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

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 da11f2d..421114e 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -23,9 +23,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Comparator;
-import java.util.Date;
 import java.util.List;
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
@@ -285,28 +282,7 @@ public abstract class AbstractSourceJarMojo
         if ( sourceDateEpoch != 0 )
         {
             // configure for Reproducible Builds based on source date epoch value
-            JarArchiver j = archiver.getArchiver();
-
-            // 1. force timestamp of zip entries (at zip storage level, that ignores timezone)
-            Calendar cal = Calendar.getInstance();
-            long zipTime =
-                1000L * sourceDateEpoch - ( cal.get( Calendar.ZONE_OFFSET ) + cal.get( Calendar.DST_OFFSET ) );
-            j.setLastModifiedDate( new Date( zipTime ) );
-
-            // 2. sort filenames in each directory when scanning filesystem
-            j.setFilenameComparator( new Comparator<String>()
-            {
-                @Override
-                public int compare( String s1, String s2 )
-                {
-                    return s1.compareTo( s2 );
-                }
-            } );
-
-            // 3. ignore file/directory mode from filesystem, since they may vary based on local user umask
-            // notice: this overrides execute bit on Unix (that is already ignored on Windows)
-            j.setFileMode( Archiver.DEFAULT_FILE_MODE );
-            j.setDirectoryMode( Archiver.DEFAULT_DIR_MODE );
+            archiver.getArchiver().configureReproducible( sourceDateEpoch );
         }
 
         for ( MavenProject pItem : theProjects )