You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/03/24 17:00:38 UTC

[tomcat] branch 10.0.x updated: Fix build when ant.tstamp.now is not specified

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

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
     new 986d898  Fix build when ant.tstamp.now is not specified
986d898 is described below

commit 986d898d6e3dfc3f3bd0d0762a4380b7c65b419a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 24 17:00:22 2022 +0000

    Fix build when ant.tstamp.now is not specified
---
 build.xml                                          |  2 +-
 .../apache/tomcat/buildutil/RepeatableArchive.java | 23 +++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/build.xml b/build.xml
index 0564170..855e05d 100644
--- a/build.xml
+++ b/build.xml
@@ -2840,7 +2840,7 @@ skip.installer property in build.properties" />
     <taskdef name="repeatableArchive"
              classname="org.apache.tomcat.buildutil.RepeatableArchive"
              classpath="${tomcat.classes}" />
-    <repeatableArchive datetime="${ant.tstamp.now}">
+    <repeatableArchive datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
       <fileset dir="${tomcat.dist}/webapps/docs">
         <include name="**/*.zip"/>
       </fileset>
diff --git a/java/org/apache/tomcat/buildutil/RepeatableArchive.java b/java/org/apache/tomcat/buildutil/RepeatableArchive.java
index 2997588..1348ee6 100644
--- a/java/org/apache/tomcat/buildutil/RepeatableArchive.java
+++ b/java/org/apache/tomcat/buildutil/RepeatableArchive.java
@@ -23,6 +23,9 @@ import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.FileTime;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.LinkedList;
 import java.util.List;
@@ -48,7 +51,8 @@ public class RepeatableArchive extends Task {
 
     private final List<FileSet> filesets = new LinkedList<>();
 
-    private long datetime;
+    private String datetime;
+    private String pattern;
 
     /**
      * Sets the files to be processed
@@ -60,16 +64,29 @@ public class RepeatableArchive extends Task {
     }
 
 
-    public void setDatetime(long datetime) {
+    public void setDatetime(String datetime) {
         this.datetime = datetime;
     }
 
 
+    public void setPattern(String pattern) {
+        this.pattern = pattern;
+    }
+
+
     @Override
     public void execute() throws BuildException {
 
+        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+        Date date;
+        try {
+            date = sdf.parse(datetime);
+        } catch (ParseException e) {
+            throw new BuildException(e);
+        }
+
         byte[] buf = new byte[8192];
-        FileTime lastModified = FileTime.fromMillis(datetime);
+        FileTime lastModified = FileTime.fromMillis(date.getTime());
 
         for (FileSet fs : filesets) {
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org