<?xml version="1.0"?>
<!-- 
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 -->


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

  <!--==================================================================-->
  <!-- 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">
      <j:if test="${sourcesPresent == 'true'}">
        <ant:fileset dir="${pom.build.sourceDirectory}" >
          <ant:include name="${maven.jalopy.filesetInclude}" />
        </ant:fileset>
      </j:if>
      <j:if test="${unitTestSourcesPresent == 'true'}">
        <ant:fileset dir="${pom.build.unitTestSourceDirectory}" >
          <ant:include name="${maven.jalopy.filesetInclude}" />
        </ant:fileset>
      </j:if>
    </ant:jalopy>
  </goal>

</project>
