Great example Matt! Just be aware Martin that calling 100 times a target
using <antcall> (that's what <foreach> does internally) is very memory
intensive (basically, it duplicates the Ant Project for each <antcall>), and
a few people have run into trouble with OutOfMemoryErrors... Forking tasks
like <javac> is usually a good idea in this case, as <javac> is notorious
for not releasing resources properly otherwise. Just a heads up! --DD
PS: Scan the mailing lists for recent posts about
'foreach' and 'outofmemory'.
-----Original Message-----
From: Matt Benson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 11:48 AM
To: Ant Users List
Subject: RE: calling tasks per directory?
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 <[EMAIL PROTECTED]> wrote:
> Yeah, that's what I was working on... :)
>
> -Matt
>
> --- Dominique Devienne <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]]
> > 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:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>