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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6ea9c73  [MRAR-86] make .rar output reproducible using outputTimestamp
6ea9c73 is described below

commit 6ea9c738f089930b5f27b4e7796808412b1886b0
Author: Hervé Boutemy <hbout...@apache.org>
AuthorDate: Sun May 10 16:12:14 2020 +0200

    [MRAR-86] make .rar output reproducible using outputTimestamp
---
 src/it/filtered/pom.xml                                 |  1 +
 src/main/java/org/apache/maven/plugins/rar/RarMojo.java | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/it/filtered/pom.xml b/src/it/filtered/pom.xml
index dbb3287..2022b0f 100644
--- a/src/it/filtered/pom.xml
+++ b/src/it/filtered/pom.xml
@@ -32,6 +32,7 @@ under the License.
 
   <properties>
     <bestwine>bordeaux</bestwine>
+    
<project.build.outputTimestamp>2020-05-01T12:12:12Z</project.build.outputTimestamp>
   </properties>
 
   <build>
diff --git a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java 
b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
index cc98d28..45120b9 100644
--- a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
@@ -274,6 +274,16 @@ public class RarMojo
     private MavenProject project;
 
     /**
+     * Timestamp for reproducible output archive entries, either formatted as 
ISO 8601
+     * <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds 
since the epoch (like
+     * <a 
href="https://reproducible-builds.org/docs/source-date-epoch/";>SOURCE_DATE_EPOCH</a>).
+     *
+     * @since 3.0.0
+     */
+    @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+    private String outputTimestamp;
+
+    /**
      * The Jar archiver.
      */
     @Component( role = Archiver.class, hint = "jar" )
@@ -369,8 +379,12 @@ public class RarMojo
         {
             MavenArchiver archiver = new MavenArchiver();
             archiver.setArchiver( jarArchiver );
+            archiver.setCreatedBy( "Maven RAR Plugin", 
"org.apache.maven.plugins", "maven-rar-plugin" );
             archiver.setOutputFile( rarFile );
 
+            // configure for Reproducible Builds based on outputTimestamp value
+            archiver.configureReproducible( outputTimestamp );
+
             // Include custom manifest if necessary
             includeCustomManifestFile();
 

Reply via email to