ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ant Wiki] Update of "AntNewbies" by CharlieWanek
Date Fri, 24 Aug 2007 17:17:38 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ant Wiki" for change notification.

The following page has been changed by CharlieWanek:
http://wiki.apache.org/ant/AntNewbies

The comment on the change is:
Example of using a ResourceCollection

------------------------------------------------------------------------------
  
  '''Answer #6 followup #2''' - Those needing this functionality should be pleased to know
that Ant 1.7 will support a new concept--ResourceCollection--an interface which exposes objects
of the existing Ant filelike-type Resource. Fileset, Dirset, Filelist, Path, etc. all implement
this new interface. One of the new ResourceCollection implementations is the <sort>
collection, which can sort resources according to their natural order, or by one or a combination
of ResourceComparators. Several of these have been predefined; however a user can custom-implement
and <typedef> his or her own ResourceComparator as well. 
  
+ '''Answer #6 example'''
+ 
+ Run ls -l on each file in the current directory, sorted by size:
+ {{{
+   <target name="sorttest">
+     <apply executable="ls">
+       <arg line="-l" />
+       <sort id="sorted-set" xmlns:rcmp="antlib:org.apache.tools.ant.types.resources.comparators"
>
+         <rcmp:size/>
+         <fileset dir="." includes="*" />
+       </sort>
+     </apply>
+   </target>
+ }}}
+ 
  
  --------------------------------------------------------------------------------
  

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


Mime
View raw message