Hi, all.

Will the new 1.5 zipfileset let me specify a src as a collection of 
jars, rather than needing one zipfileset per jar file?

I am planning our migration to ant 1.5 beta.  One of the motivators is 
better jar bundling.  (Here, I mean taking half a dozen jar files and 
copying their contents into the output jar.)

We currently have constructs like:

   <target name="bundle" depends="bundle-zip1, bundle-zip2, 
bundle-zip3" />

   <target name="bundle-zip1" depends="init" if="jar.extra.zip1" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip1}" dest="${compile.classes}"/>
   </target>

   <target name="bundle-zip2" depends="init" if="jar.extra.zip2" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip2}" dest="${compile.classes}"/>
   </target>

   <target name="bundle-zip3" depends="init" if="jar.extra.zip3" 
description="unzip any zips to be bundled in the result">
     <unjar src="${jar.extra.zip3}" dest="${compile.classes}"/>
   </target>

   <target name="jar-manifest" depends="bundle">
     <mkdir dir="${jar.dist}"/>
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       compress="${jar.compress}" >
     </jar>
   </target>

and a project might have

bundle-zip1="../foodir/foo.jar"
bundle-zip2="../bardir/bar.jar"

So, we might have up to 25 "bundle-zip##" variables and targets, and it 
is a tad confusing and hard to maintain.

As I understand it, I will soon be able to change the above to:

   <target name="jar-manifest" depends="bundle">
     <mkdir dir="${jar.dist}"/>
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       compress="${jar.compress}" >
       <zipfileset src="${bundle-zip1}">
       <zipfileset src="${bundle-zip2}">
       <zipfileset src="${bundle-zip3}">
     </jar>
   </target>

and will get exactly the same results.  This still requires an explicit 
list of bundle-zip properties.  I am pretty happy about getting rid of 
the extra targets, but it would be nice to get rid of a bunch of 
properties as well.

Is there any planned syntax for a zipfileset like:

       <zipfileset src="${bundle-zip}">
where

       bundle-zip="../foodir/foo.jar:../bardir/bar.jar"

I am not that concerned with syntax, more that I will be able to specify 
a list of jars whose contents are to be extracted as a single property, 
much like a classpath.

Includes and excludes will not work for this, as they related to files 
_inside_ the zip/jar files.

Scott


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to