Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
How to sort files contained in an Ant fileset?

How to sort files contained in an Ant fileset?

2003-03-07       - By Jo?l F?RAUD
Reply:     1     2  

Hi,

I would like to alphabetically sort the list of files returned by a fileset so
that I can pass this sorted list as parameter of a command where order of
parameters has some impact.

In fact I would like to achieve the same result as the Unix command:
find . -name "*.xml" | sort

For now, I use the build sequence below, but it appears that the list of files
I get in ${working.xml.files} is not alphabetically sorted. I did not find a
way to achieve this with Ant? I would like to avoid to do an exec and call the
Unix sort command...

[...]
  <fileset id="fileset.working.xml.files"
    dir="${dir.working}"
    >
     <include name="*.xml" />
  </fileset>
  <pathconvert pathsep=" "
        property="working.xml.files"
        refid="fileset.working.xml.files"
        >
  </pathconvert>
  <java   classname="com.sun.tgxml.tools.testgen.TestGen"
    fork="true"
    failonerror="true"
    >
     <jvmarg    value="-Dtck.build.propfile=${file.testgen-properties}" />
           <classpath refid="classpath.tobuild.indexes" />
     <arg       value="-log" />
     <arg        line="-logfile ${log.build.testgen}" />
     <arg       value="-debug" />
     <arg        line="-o ${dir.working}" />
     <arg        line="${working.xml.files}" />
       </java>
[...]


Thanks,
Joel

--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Joel Feraud       Sun Microsystems, Inc.
joel.feraud@(protected)     180, avenue de l'Europe
Tel: +33 476 188 325     ZIRST de Montbonnot
        38334 SAINT-ISMIER Cedex
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.