You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/06/13 06:27:00 UTC

[jira] [Commented] (MSHARED-1066) Upgrade Plexus Archiver to 4.3.0

    [ https://issues.apache.org/jira/browse/MSHARED-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553400#comment-17553400 ] 

ASF GitHub Bot commented on MSHARED-1066:
-----------------------------------------

michael-o commented on code in PR #22:
URL: https://github.com/apache/maven-archiver/pull/22#discussion_r895363820


##########
src/main/java/org/apache/maven/archiver/MavenArchiver.java:
##########
@@ -812,28 +814,70 @@ public void setBuildJdkSpecDefaultEntry( boolean buildJdkSpecDefaultEntry )
      * @return the parsed timestamp, may be <code>null</code> if <code>null</code> input or input contains only 1
      *         character
      * @since 3.5.0
-     * @throws java.lang.IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an integer
+     * @throws IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an integer
+     * @deprecated Use {@link #parseBuildOutputTimestamp(String)} instead.
      */
+    @Deprecated
     public Date parseOutputTimestamp( String outputTimestamp )
     {
+        return parseBuildOutputTimestamp( outputTimestamp ).map( Date::from ).orElse( null );
+    }
+
+    /**
+     * Configure Reproducible Builds archive creation if a timestamp is provided.
+     *
+     * @param outputTimestamp the value of {@code ${project.build.outputTimestamp}} (may be {@code null})
+     * @return the parsed timestamp as {@link java.util.Date}
+     * @since 3.5.0
+     * @see #parseOutputTimestamp
+     * @deprecated Use {@link #configureReproducibleBuild(String)} instead.
+     */
+    @Deprecated
+    public Date configureReproducible( String outputTimestamp )
+    {
+        configureReproducibleBuild( outputTimestamp );
+        return parseOutputTimestamp( outputTimestamp );
+    }
+
+    /**
+     * Parse output timestamp configured for Reproducible Builds' archive entries.
+     *
+     * <p>Either as {@link java.time.format.DateTimeFormatter#ISO_INSTANT} or as a number representing seconds since the
+     * epoch (like <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
+     *
+     * @param outputTimestamp the value of {@code ${project.build.outputTimestamp}} (may be {@code null})
+     * @return the parsed timestamp as an {@code Optional<Instant>}, {@code empty} if input is {@code null} or input
+     *         contains only 1 character (not a number)
+     * @since 3.6.0
+     * @throws IllegalArgumentException if the outputTimestamp is neither ISO 8601 nor an integer
+     */
+    public static Optional<Instant> parseBuildOutputTimestamp( String outputTimestamp )
+    {
+        // Fail-fast on nulls
+        if ( outputTimestamp == null )
+        {
+            return Optional.empty();
+        }
+
+        // Number representing seconds since the epoch
         if ( StringUtils.isNumeric( outputTimestamp ) && StringUtils.isNotEmpty( outputTimestamp ) )

Review Comment:
   Interesting, can it be empty if it is a numeric?





> Upgrade Plexus Archiver to 4.3.0
> --------------------------------
>
>                 Key: MSHARED-1066
>                 URL: https://issues.apache.org/jira/browse/MSHARED-1066
>             Project: Maven Shared Components
>          Issue Type: Dependency upgrade
>          Components: maven-archiver
>    Affects Versions: maven-archiver-3.5.2
>            Reporter: Jorge Solórzano
>            Priority: Major
>             Fix For: maven-archiver-3.6.0
>
>
> Maven Archiver 3.6.0 should update to Plexus Archiver 4.3.0 (once it's released), it contains fixes to reproducible modular jars and also target Java 8.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)