From fd91927c11797c4c7bd2253510406c40207af344 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 17 Feb 2011 12:47:35 +0000
Subject: [PATCH]     * Build:       - Add includeAntRuntime=false to all javac
 targets       - Add build date, mtn rev, and changed file list to all
 manifests       - Add unless=uptodate to all jar and war targets         (bob
 and dtg still todo)

---
 apps/addressbook/build.xml        | 38 ++++++++++++++++++----
 apps/desktopgui/build.xml         | 15 +++++++++
 apps/i2psnark/java/build.xml      | 38 ++++++++++++++++++++--
 apps/i2ptunnel/java/build.xml     | 52 +++++++++++++++++++++++++++--
 apps/jetty/build.xml              | 27 +++++++++++++++-
 apps/ministreaming/java/build.xml | 33 +++++++++++++++++--
 apps/routerconsole/java/build.xml | 52 +++++++++++++++++++++++++++--
 apps/sam/java/build.xml           | 26 ++++++++++++++-
 apps/streaming/java/build.xml     | 31 ++++++++++++++++--
 apps/susidns/src/build.xml        | 31 ++++++++++++++++--
 apps/susimail/build.xml           | 27 +++++++++++++++-
 apps/systray/java/build.xml       | 33 +++++++++++++------
 build.xml                         | 54 +++++++++++++++++++++++++++----
 core/java/build.xml               | 38 +++++++++++++++++++---
 router/java/build.xml             | 39 +++++++++++++++++++---
 15 files changed, 485 insertions(+), 49 deletions(-)

diff --git a/apps/addressbook/build.xml b/apps/addressbook/build.xml
index 6332c5bcc..30750a231 100644
--- a/apps/addressbook/build.xml
+++ b/apps/addressbook/build.xml
@@ -38,6 +38,7 @@
 
 	<target name="compile" depends="init, depend">
 		<javac debug="true" deprecation="on" source="1.5" target="1.5" 
+                       includeAntRuntime="false"
                        srcdir="${src}" destdir="${build}">
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
@@ -47,27 +48,52 @@
 		</javac>
 	</target>
 
-	<target name="jar" depends="compile">
+        <!-- unused for now, as we oddly ship addressbook as a .war -->
+	<target name="jar" depends="compile, changes">
 		<jar basedir="${build}" destfile="${dist}/${jar}">
 			<manifest>
 				<attribute name="Main-Class" value="addressbook.Daemon"/>
+		                <attribute name="Build-Date" value="${build.timestamp}" />
+		                <attribute name="Base-Revision" value="${workspace.version}" />
+		                <attribute name="Workspace-Changes" value="${workspace.changes}" />
 			</manifest>
 		</jar>
 	</target>
 	
-	<target name="war" depends="compile" unless="war.uptodate">
+	<target name="war" depends="compile, changes, warUpToDate" unless="war.uptodate">
 		<mkdir dir="${dist}/tmp"/>
 		<mkdir dir="${dist}/tmp/WEB-INF"/>
 		<mkdir dir="${dist}/tmp/WEB-INF/classes"/>
 		<copy todir="${dist}/tmp/WEB-INF/classes">
 			<fileset dir="${build}"/>
 		</copy>
-		<war basedir="${dist}/tmp" webxml="web.xml" destfile="${dist}/${war}"/>
+		<war basedir="${dist}/tmp" webxml="web.xml" destfile="${dist}/${war}">
+			<manifest>
+		                <attribute name="Build-Date" value="${build.timestamp}" />
+		                <attribute name="Base-Revision" value="${workspace.version}" />
+		                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+			</manifest>
+		</war>
 		<delete dir="${dist}/tmp"/>
 	</target>
 	
-        <uptodate property="war.uptodate" targetfile="${dist}/${war}">
-            <srcfiles dir= "." includes="${build}/**/*.class, web.xml"/>
-        </uptodate>
+	<target name="warUpToDate">
+	        <uptodate property="war.uptodate" targetfile="${dist}/${war}">
+		            <srcfiles dir= "." includes="${build}/**/*.class, web.xml"/>
+	        </uptodate>
+	</target>
 
+	<target name="changes">
+	        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+	            <arg value="list" />
+	            <arg value="changed" />
+	            <arg value="." />
+	        </exec>
+		<!-- \n in an attribute value generates an invalid manifest -->
+		<exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+			<arg value="-s" />
+			<arg value="[:space:]" />
+			<arg value="," />
+		</exec>
+	</target>
 </project>
diff --git a/apps/desktopgui/build.xml b/apps/desktopgui/build.xml
index f5de9ff4f..0d697c185 100644
--- a/apps/desktopgui/build.xml
+++ b/apps/desktopgui/build.xml
@@ -24,6 +24,7 @@
 
 	<target name="compile" depends="init">
 		<javac debug="true" deprecation="on" source="1.5" target="1.5" 
+                       includeAntRuntime="false"
                        srcdir="${src}" destdir="${build}">
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
@@ -47,10 +48,24 @@
         </exec>
         <exec executable="sh" osfamily="windows" failifexecutionfails="true" >
             <arg value="./bundle-messages.sh" />
+        </exec>
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
         </exec>
 		<jar basedir="${build}" destfile="${dist}/${jar}">
 			<manifest>
 				<attribute name="Main-Class" value="net.i2p.desktopgui.Main"/>
+				<attribute name="Build-Date" value="${build.timestamp}" />
+				<attribute name="Base-Revision" value="${workspace.version}" />
+				<attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
 			</manifest>
 		</jar>
 	</target>
diff --git a/apps/i2psnark/java/build.xml b/apps/i2psnark/java/build.xml
index 2fbc2f507..b05b7339a 100644
--- a/apps/i2psnark/java/build.xml
+++ b/apps/i2psnark/java/build.xml
@@ -30,18 +30,41 @@
             srcdir="./src" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
             destdir="./build/obj" 
+            includeAntRuntime="false"
             classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="builddep, compile">
+
+    <target name="jar" depends="builddep, compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value=".." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/messages_*.class">
             <manifest>
                 <attribute name="Main-Class" value="org.klomp.snark.Snark" />
                 <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
             </manifest>
         </jar>
     </target>    
+    
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/i2psnark.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/messages_*.class" />
+        </uptodate>
+    </target>    
+
     <!-- Ideally we would include
       -  only include the servlet, everything else is in the jar.
       -  However, the wrapper.config classpath in existing installs
@@ -49,13 +72,24 @@
       -  So we must continue to duplicate everything in the war.
           <classes dir="./build/obj" includes="**/I2PSnarkServlet*.class" />
      -->
-    <target name="war" depends="jar, bundle"> 
+    <target name="war" depends="jar, bundle, warUpToDate" unless="war.uptodate" > 
         <war destfile="../i2psnark.war" webxml="../web.xml" basedir="../" includes="_icons/*" >
           <!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
           <classes dir="./build/obj" includes="**/web/*.class" />
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes}" />
+            </manifest>
         </war>
     </target>
     
+    <target name="warUpToDate">
+        <uptodate property="war.uptodate" targetfile="../i2psnark.war" >
+            <srcfiles dir= "." includes="build/obj/web/**/*.class ../_icons/* ../web.xml" />
+        </uptodate>
+    </target>
+    
     <target name="bundle" depends="compile">
         <!-- Update the messages_*.po files.
              We need to supply the bat file for windows, and then change the fail property to true -->
diff --git a/apps/i2ptunnel/java/build.xml b/apps/i2ptunnel/java/build.xml
index 6ff511100..7beebbb1b 100644
--- a/apps/i2ptunnel/java/build.xml
+++ b/apps/i2ptunnel/java/build.xml
@@ -28,6 +28,7 @@
             srcdir="./src" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
             destdir="./build/obj" 
+            includeAntRuntime="false"
             classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
@@ -36,15 +37,35 @@
     <!-- TODO: Move the web classes from the jar to the war - they are not part of the API
       -  This will require sponge to rewrite some seedless stuff that uses it.
      -->
-    <target name="jar" depends="builddep, compile">
+    <target name="jar" depends="builddep, compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class">
             <manifest>
                 <attribute name="Main-Class" value="net.i2p.i2ptunnel.I2PTunnel" />
                 <attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
             </manifest>
         </jar>
     </target>
 
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/i2ptunnel.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="bundle" depends="compile, precompilejsp">
         <!-- Update the messages_*.po files.
              We need to supply the bat file for windows, and then change the fail property to true -->
@@ -75,12 +96,34 @@
         </exec>
     </target>
 
-    <target name="war" depends="precompilejsp, bundle"> 
+    <target name="war" depends="precompilejsp, bundle, warUpToDate" unless="war.uptodate" > 
+        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="../jsp" />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml"
              basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp">
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
+            </manifest>
         </war>
     </target>
 
+    <target name="warUpToDate">
+        <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" >
+            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" />
+        </uptodate>
+    </target>
+
     <target name="precompilejsp" depends="jar" unless="precompilejsp.uptodate">
         <delete dir="../jsp/WEB-INF/" />
         <delete file="../jsp/web-fragment.xml" />
@@ -108,6 +151,7 @@
             <arg value="../jsp/" />
         </java>
         <javac debug="true" deprecation="on" source="1.5" target="1.5" 
+               includeAntRuntime="false"
                destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
@@ -143,7 +187,9 @@
     <target name="compileTest">
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
-        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on" destdir="./build/obj" >
+        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5"
+               includeAntRuntime="false"
+               deprecation="on" destdir="./build/obj" >
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
                 <pathelement location="../../../core/java/build/i2p.jar" />
diff --git a/apps/jetty/build.xml b/apps/jetty/build.xml
index a45f9df62..a4ba71e07 100644
--- a/apps/jetty/build.xml
+++ b/apps/jetty/build.xml
@@ -96,14 +96,39 @@
             srcdir="./java/src" 
             debug="true" source="1.5" target="1.5" 
             destdir="./build/obj" 
+            includeAntRuntime="false"
             classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile">
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
         </jar>
     </target>    
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="jettylib/org.mortbay.jetty.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>    
+
     <target name="clean" >
         <delete dir="./build" />
         <delete file="${verified.filename}" />
diff --git a/apps/ministreaming/java/build.xml b/apps/ministreaming/java/build.xml
index c22676d26..8fcd2d517 100644
--- a/apps/ministreaming/java/build.xml
+++ b/apps/ministreaming/java/build.xml
@@ -24,13 +24,40 @@
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
         <!-- half of this is deprecated classes so turn deprecation off -->
-        <javac srcdir="./src" debug="true" deprecation="off" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
+        <javac srcdir="./src" debug="true" deprecation="off" source="1.5" target="1.5"
+               includeAntRuntime="false"
+               destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile">
-        <jar destfile="./build/mstreaming.jar" basedir="./build/obj" includes="**/*.class" />
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+        <jar destfile="./build/mstreaming.jar" basedir="./build/obj" includes="**/*.class" >
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
+        </jar>
     </target>
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/mstreaming.jar" >
+            <srcfiles dir= "." includes="build/obj/**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="javadoc">
         <mkdir dir="./build" />
         <mkdir dir="./build/javadoc" />
diff --git a/apps/routerconsole/java/build.xml b/apps/routerconsole/java/build.xml
index 413521586..adb625e47 100644
--- a/apps/routerconsole/java/build.xml
+++ b/apps/routerconsole/java/build.xml
@@ -46,6 +46,7 @@
         <javac 
             srcdir="./src" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./build/obj">
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
@@ -61,12 +62,27 @@
             </classpath>
         </javac>
     </target>
-    <target name="jar" depends="compile">
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class">
             <manifest>
                 <!-- top level installer will rename to jrobin.jar -->
                 <!-- DTG added in 0.8.4, not in the classpath for very old installs, before we changed wrapper.config to specify * -->
                 <attribute name="Class-Path" value="i2p.jar router.jar jrobin.jar desktopgui.jar" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
             </manifest>
         </jar>
         <delete dir="./tmpextract" />
@@ -93,6 +109,13 @@
         <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
     </target>
 
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="poupdate" depends="build">
         <ant target="war" />
         <!-- Update the messages_*.po files.
@@ -110,12 +133,36 @@
             <arg value="-p" />
         </exec>
     </target>
-    <target name="war" depends="precompilejsp">
+
+    <target name="war" depends="precompilejsp, warUpToDate" unless="war.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="../jsp" />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
         <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
              basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
+            </manifest>
         </war>
     </target>
+
+    <target name="warUpToDate">
+        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
+            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
+        </uptodate>
+    </target>
+
     <target name="precompilejsp" unless="precompilejsp.uptodate">
         <delete dir="../jsp/WEB-INF/" />
         <delete file="../jsp/web-fragment.xml" />
@@ -182,6 +229,7 @@
         
         <javac debug="true" deprecation="on" source="1.5" target="1.5" 
                encoding="UTF-8"
+               includeAntRuntime="false"
                destdir="../jsp/WEB-INF/classes/" 
                srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
             <compilerarg line="${javac.compilerargs}" />
diff --git a/apps/sam/java/build.xml b/apps/sam/java/build.xml
index 57aeff994..7e62fd27c 100644
--- a/apps/sam/java/build.xml
+++ b/apps/sam/java/build.xml
@@ -28,6 +28,7 @@
         <javac 
             srcdir="./src" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./build/obj" 
             classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar:../../streaming/java/build/streaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
@@ -37,19 +38,42 @@
         <javac 
             srcdir="./test" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./build/obj" 
             classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar:../../streaming/java/build/streaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile">
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*.class">
             <manifest>
                 <attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
                 <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
             </manifest>
         </jar>
     </target>
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/sam.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="jarTest" depends="jar, compileTest">
         <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" />
     </target>
diff --git a/apps/streaming/java/build.xml b/apps/streaming/java/build.xml
index dff6fbf1d..1351399b7 100644
--- a/apps/streaming/java/build.xml
+++ b/apps/streaming/java/build.xml
@@ -27,6 +27,7 @@
         <javac 
             srcdir="./src" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./build/obj" 
             classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
@@ -36,14 +37,40 @@
         <javac 
             srcdir="./test" 
             debug="true" deprecation="on" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./build/obj" 
             classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="builddep, compile">
-        <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*.class" />
+
+    <target name="jar" depends="builddep, compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+        <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*.class" >
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
+        </jar>
     </target>
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/streaming.jar" >
+            <srcfiles dir= "." includes="build/obj/**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="jarTest" depends="jar, compileTest">
         <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" />
     </target>
diff --git a/apps/susidns/src/build.xml b/apps/susidns/src/build.xml
index ad20ad49a..ea4dc5809 100644
--- a/apps/susidns/src/build.xml
+++ b/apps/susidns/src/build.xml
@@ -23,13 +23,16 @@
         <pathelement location="../../../core/java/build/i2p.jar" />
  	</path>
 	<property name="javac.compilerargs" value="" />
+
  	<target name="compile">
 		<mkdir dir="${bin}" />
 		<javac debug="true" deprecation="on" source="1.5" target="1.5"
+			includeAntRuntime="false"
  			classpathref="cp" destdir="${bin}" srcdir="${src}" includes="**/*.java" >
 			<compilerarg line="${javac.compilerargs}" />
 		</javac>
 	</target>
+
     <target name="precompilejsp" unless="precompilejsp.uptodate">
         <delete file="WEB-INF/web-fragment.xml" />
         <delete file="WEB-INF/web-out.xml" />
@@ -47,6 +50,7 @@
             <arg value="./jsp" />
         </java>
         <javac debug="true" deprecation="on" source="1.5" target="1.5" 
+               includeAntRuntime="false"
                destdir="${bin}" srcdir="${tmp}" includes="**/*.java" classpathref="cp">
 		<compilerarg line="${javac.compilerargs}" />
          </javac>
@@ -61,8 +65,20 @@
         <srcfiles dir= "." includes="jsp/*.jsp, WEB-INF/web-template.xml"/>
     </uptodate>
 
-    <target name="all" depends="compile,precompilejsp,bundle,war"/> 
-    <target name="war"> 
+    <target name="all" depends="war"/> 
+
+    <target name="war" depends="compile, precompilejsp, bundle, warUpToDate" unless="war.uptodate" > 
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <war destfile="${project}.war" webxml="WEB-INF/web-out.xml">
         	<fileset dir=".">
         		<include name="WEB-INF/**/*.class"/>
@@ -74,9 +90,20 @@
         		<include name="index.html"/>
         		<include name="WEB-INF/classes/${project}.properties"/>
         	</fileset>
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
         </war>
     </target>
 
+    <target name="warUpToDate">
+        <uptodate property="war.uptodate" targetfile="${project}.war">
+            <srcfiles dir= "." includes="WEB-INF/web-out.xml WEB-INF/**/*.class images/*.png css.css index.html WEB-INF/classes/${project}.properties" />
+        </uptodate>
+    </target>
+
     <target name="bundle" depends="compile, precompilejsp">
         <!-- Update the messages_*.po files.
              We need to supply the bat file for windows, and then change the fail property to true -->
diff --git a/apps/susimail/build.xml b/apps/susimail/build.xml
index 9ab38ce42..0f7aae9bc 100644
--- a/apps/susimail/build.xml
+++ b/apps/susimail/build.xml
@@ -10,6 +10,7 @@
         <javac 
             srcdir="./src/src"
             debug="true" deprecation="off" source="1.5" target="1.5" 
+            includeAntRuntime="false"
             destdir="./src/WEB-INF/classes">
             <compilerarg line="${javac.compilerargs}" />
             <classpath>
@@ -20,11 +21,35 @@
         </javac>
     </target>
     <target name="jar" depends="compile, war" />
-    <target name="war" depends="compile">
+
+    <target name="war" depends="compile, warUpToDate" unless="war.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <war destfile="susimail.war" webxml="src/WEB-INF/web.xml"
              basedir="src/" excludes="WEB-INF/web.xml LICENSE src/**/*">
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
         </war>
     </target>
+
+    <target name="warUpToDate">
+        <uptodate property="war.uptodate" targetfile="susimail.war">
+            <srcfiles dir= "src" excludes="LICENSE src/**/*" />
+        </uptodate>
+    </target>
+
     <target name="javadoc">
         <mkdir dir="./build" />
         <mkdir dir="./build/javadoc" />
diff --git a/apps/systray/java/build.xml b/apps/systray/java/build.xml
index 9d48f902c..dc8f08afb 100644
--- a/apps/systray/java/build.xml
+++ b/apps/systray/java/build.xml
@@ -16,28 +16,41 @@
             source="1.5"
             target="1.5"
             destdir="./build/obj"
+            includeAntRuntime="false"
             includes="**/*.java"
             classpath="./lib/systray4j.jar:../../../core/java/build/i2p.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile" unless="jar.uptodate">
-        <mkdir dir="./build/jar_temp" />
-        <copy todir="./build/jar_temp">
-            <fileset dir="./build/obj" includes="**/*.class" />
-        </copy>
-        <jar destfile="./build/systray.jar" basedir="./build/jar_temp" includes="**/*">
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate">
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+        <jar destfile="./build/systray.jar" basedir="./build/obj" includes="**/*.class">
             <manifest>
                 <attribute name="Main-Class" value="net.i2p.apps.systray.SysTray" />
                 <attribute name="Class-Path" value="systray4j.jar" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
             </manifest>
         </jar>
-        <delete dir="./build/jar_temp" />
     </target>
 
-    <uptodate property="jar.uptodate" targetfile="./build/systray.jar">
-        <srcfiles dir= "src" includes="**/*.java" />
-    </uptodate>
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="./build/systray.jar">
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>
 
     <target name="javadoc">
         <mkdir dir="./build" />
diff --git a/build.xml b/build.xml
index d95ad3765..f7f88e789 100644
--- a/build.xml
+++ b/build.xml
@@ -97,7 +97,9 @@
     </target>
 
     <target name="buildDesktopGui" depends="buildCore, buildrouter" >
+<!--
         <ant dir="apps/desktopgui" target="clean" />
+-->
         <ant dir="apps/desktopgui" target="jar" />
     </target>
 
@@ -105,7 +107,7 @@
         <ant dir="apps/routerconsole/java/" target="jar" />
     </target>
 
-    <target name="buildJetty" >
+    <target name="buildJetty" depends="buildProperties" >
         <ant dir="apps/jetty" target="build" />
     </target>
 
@@ -127,11 +129,21 @@
         <copy file="router/java/build/router.jar" todir="build/" />
     </target>
 
-    <target name="buildCore" >
+    <target name="buildCore" depends="buildProperties" >
         <ant dir="core/java/" target="jar" />
         <copy file="core/java/build/i2p.jar" todir="build/" />
     </target>
 
+    <target name="buildProperties" >
+        <exec executable="mtn" outputproperty="workspace.version" errorproperty="mtn.error1" failifexecutionfails="false" >
+            <arg value="automate" />
+            <arg value="get_base_revision_id" />
+        </exec>
+        <tstamp>
+            <format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC" locale="en" />
+        </tstamp>
+    </target>
+
     <!-- end of sub-build.xml targets -->
 
     <target name="buildWEB" depends="buildRouterConsole" >
@@ -165,11 +177,13 @@
 	</condition>
 	<ant target="doBuildEXE" />
     </target>
-    <target name="doBuildEXE" unless="noExe">
+    <target name="doBuildEXE" depends="buildProperties" unless="noExe">
         <jar destfile="./build/launchi2p.jar">
             <manifest>
 	     <attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
 	     <attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar lib/desktopgui.jar" />
+             <attribute name="Build-Date" value="${build.timestamp}" />
+             <attribute name="Base-Revision" value="${workspace.version}" />
 	    </manifest>
         </jar>
 	<!-- now the standalone launcher exe -->
@@ -678,17 +692,43 @@
     <target name="prepjupdatefixes" depends="prepupdate, buildWEB">
         <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
     </target>
-    <target name="installer" depends="preppkg">
+    <target name="installer" depends="preppkg, buildProperties">
         <taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
         <mkdir dir="pkg-temp/installer" />
+        <exec executable="mtn" outputproperty="workspace.changes.util" errorproperty="mtn.error.util" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="core/java/src/net/i2p/util" />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes.util}" outputproperty="workspace.changes.util.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
         <jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
-            <manifest><attribute name="Main-Class" value="net.i2p.util.Copy" /></manifest>
+            <manifest>
+                <attribute name="Main-Class" value="net.i2p.util.Copy" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
+            </manifest>
         </jar>
         <jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
-            <manifest><attribute name="Main-Class" value="net.i2p.util.Delete" /></manifest>
+            <manifest>
+                <attribute name="Main-Class" value="net.i2p.util.Delete" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
+            </manifest>
         </jar>
         <jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
-            <manifest><attribute name="Main-Class" value="net.i2p.util.Exec" /></manifest>
+            <manifest>
+                <attribute name="Main-Class" value="net.i2p.util.Exec" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
+            </manifest>
         </jar>
         <!--
           Force 1.5 pack200 output
diff --git a/core/java/build.xml b/core/java/build.xml
index 27ca00e6f..8445d791e 100644
--- a/core/java/build.xml
+++ b/core/java/build.xml
@@ -21,20 +21,50 @@
     <target name="compile" depends="depend">
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
-        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on" destdir="./build/obj" classpath="${javac.classpath}" >
+        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on"
+               includeAntRuntime="false"
+               destdir="./build/obj" classpath="${javac.classpath}" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
+
     <target name="compileTest">
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
-        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on" destdir="./build/obj" >
+        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on"
+               includeAntRuntime="false"
+               destdir="./build/obj" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile">
-        <jar destfile="./build/i2p.jar" basedir="./build/obj" includes="**/*.class" />
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+        <jar destfile="./build/i2p.jar" basedir="./build/obj" includes="**/*.class" >
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
+        </jar>
     </target>
+
+    <target name="jarUpToDate" >
+        <uptodate property="jar.uptodate" targetfile="build/i2p.jar" >
+            <srcfiles dir= "build/obj" includes="**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="jarTest" depends="compileTest">
         <jar destfile="./build/i2ptest.jar" basedir="./build/obj" includes="**/*.class" />
     </target>
diff --git a/router/java/build.xml b/router/java/build.xml
index 69f6b4109..2a173f846 100644
--- a/router/java/build.xml
+++ b/router/java/build.xml
@@ -35,20 +35,49 @@
     <target name="compile" depends="depend, dependVersion">
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
-        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on" destdir="./build/obj" classpath="../../core/java/build/i2p.jar" >
+        <javac srcdir="./src" debug="true" source="1.5" target="1.5" deprecation="on"
+               includeAntRuntime="false"
+               destdir="./build/obj" classpath="../../core/java/build/i2p.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
     <target name="compileTest" depends="builddeptest">
         <mkdir dir="./build" />
         <mkdir dir="./build/obj" />
-        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on" destdir="./build/obj" classpath="../../core/java/build/i2ptest.jar" >
+        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on"
+               includeAntRuntime="false"
+               destdir="./build/obj" classpath="../../core/java/build/i2ptest.jar" >
             <compilerarg line="${javac.compilerargs}" />
         </javac>
     </target>
-    <target name="jar" depends="compile">
-        <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" />
-    </target>
+
+    <target name="jar" depends="compile, jarUpToDate" unless="jar.uptodate" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+        <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" >
+            <manifest>
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/router.jar" >
+            <srcfiles dir= "." includes="build/obj/**/*.class" />
+        </uptodate>
+    </target>
+
     <target name="jarTest" depends="compileTest">
         <jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
     </target>
-- 
GitLab