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

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


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

commit 3149befcb31301bc1eb115440858d34ae8adc516
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 3e6b261..3878450 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -29,6 +29,10 @@ version.build=5
 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 8338af0..aa727ae 100644
--- a/build.xml
+++ b/build.xml
@@ -266,6 +266,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}"/>
@@ -990,6 +991,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"
@@ -1017,6 +1023,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" >
@@ -3698,7 +3708,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 -->
@@ -3706,9 +3716,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