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/10/05 17:22:27 UTC

[maven-source-plugin] branch MSOURCES-120 updated: use the new project.build.outputTimestamp property

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 3ebe54f  use the new project.build.outputTimestamp property
3ebe54f is described below

commit 3ebe54f51b22b03679dfeb02b465eeca3d3c5b3b
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat Oct 5 19:22:23 2019 +0200

    use the new project.build.outputTimestamp property
---
 src/it/reproducible/pom.xml                               |  2 +-
 src/it/reproducible/verify.groovy                         |  2 +-
 .../maven/plugins/source/AbstractSourceJarMojo.java       | 15 +++++----------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/it/reproducible/pom.xml b/src/it/reproducible/pom.xml
index 572e292..cc024f7 100644
--- a/src/it/reproducible/pom.xml
+++ b/src/it/reproducible/pom.xml
@@ -31,7 +31,7 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <source-date-epoch>1566419331</source-date-epoch>
+    <project.build.outputTimestamp>2019-08-21T18:28:52Z</project.build.outputTimestamp>
   </properties>
 
   <build>
diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
index 83c352b..6d15c49 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -73,6 +73,6 @@ zipFile.close();
 String buf = r.toString()
 println buf
 
-String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c7ea4f558b19c78f65795b574fe9933b83b76b63' : 'e6d0222375a93e4e3a8f2e139361d5925151c5bd'
+String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c7ea4f558b19c78f65795b574fe9933b83b76b63' : '9ea034f864b3896945fc792d4fcc0e3978bc3252'
 
 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 94ca4fb..99f4b1a 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -197,14 +197,12 @@ public abstract class AbstractSourceJarMojo
     private MavenSession session;
 
     /**
-     * Value like SOURCE_DATE_EPOCH as <a href="https://reproducible-builds.org/specs/source-date-epoch/">defined in
-     * Reproducible Builds</a>: a UNIX timestamp, defined as the number of seconds, excluding leap seconds, since 01 Jan
-     * 1970 00:00:00 UTC.
+     * Timestamp for reproducible archive entries.
      *
      * @since 3.1.1
      */
-    @Parameter( name = "source-date-epoch", defaultValue = "${source-date-epoch}" )
-    private int sourceDateEpoch;
+    @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+    private String outputTimestamp;
 
     // ----------------------------------------------------------------------
     // Public methods
@@ -281,11 +279,8 @@ public abstract class AbstractSourceJarMojo
 
         MavenArchiver archiver = createArchiver();
         
-        if ( sourceDateEpoch != 0 )
-        {
-            // configure for Reproducible Builds based on source date epoch value
-            archiver.getArchiver().configureReproducible( sourceDateEpoch );
-        }
+        // configure for Reproducible Builds based on outputTimestamp value
+        archiver.configureReproducible( outputTimestamp );
 
         for ( MavenProject pItem : theProjects )
         {