ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Cline" <kevin.cl...@gmail.com>
Subject AbstractFileSet optimization
Date Wed, 18 Oct 2006 18:20:51 GMT
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>

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?

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