ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey E Care <>
Subject Re: AbstractFileSet optimization
Date Wed, 18 Oct 2006 18:33:59 GMT
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 

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 

"Kevin Cline" <> 
10/18/2006 02:20 PM
Please respond to
"Ant Developers List" <>


AbstractFileSet optimization

My project has a class path containing about 100 jars stored in a 
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"/>
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"/>

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:

>     private DirectoryScanner scanner = null;
<         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?

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message