<?xml version="1.0"?>

<project 
  xmlns:ant="jelly:ant"
  xmlns:j="jelly:core">
  
  <!-- ================================================================== -->
  <!-- J U N I T  D O C L E T                                             -->
  <!-- ================================================================== -->
  
  <goal name="junitdoclet" 
    description="Generate unit tests">
    
    <ant:mkdir dir="${maven.junitdoclet.outputDirectory}"/>
    
    <ant:path id="junitdoclet.classpath">
      <ant:path refid="maven.dependency.classpath"/>
      <ant:pathelement path="${plugin.getDependencyPath('junit-doclet')}"/>
    </ant:path>
    
    <ant:javadoc
      packagenames    = "${pom.package}.*"
      sourcepath      = "${pom.build.sourceDirectory}"
      defaultexcludes = "yes"
      doclet          = "com.objectfab.tools.junitdoclet.JUnitDoclet"
      docletpathref   = "junitdoclet.classpath"
      additionalparam = "-d ${maven.junitdoclet.outputDirectory} -buildall">
      <ant:classpath refid = "junitdoclet.classpath"/>>
    </ant:javadoc>
    
    <!-- 
      | JUnitDoclet produces suites but we don't need these because the
      | JUnit plugin picks up the test cases to run.
    -->
    
    <ant:delete>
      <ant:fileset dir="${maven.junitdoclet.outputDirectory}">
        <ant:include name="**/*Suite.java"/>
      </ant:fileset>
    </ant:delete>

  </goal>

</project>
