ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Atherton <br...@callenish.com>
Subject Re: Creating patch jars?
Date Sat, 15 Dec 2001 01:07:29 GMT
Note that I am redirecting this question to the ant-users mailing list.

At 02:46 PM 12/13/2001 -0500, Russell Gold wrote:
>Is there an ant task for creating patch jars (jars containing only changed 
>classes)? Is there some generally accepted way to do this?

I don't know about generally accepted, but here is how I did it for a ZIP file:

   <target name="check-for-full-zip">
     <available file="${deployzipname}" type="file" property="fullzippresent"/>
   </target>

   <target name="create-diff-zip" depends="init,check-for-full-zip" 
if="fullzippresent" >
     <delete quiet="true" includeEmptyDirs="true" >
       <fileset dir="${tempdir}" defaultexcludes="no" />
     </delete>
     <mkdir dir="${tempdir}" />
     <record name="${logfilename}" loglevel="warn" />
     <unzip src="${deployzipname}" dest="${tempdir}" />
     <record name="${logfilename}" loglevel="info" />
     <apply executable="/usr/bin/zip" skipemptyfilesets="true" parallel="true"
           dest="${tempdir}" dir="${buildpath}" relative="true" >
       <arg value="${diffzipname}-${DSTAMP}-${TSTAMP}.zip" />
       <fileset dir="${buildpath}" >
         <include name="classes/**" />
         <include name="ejb/**" />
         <include name="static/**" />
         <include name="webapp/**" />
       </fileset>
       <mapper type="identity" />
     </apply>
     <delete quiet="true" includeEmptyDirs="true" >
       <fileset dir="${tempdir}" defaultexcludes="no" />
     </delete>
   </target>

Note that, due to a difference in the granularity of the timestamps on 
files stored in the ZIP (not sure about JARs),  rounding error gets you too 
many files. To fix it, you have to apply this patch to Ant to make it not 
worry about 1 second differences:

Index: src/main/org/apache/tools/ant/util/SourceFileScanner.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/util/SourceFileScanner.java,v
retrieving revision 1.10
diff -u -r1.10 SourceFileScanner.java
--- src/main/org/apache/tools/ant/util/SourceFileScanner.java   2001/11/02 
07:56:53     1.10
+++ src/main/org/apache/tools/ant/util/SourceFileScanner.java   2001/12/04 
22:21:09
@@ -138,7 +138,7 @@
                               Project.MSG_VERBOSE);
                      v.addElement(files[i]);
                      added = true;
-                } else if (src.lastModified() > dest.lastModified()) {
+                } else if ((src.lastModified() - 1000L) > 
dest.lastModified()) {
                      task.log(files[i]+" added as 
"+dest.getAbsolutePath()+" is outdated.",
                               Project.MSG_VERBOSE);
                      v.addElement(files[i]);





--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message