<project default="default" xmlns:j="jelly:core" xmlns:ant="jelly:ant" 
         xmlns:license="license" xmlns:util="jelly:util" xmlns:maven="jelly:maven">

  <goal name="default" prereqs="jar:install"/>

  <preGoal name="java:compile">
    <mkdir dir="${pom.build.sourceDirectory}/org/codehaus/activemq/selector"/>

    <javacc target="${basedir}/src/grammar/SelectorParser.jj"
      javacchome="${maven.repo.local}/javacc/jars"
      outputdirectory="${pom.build.sourceDirectory}/org/codehaus/activemq/selector"/>
  </preGoal>

  <goal name="systest" description="Performs a complete system test">
    <attainGoal name="clean"/>
    <attainGoal name="jar:install-snapshot"/>

    <j:if test="${empty(goals)}">
      <j:set var="goals" value="default"/>
    </j:if>

    <maven:reactor
      basedir="${basedir}/modules/systest"
      includes="*/project.xml"
      excludes="jmscts/*,jdbc/*"
      banner="Executing (${goals}):"
      ignoreFailures="false"
      goals="${goals}"
      postProcessing="true"
      />
  </goal>

  <postGoal name="test:compile">

    <!-- Once the tests are compiled... install them -->
    <ant:jar
      jarfile="${maven.build.dir}/${pom.artifactId}-test-${pom.currentVersion}.jar"
      basedir="${maven.test.dest}"
      index="${maven.jar.index}"
      compress="${maven.jar.compress}"
      excludes="${maven.jar.excludes}">   
      
 
      <j:if test="${maven.jar.manifest.available}">
        <ant:setProperty name="manifest" value="${maven.jar.manifest}" />
      </j:if>

      <j:if test="${context.getVariable('maven.jar.includes') != null}">
        <ant:setProperty name="includes" value="${maven.jar.includes}" />
      </j:if>

      <j:set var="licenseFileName"><license:fileName/></j:set>
      <util:file name="${licenseFileName}" var="licenseFile"/>
      <ant:metainf dir="${licenseFile.canonicalFile.parent}">
        <ant:include name="${licenseFile.canonicalFile.name}"/>
      </ant:metainf>            
    </ant:jar>

    <mkdir dir="${maven.repo.local}/${pom.groupId}/jars"/>
    <copy todir="${maven.repo.local}/${pom.groupId}/jars"
          file="${maven.build.dir}/${pom.artifactId}-test-${pom.currentVersion}.jar"/>

  </postGoal>

</project>
