tags:

views:

1113

answers:

1

I'm looking over the documentation that comes with Apache Ant version 1.8.0 and can't find where classpath, path and pathelement are documented. I've found a page that describes path like structures but it doesn't list the valid attributes or nested elements for these. Another thing I can't find in the documentation is a description of the relationships between filelist, fileset, patternset and path and how to convert them back and forth. For instance there has to be an easier way to compile only those classes in one package while removing all class dependencies on the package classes and update documentation.

<!-- Get list of files in which we're interested. -->
<fileset id = "java.source.set"
    dir     = "${src}">
  <include name = "**/Package/*.java" />
</fileset>

<!-- Get a COMMA separated list of classes to compile. -->
<pathconvert property = "java.source.list"
    refid             = "java.source.set"
    pathsep           = ",">
  <globmapper from = "${src}/*.@{src.extent}"
      to           = "*.class" />
</pathconvert>

<!-- Remove ALL dependencies on package classes. -->
<depend srcdir = "${src}"
    destdir    = "${build}"
    includes   = "${java.source.list}"
    closure    = "yes" />

<!-- Get a list of up to date classes. -->
<fileset id = "class.uptodate.set"
    dir     = "${build}">
  <include name = "**/*.class" />
</fileset>

<!-- Get list of source files for up to date classes. -->
<pathconvert property = "java.uptodate.list"
    refid             = "class.uptodate.set"
    pathsep           = ",">
  <globmapper from="${build}/*.class" to="*.java" />
</pathconvert>

<!-- Compile only those classes in package that are not up to date. -->
<javac srcdir    = "${src}"
    destdir      = "${build}"
    classpathref = "compile.classpath"
    includes     = "${java.source.list}"
    excludes     = "${java.uptodate.list}"/>

<!-- Get list of directories of class files for package. --:
<pathconvert property = "class.dir.list"
    refid             = "java.source.set"
    pathsep           = ",">
  <globmapper from = "${src}/*.java"
      to           = "${build}*" />
</pathconvert>

<!-- Convert directory list to path. -->
<path id  = "class.dirs.path">
  <dirset dir  = "${build}"
      includes = "class.dir.list" />
</path>

<!-- Update package documentation. -->
<jdepend outputfile = "${docs}/jdepend-report.txt">
  <classpath refid = "compile.classpath" />
  <classpath location = "${build}" />
  <classespath>
    <path refid = "class.dirs.path" />
  </classespath>
  <exclude name = "java.*"  />
  <exclude name = "javax.*" />
</jdepend>

Notice there's a number of conversions between filesets, paths and comma separated list just to get the proper 'type' required for the different ant tasks. Is there a way to simplify this while still processing the fewest files in a complex directory structure?

+1  A: 

This is the closest I could find to documentation on classpath.

http://ant.apache.org/manual/using.html#path

Chris Persichetti
Yea, I found that but it doesn't go into details. Specifically it does not say what attributes or nested elements are valid.
Robert Menteer
The ANT doco concentrates on tasks. The other parts you learn by osmosis :-)For example references took me a long time to figure out (http://ant.apache.org/manual/using.html#references)
Mark O'Connor