You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Russell Gold <ru...@acm.org> on 2001/12/13 20:46:27 UTC

Creating patch jars?

Is there an ant task for creating patch jars (jars containing only changed 
classes)? Is there some generally accepted way to do this?


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Creating patch jars?

Posted by Bruce Atherton <br...@callenish.com>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Creating patch jars?

Posted by Diane Holt <ho...@yahoo.com>.
--- Russell Gold <ru...@acm.org> wrote:
> Is there an ant task for creating patch jars (jars containing only
> changed  classes)? Is there some generally accepted way to do this?

This type of question should really go to the ant-user list. Checking the
archive (which is always a good idea to do before posting -- hint,hint)
turned up a thread about this not long ago:
  http://marc.theaimsgroup.com/?l=ant-user&m=100324733826347&w=2

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>