ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Parlett <parl...@dial.pipex.com>
Subject [PATCH] Creating a FileSet from a single filename
Date Fri, 14 Dec 2001 22:59:46 GMT
Please find attached a patch to FileSet.java which allows creation of a
FileSet with one entry, from a single file attribute, as follows :-

  <fileset file="/tmp/file.txt"/>

which has the same effect as

   <fileset dir="/tmp">
     <include name="file.txt"/>
   </fileset>

but does not require both the directory and the filename to be known.

If the "file" attribute is specified, then specifying any of the other
fileset attributes, or specifying a nested element, throws an exception.

This addition would be useful, for example, if a build process builds
several specified files in subprojects and at the end wanted to zip them
all together, eg

     <property name="jar1" value="subproject1/release/proj1.jar"/>
     <property name="jar2" value="subproject2/release/proj2.jar"/>
     <property name="jar3" value="subproject3/release/proj3.jar"/>

      ...

     <zip file="release.zip">
       <fileset file="${jar1}"/>
       <fileset file="${jar2}"/>
       <fileset file="${jar3}"/>
     </zip>

At present the only way I can see to do this is via copying to a
temporary directory or specifying the files using two properties
(directory and name); either technique feels a bit clumsy.

Many thanks.
Mime
View raw message