You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Robert Parlett <pa...@dial.pipex.com> on 2001/12/14 23:59:46 UTC
[PATCH] Creating a FileSet from a single filename
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.