You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kriss <ma...@hotmail.com> on 2007/03/20 19:43:55 UTC

how to use the sort in resource

HI,

The new resource possibility in ant 1.7.0 seems to be excellent, but I do not know how to use it. For instance, I want to build a fileset of files sorted by their date in reverse order.

I know there is the new sort http://ant.apache.org/manual/CoreTypes/resources.html#sort
with the resource comparator :
- date : http://ant.apache.org/manual/CoreTypes/resources.html#rcmp.date
- reverse : http://ant.apache.org/manual/CoreTypes/resources.html#rcmp.reverse

But I cannot find any exemple about how to use this,
Any help will be appreciate.

Thanks.
Kriss

Re: how to use the sort in resource

Posted by Matt Benson <gu...@yahoo.com>.
Hi Kriss--as with many OSS tools, the best examples
are in the testsuite ;).  The tricky thing, IMO, about
resource comparators/selectors is that in order to
avoid namespace conflicts with other similarly-named
entities they were placed in an internal antlib and
only available via that antlib or explicit typedefs. 
You should be able to do this:

<sort>
  <fileset dir="foo" />
  <reverse
xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
    <!-- date inherits reverse's ns -->
    <date />
  </reverse>
</sort>

HTH,
Matt

--- Kriss <ma...@hotmail.com> wrote:

> HI,
> 
> The new resource possibility in ant 1.7.0 seems to
> be excellent, but I do not know how to use it. For
> instance, I want to build a fileset of files sorted
> by their date in reverse order.
> 
> I know there is the new sort
>
http://ant.apache.org/manual/CoreTypes/resources.html#sort
> with the resource comparator :
> - date :
>
http://ant.apache.org/manual/CoreTypes/resources.html#rcmp.date
> - reverse :
>
http://ant.apache.org/manual/CoreTypes/resources.html#rcmp.reverse
> 
> But I cannot find any exemple about how to use this,
> Any help will be appreciate.
> 
> Thanks.
> Kriss
> 



 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org