What would you think the xml would look like? <foreach itemtype="fileset" source="<id>" property="item"> <echo message="${item}"/> </foreach>
BTW. I've now got the embedded version working. <foreach itemtype="Folders" source="c:\" property="currDir"> <echo message="${currDir}"/> </foreach> It works; after the first compile and everything. I will commit the abstract TaskWithEmbeddedTasks class later today. This abstract class will evaluate all internal elements as tasks. It skips anything with a BuildElementAttribute, or that is in a special list of excluded element names. The LoopTask now derives from this. Does anyone have an argument as to whether this should go into the NAnt core or NAntContrib? I'm leaning towards core. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:nant-developers- > [EMAIL PROTECTED]] On Behalf Of Kevin Dente > Sent: Monday, June 17, 2002 11:08 AM > To: Scott Hernandez; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [nant-dev] Loop Task > > How about looping over a FileSet? > > --- Scott Hernandez <[EMAIL PROTECTED]> wrote: > > I've posted this to both the Nant and NAntContrib > > dev lists, as well as > > to nant-user. I'm thinking that discussions about > > new task ideas should > > probably go on the nant-users list. And we should > > use NAntContrib to > > discuss changes, updates, or removals of existing > > NAntContrib > > tasks/utils. So, I urge you to join the Nant-users > > list > > > (http://lists.sourceforge.net/lists/listinfo/nant-users). > > > > I've created a loop (foreach) task. > > > > Right now it can loop over directory items > > (files/folders) or > > delimitated strings. > > > > Here is an example of how it works. > > > > <foreach itemtype="Folders" source="c:\" > > target="echoDir" > > property="folder"/> > > <target name="echoDir"> > > <echo message="${folder}" /> > > </target> > > > > <foreach itemtype="Files" source="c:\" > > target="echoFile" > > property="file"/> > > <target name="echoFile"> > > <echo message="${file}" /> > > </target> > > > > <foreach itemtype="DelimString" source="a,b,c,d,e" > > delim="," > > target="echoString" property="string"/> > > <target name="echoString"> > > <echo message="${string}" /> > > </target> > > > > <foreach itemtype="DelimString" source="1 2 3 4 5 6 > > 7" delim=" " > > target="echoCount" property="count"/> > > <target name="echoCount"> > > <echo message="${count}" /> > > </target> > > > > In the next version (a few weeks away at best I > > think) I want to support > > embedded tasks. So you won't need to use a target. > > > > <foreach itemtype="DelimString" source="1 2 3 4 5 6 > > 7" delim=" " > > target="echoCount" property="count"/> > > <echo message="${count}" /> > > </foreach> > > > > Is this task worthwhile without embedded task > > support? > > > > Are there any other types of looping we should > > support? > > > > I'm not sure how happy I am with the attribute > > names, anyone have any > > better suggestions? > > > > > > > > > _______________________________________________________________ > > > > Sponsored by: > > ThinkGeek at http://www.ThinkGeek.com/ > > _______________________________________________ > > Nant-developers mailing list > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/nant-developers > > > __________________________________________________ > Do You Yahoo!? > Yahoo! - Official partner of 2002 FIFA World Cup > http://fifaworldcup.yahoo.com > > _______________________________________________________________ > > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ NAntContrib-Developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer