<?xml version="1.0"?>

<project 
  xmlns:j="jelly:core" 
  xmlns:ant="jelly:ant" 
  xmlns:define="jelly:define"
  xmlns:doc="doc"  
  xmlns:u="jelly:util">
  
  <ant:property name="maven.linkcheck.cache" 
    value="${pom.getPluginContext('maven-linkcheck-plugin').getVariable('maven.linkcheck.cache')}"/>
  <ant:property name="maven.gen.docs" 
    value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
  
  <goal name="maven-ashkelon-plugin:register">
    <doc:registerReport 
      name="Ashkelon JavaDoc" 
      pluginName="maven-ashkelon-plugin"
      link="ashkelon"
      description="Report on the validity of all links in the documentation."/>
    <!--doc:registerReport 
      name="Ashkelon Deploy Report" 
      pluginName="maven-ashkelon-plugin"
      link="ashkelon-output"
      description="Report on the validity of all links in the documentation."/-->
  </goal>
  
  <goal name="maven-ashkelon-plugin:deregister">
    <doc:deregisterReport name="Ashkelon Report"/>
  </goal>
  
  
  
  <!-- ================================================================== -->
  <!-- C R E A T E   A S H K E L O N   X M L  R E P O R T               -->
  <!-- ================================================================== -->
  
  <goal name="maven-ashkelon-plugin:report">
      
  </goal>
  
  <goal name="ashkelon:generate-xml">
    <j:new var="packageTool" className="org.apache.maven.ashkelon.PackageTool"/>
    <u:file var="src" name="${pom.build.sourceDirectory}"/>
    <j:set var="packages" value="${packageTool.findPackages(src)}"/>
    ${packages}
    <echo>${basedir}/${pom.artifactId}-ashkelon.xml</echo>
    <j:file name="${basedir}/${pom.artifactId}-ashkelon.xml" prettyPrint="true" xmlns="dummy">
      <api>
        <name>${pom.name}</name>
        <summarydescription>${pom.shortDescription}</summarydescription>
        <description>${pom.description}</description>
        <publisher>${pom.organization.name}</publisher>
        <download_url>${pom.url}</download_url>
        <release_date>2000-01-01T00:00:00.000</release_date>
        <version>${pom.currentVersion}</version>
        <j:forEach var="package" items="${packages}">
          <package>${package}</package>
        </j:forEach>

      </api>
  </j:file>    
  </goal>
        

</project>
