ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject RE: calling tasks per directory?
Date Fri, 13 Sep 2002 05:52:08 GMT

One minor enhancement to Matt's nifty little example is modifying the 
<dirset> to the following....

<dirset dir="${src.dir}" includes="*" />

This includes value is needed because, otherwise, the path will also include
the dirset's root directory ${src.dir} as well as immediate subdirs.  I 
would think that one would want only the subdirs.


For instance, with Matt's original example, a printout might be like this....


default:

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir1

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir2

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir3

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir4



With the added includes="*", the printout looks like this....

default:

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir1

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir2

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir3

-echo:
      [echo] Processing D:\myclasses\antforeachtest\src\dir4


Jake


At 09:47 AM 9/12/2002 -0700, you wrote:
>Since I was already working on it, here is a sample...
>I used Erik's suggestion from earlier today about
>directly making a path into a property without using
><pathconvert>, and just specified the current
>path.separator to <foreach>:
>
><project name="iteratedirs" default="default"
>basedir=".">
>
>         <taskdef
>resource="net/sf/antcontrib/antcontrib.properties"/>
>
>         <property name="src.dir" value="src" />
>
>         <target name="default">
>
>                 <path id="path">
>                         <dirset dir="${src.dir}" />
>                 </path>
>
>                 <property name="dirs" refid="path"/>
>
>                 <foreach list="${dirs}" target="-echo" param="dir"
>delimiter="${path.separator}"/>
>
>         </target>
>
>         <target name="-echo">
>                 <echo message="Processing ${dir}" />
>         </target>
>
></project>
>
>-Matt
>
>--- Matt Benson <gudnabrsam@yahoo.com> wrote:
> > Yeah, that's what I was working on... :)
> >
> > -Matt
> >
> > --- Dominique Devienne <DDevienne@lgc.com> wrote:
> > > You can create a <path> (which can contain a
> > > <dirset>), and <pathconvert> it
> > > to a property (comma separated, without spaces for
> > > <foreach>), and use that
> > > as the 'list' attribute of <foreach>. --DD
> > >
> > > -----Original Message-----
> > > From: M [mailto:martin.sillence@prnewswire.co.uk]
> > > Sent: Thursday, September 12, 2002 11:36 AM
> > > To: Ant Users List
> > > Subject: Re: calling tasks per directory?
> > >
> > > Matt Benson wrote:
> > > >
> > > > <foreach> is your friend!
> > > >
> > > > That's what I think, anyway...
> > >
> > > Do you have any examples that take dynamicly take
> > a
> > > directory tree using
> > > Foreach?
> > > It looks like Foreach just takes a static list but
> > > I'm probably missing
> > > the obvious.
> > >
> > > --
> > > Regards,
> > > M
> > >
> > > Martin Sillence
> > > PR Newswire
> > >
> > > DL +44 (0)1865 78 5065
> > > F  +44 (0)1865 78 5100
> > > W  www.prnewswire.eu.com
> > > ---------------------------------------
> > > Any views or opinions are solely those of the
> > author
> > > and do not
> > > necessarily represent those of PR Newswire Europe.
> > > The e-mail
> > > contents are intended only for addressee and may
> > > contain
> > > confidential and/or privileged material. If you
> > are
> > > not the
> > > intended recipient, please do not read, copy, use
> > or
> > > disclose
> > > this communication and notify the sender.
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:ant-user-help@jakarta.apache.org>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:ant-user-help@jakarta.apache.org>
> > >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! News - Today's headlines
> > http://news.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>
> >
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! News - Today's headlines
>http://news.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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message