<?xml version="1.0"?>

<project
  xmlns:ant="jelly:ant">

  <!--==================================================================-->
  <!-- J A L O P Y (source code formatter)                              -->
  <!--==================================================================-->

  <goal name="jalopy"
     description="Format all sources with code convention conformance"
     prereqs="jalopy:format"/>

  <goal name="jalopy:taskdef"
    description="Define the jalopy task to Ant and Jelly">
    <ant:taskdef name="jalopy"
      classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
      <ant:classpath>
        <ant:pathelement path="${plugin.getDependencyPath('jalopy')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('jalopy-ant')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('aelfred')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('jaxp')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('jdom')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('log4j')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('oro')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('sax')}"/>
        <ant:pathelement path="${plugin.getDependencyPath('textarea')}"/>
      </ant:classpath>
    </ant:taskdef>
  </goal>

  <goal name="jalopy:format"
        description="Format all sources with code convention conformance"
        prereqs="jalopy:taskdef, java:compile">

    <ant:path id="project.classpath">
      <ant:path refid="maven.dependency.classpath"/>
      <ant:pathelement path="${maven.build.dest}"/>
    </ant:path>
   
    <ant:jalopy fileformat="${maven.jalopy.fileFormat}"
            style="${maven.jalopy.style}"
            history="${maven.jalopy.history}"
            loglevel="${maven.jalopy.logLevel}"
            failonerror="${maven.jalopy.failOnError}"
            threads="${maven.jalopy.nbThread}"
            classpathref="project.classpath">
      <ant:fileset dir="${pom.build.sourceDirectory}" >
        <ant:include name="${maven.jalopy.filesetInclude}" />
      </ant:fileset>
    </ant:jalopy>
  </goal>

</project>
