Richard,
Thanks for your continual help. The below solution seems to have
legs, however, I'm having some problems implementing it. Mainly, I
cannot get the <sort-fileset> task to reference an existing fileset.
For example:
default.build:
<fileset id="deltas">
<include name="*.*.sql" />
</fileset>
<sort-fileset fileset="deltas"/>
SortFilesetTask.cs:
[TaskName("sort-fileset")]
public class SortFilesetTask : Task
{
private FileSet _fileset;
[BuildElement("fileset")]
public FileSet SortFileset
{
get { return _fileset; }
set { _fileset = value; }
}
protected override void ExecuteTask()
{
foreach (string fileName in _fileset.FileNames)
{
Console.WriteLine(fileName);
}
}
}
This results in the following output:
Unexpected attribute "fileset" on element <sort-fileset>.
However, I can do this:
default.build:
<sort-fileset>
<fileset id="deltas">
<include name="*.*.sql" />
</fileset>
</sort-fileset>
But obviously, this keeps the fileset inside the task.
What am I missing here?
Thanks,
Griffin
On May 5, 2007, at 3:25 PM, Richard Gavel wrote:
> My suggestion would be a custom task that takes in a fileset and
> manipulates
> it according to your needs.
>
> <fileset id="foo">
> <include name="*.dll" />
> </fileset>
>
> <sort-fileset fileset="foo">
>
> Then you can make use of the fileset later.
>
> <delete>
> <items refid="foo" />
> </delete>
>
> The sort-fileset custom task would extract all the file names out,
> including
> wildcard evaluation (FileSet.Filenames property), then create a new
> fileset,
> add in the individual files in whatever sorted order is
> appropriate. Then
> the existing fileset referenced by the refid would be replaced with
> the new
> one.
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of
>> Griffin
>> Caprio
>> Sent: Thursday, May 03, 2007 6:18 PM
>> To: Ryan Anthony
>> Cc: [email protected]
>> Subject: Re: [NAnt-users] Sorting fileset
>>
>> So let's say that's not an option.
>>
>> Is there anything else I can do?
>>
>> Griffin Caprio
>> 312.371.3869
>> http://blog.1530technologies.com
>>
>>
>>
>> On May 3, 2007, at 4:08 PM, Ryan Anthony wrote:
>>
>>> I believe the quick and dirty answer is to add a zero in front of
>>> each
>>> single digit number.
>>>
>>> Ryan
>>>
>>> Griffin Caprio wrote:
>>>> Hello all,
>>>>
>>>> I am trying to iterate through a directory of files that are
>>>> numerically named:
>>>>
>>>> 1.sql
>>>> 2.sql
>>>> ...
>>>>
>>>> Using the foreach task is easy:
>>>>
>>>> <foreach item="File" property="loop.filepath">
>>>> <in>
>>>> <items>
>>>> <include name="**.sql" />
>>>> </items>
>>>> </in>
>>>> <do>
>>>> <echo message="${loop.filepath}"/>
>>>> </do>
>>>> </foreach>
>>>>
>>>> However, this returns the list of files, sorted in text fashion,
>>>> not
>>>> numerically. For example, if 10.sql was in the directory, it would
>>>> be returned before 2.sql. Obviously, since these files need to be
>>>> run in order, this won't do.
>>>>
>>>> Is there anyway I can accomplish this?
>>>>
>>>> Thanks,
>>>> Griffin Caprio
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>> -
>>>> -
>>
>>>> ----
>>>> This SF.net email is sponsored by DB2 Express
>>>> Download DB2 Express C - the FREE version of DB2 express and take
>>>> control of your XML. No limits. Just data. Click to get it now.
>>>> http://sourceforge.net/powerbar/db2/
>>>> _______________________________________________
>>>> NAnt-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/nant-users
>>>>
>>>> __________ NOD32 2238 (20070503) Information __________
>>>>
>>>> This message was checked by NOD32 antivirus system.
>>>> http://www.eset.com
>>>>
>>>>
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --
>> -
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> NAnt-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> NAnt-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users