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

Reply via email to