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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 8411469  Reproducible builds: Make non-bnd processed JARs reproducible
8411469 is described below

commit 84114698faaa618d8deb26d9101b2436a38f3317
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 18 12:23:35 2021 +0000

    Reproducible builds: Make non-bnd processed JARs reproducible
---
 build.properties.default |  4 ++++
 build.xml                | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index a0355eb..2103fb9 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -29,6 +29,10 @@ version.build=45
 version.patch=0
 version.suffix=-dev
 
+# ----- Reproducible builds -----
+# Uncomment and set to current time for reproducible builds
+#ant.tstamp.now.iso=2021-03-18T06:00:00Z
+
 # ----- Source control flags -----
 git.branch=master
 
diff --git a/build.xml b/build.xml
index 2593c4c..99300f1 100644
--- a/build.xml
+++ b/build.xml
@@ -261,6 +261,7 @@
     <format property="today" pattern="MMM d yyyy" locale="en" timezone="UTC"/>
     <format property="today-iso-8601" pattern="yyyy-MM-dd" locale="en" 
timezone="UTC"/>
     <format property="tstamp" pattern="HH:mm:ss" locale="en" timezone="UTC"/>
+    <format property="tstamp.file" pattern="MM/dd/yyyy hh:mm:ss aa"/>
   </tstamp>
   <filterset id="version.filters">
     <filter token="YEAR" value="${year}"/>
@@ -985,6 +986,11 @@
     <native2ascii src="java" dest="${tomcat.classes}" 
includes="**/LocalStrings.properties,**/Messages*.properties" encoding="UTF-8"/>
     <native2ascii src="java" dest="${tomcat.i18n}" 
includes="**/LocalStrings_*.properties" encoding="UTF-8"/>
 
+    <!-- Reproducible builds: consistent timestamps for class files and other
+    files placed in JARs -->
+    <touch datetime="${tstamp.file}" pattern="MM/dd/yyyy hh:mm:ss aa">
+      <fileset dir="${tomcat.classes}"/>
+    </touch>
   </target>
 
   <target name="build-manifests" unless="manifests.uptodate"
@@ -1006,6 +1012,10 @@
       <fileset dir="${tomcat.home}/res/META-INF" />
     </copy>
 
+    <!-- Reproducible builds: consistent timestamps for files in META-INF -->
+    <touch datetime="${tstamp.file}" pattern="MM/dd/yyyy hh:mm:ss aa">
+      <fileset dir="${tomcat.manifests}"/>
+    </touch>
   </target>
 
   <target name="package" depends="compile,build-manifests" >
@@ -3666,7 +3676,7 @@ Read the Building page on the Apache Tomcat documentation 
site for details on ho
         <srcfiles file="@{license}" />
       </uptodate>
       <sequential unless:true="${jar.uptodate}">
-        <jar jarfile="@{jarfile}" manifest="@{manifest}" >
+        <zip destfile="@{jarfile}" filesonly="true" >
           <fileset dir="@{filesDir}">
             <patternset refid="@{filesId}"/>
             <!-- Javadoc exclusions -->
@@ -3674,9 +3684,10 @@ Read the Building page on the Apache Tomcat 
documentation site for details on ho
           </fileset>
           <zipfileset dir="@{meta-inf}" prefix="META-INF/"
                       excludes=".gitignore" />
+          <zipfileset file="@{manifest}" fullpath="META-INF/MANIFEST.MF" />
           <zipfileset file="@{notice}" fullpath="META-INF/NOTICE" />
           <zipfileset file="@{license}" fullpath="META-INF/LICENSE" />
-        </jar>
+        </zip>
         <antcall target="add-osgi" >
           <param name="jarfile" value="@{jarfile}" />
           <param name="addOSGi" value="@{addOSGi}" />

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

Reply via email to