ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Build question
Date Sat, 29 Jun 2002 02:19:53 GMT
--- Viraf Bankwalla <viraf_bankwalla@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:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message