FWIW I'm -1 on this change.

What happens when the contents of the directory changes? With your proposed patch new files will not be picked up & deleted files will not be removed.

Might I suggest using pathconvert instead? That way you can construct the path once, convert it to a property & then use the property in your tests.
____________________________________________________________________________________________
Jeffrey E. (Jeff) Care
IBM WebSphere Application Server Development
WAS 7.0 Lead Release Engineer
WebSphere Mosiac
WebSphere Brandmark




"Kevin Cline" <[EMAIL PROTECTED]>

10/18/2006 02:20 PM

Please respond to
"Ant Developers List" <dev@ant.apache.org>

To
dev@ant.apache.org
cc
Subject
AbstractFileSet optimization





My project has a class path containing about 100 jars stored in a Clearcase
vob.  We have a this fileset definition:

  <path id ="classpath.unit_test">
       <pathelement path="bin"/>
       <!-- add all files in lib.dir to path -->
       <fileset dir="lib">
               <include name="**/*.jar"/>
       </fileset>
   </path>
in
which is used to run JUnit tests like this:

 <target name="utest">
  <junit showoutput="true">
    <classpath refid="classpath.unit_test"/>
    <formatter type="plain" usefile="false" />
    <test name="test1"/>
    <test name="test2"/>
    ...
  </junit>
 </target>

It takes about 30 seconds for the file set to scan the lib directory for
jars.  This happens for each test element.
To fix this, I modified the AbstractFileSet class to save the
DirectoryScanner, instead of rescanning each time:

68a69,70
>     private DirectoryScanner scanner = null;
>
355,359c357,365
<         DirectoryScanner ds = new DirectoryScanner();
<         setupDirectoryScanner(ds, p);
<         ds.setFollowSymlinks(followSymlinks);
<         ds.scan();
<         return ds;
---
>
>         if (scanner == null) {
>             scanner = new DirectoryScanner();
>             setupDirectoryScanner(scanner, p);
>             scanner.setFollowSymlinks(followSymlinks);
>             scanner.scan();
>         }
>
>         return scanner;

Can this change be incorporated in the next version of Ant?

Reply via email to