You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Viraf Bankwalla <vi...@yahoo.com> on 2002/06/29 03:09:12 UTC
Build question
Hi,
I am new to ANT and was wondering if it is possible to
enumerate the files that match a fileset.
For example, I have a set of directories that follow a
naming convention:
**/a/b/*/**
I want to be able identify all directories that match
* and then call a task with the matched name *. How
would one go this in Ant 1.4.1
Thanks.
- viraf
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Build question
Posted by Diane Holt <ho...@yahoo.com>.
--- Viraf Bankwalla <vi...@yahoo.com> wrote:
> I have a set of directories that follow a naming convention:
>
> **/a/b/*/**
>
> I want to be able identify all directories that match * and then call
> a task with the matched name *. How would one go this in Ant 1.4.1?
In 1.4.1, with a custom task or a <script>. If you upgrade to 1.5, you can
do it with built-in tasks + ant-contrib's <foreach> (I'm assuming you
actually meant call a target, not call a task):
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<target name="runDirTargets">
<dirset id="ds1" dir="viraf" includes="**/a/b/*"/>
<pathconvert property="ds1" pathsep="," refid="ds1"/>
<foreach list="${ds1}" target="runDirTarget" param="dir"/>
</target>
<target name="one">
<echo>Running target one...</echo>
</target>
<target name="two">
<echo>Running target two...</echo>
</target>
<target name="runDirTarget">
<basename file="${dir}" property="target.dir"/>
<antcall target="${target.dir}"/>
</target>
Given:
viraf/src/a/b/one/subdir
viraf/src/a/b/two/subdir
Results in:
one:
[echo] Running target one...
two:
[echo] Running target two...
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>