<?xml version="1.0"?>

<project
  xmlns:j="jelly:core"
  xmlns:ant="jelly:ant"
  xmlns:define="jelly:define"
  xmlns:util="jelly:util"
  xmlns:doc="doc">

  <goal name="maven-changes-plugin:register">
    <ant:property name="maven.docs.src"
      value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}"/>
    <util:file var="changes" name="${maven.docs.src}/changes.xml"/>
    <j:if test="${changes.exists()}">
      <doc:registerReport 
        name="Changes" 
        pluginName="changes"
        link="changes-report"
        description="Report on the project changes."/>
     </j:if>
  </goal>
  
  <goal name="maven-changes-plugin:deregister">
    <doc:deregisterReport name="Changes"/>
  </goal>

  <!-- ================================================================== -->
  <!-- C H A N G E S  R E P O R T                                         -->
  <!-- ================================================================== -->

  <goal
    name="changes:report"
    description="Generate a changes report">
  <j:set var="maven.docs.src"
    value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}"/>
  <j:set var="maven.docs.outputencoding"
    value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.outputencoding')}"/>

  <doc:jsl
        input="${maven.docs.src}/changes.xml"
        output="changes-report.xml"
        stylesheet="${plugin.resources}/changes.jsl"
        encoding="${maven.docs.outputencoding}"
        outputMode="xml"
        prettyPrint="true"
        />
    
  </goal>
</project>
