On issue with adding fileset support to the LoopTask is that you end up with ambiguity over what constitutes a subtask element. One possibility is to require a specific subelement for the subtasks - perhaps a <do> element. This message is from earlier this year:

----

um... It is possible to do this, pretty easily in fact(use
TaskContainer.AddPrivateXMLElementName(string)), but then it becomes a
little muddled in my mind about what is run, and what is part of the
<foreach>. You would be mixing stuff to do, with params and settings for the
task. If we allow elements inside the foreach then maybe the stuff that
should be done can be nested inside another element, like <do> or <execute>.

<foreach ...>
   <setting1.../>
   <setting2.../>
   <other stuff related to foreach task...>
   <do>
       <!-- stuff to do -->
   </do>
</>

instead of

<foreach setting1="" setting2="" ...>
    <!-- stuff to do -->
</>

I'd lean towards using attributes if possible. It just seems cleaner in
terms of defining what the foreach will execute. But hey, I'm open to
opinions.

----

Arjen Poutsma wrote:

Hi,

I've changed the LoopTask so that it uses Filesets for "item=File" loops, instead of the current "in=[directory]" mechanism. This means that you can write foreach tasks such as:

<foreach item="File" property="tmp.filename">
        <fileset basedir="${compile.source}">
                <includes name="**/*.cs"/>
        </fileset>
        <echo message="${tmp.filename}"/>
</foreach>

The "in=[directory]" mechanism still works too.

The patch is attached, for the LoopTask.cs and LoopTest.cs files.

Best,

Arjen







-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC. Does your code think in ink? You could win a Tablet PC. Get a free Tablet PC hat just for playing. What are you waiting for? http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to