<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Filename: $RCSfile$
   Purpose:  Ant build file for EvA2.

             Ant-Download: http://jakarta.apache.org/ant
             Ant-Manual:   http://jakarta.apache.org/ant/manual/index.html

   Precondition: 1. Ant should be installed.
                 2. JAVA_HOME environment variable contains the path to JDK1.5 or higher
                 3. ANT_HOME environment variable contains the path to ant's home directory

   Language: XML
   Compiler: Ant
   Authors:  M.Kronfeld, H.Planatscher, Holger Ulmer, Felix Streichert, Joerg Wegner
   Version:  $Revision: 284 $
             $Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $
             $Author: mkron $
   Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

<project name="EvA2" default="compile" basedir="..">

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Set properties
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <!-- SET THE DIRECTORY PROPERTIES -->
  <property name="source.directory"               value="src" />
	  <property name="ant.directory"               value="ant" />
  <property name="build.directory"                value="build" />
  <property name="distribution.directory"         value="dist" />
  <property name="resources.directory"            value="resources" />
  <property name="web.download.directory"            value="/afs/cs.uni-tuebingen.de/ra/www/software/EvA2/downloads" />
  <property name="source.distribution.directory"  value="${distribution.directory}/src-dist" />
  <property name="binary.distribution.directory"  value="${distribution.directory}/bin-dist" />
  <property name="javadoc.directory"              value="doc/api" />
  <property name="library.directory"              value="lib" />
  <property name="debug.flag"					  value="true" />
	  <property name="jar.name"						value="EvA2Base" />
	  <property name="srcpack.name"					value="EvA2BaseSrc" />
	  <property name="JE2Probs.directory"			value="../JE2Probs" />				
	  <property name="JE2ESModel.directory"			value="../JE2ESModel" />				
	  <property name="JE2Research.directory"		value="../JE2Research" />				

  <!-- SET THE BINARY LIBRARIES PROPERTIES -->
  <property name="check.libraries.ant"            value="ant/check.xml" />
  <property name="windows.libraries"              value="${library.directory}/windows" />
  <property name="unix.libraries"                 value="${library.directory}/linux" />
  <!--
  <property name="library.SNNS"                   value="SNNS_jkr" />
  <property name="library.JMatLink"               value="JMatLink" />
  <property name="library.WSI.ant"                value="../java" />
  <property name="library.WSI.original"           value="${library.WSI.ant}/dist/wsi.jar" />
  <property name="library.WSI"                    value="lib/wsi2.jar" />
  -->

  <!-- SET THE JAVA BINARY LIBRARIES PROPERTIES -->
  <property name="ant.java.version"               value="1.5" />

  <!-- SET CLASSPATH -->
  <path id="project.class.path">
  	<pathelement location="." />
  	<!-- shouldnt be required for EvA2
    <pathelement location="${env.JAVA_HOME}/jre/lib/rt.jar" />
    <pathelement location="${env.JAVA_HOME}/lib/dt.jar" />
    <pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
    <pathelement location="./lib/jdom.jar" />
    <pathelement location="./lib/xerces.jar" />
    <pathelement location="./lib/crimson.jar" />
    <pathelement location="./lib/xalan2.jar" />
    <pathelement location="${build.directory}" />
    <fileset dir="${library.directory}">
      <include name="*.jar" />
    </fileset>
    -->
  </path>

  <!-- SET THE CVS RELEVANT PROPERTIES -->
  <property name="cvs.ant"                        value="ant/cvs.xml" />
  <property name="repository.directory.unix"      value="/afs/wsi/ra/Repository" />
  <property name="cvs.destination.unix"           value="${source.directory}" />
  <property name="repository.directory.windows"   value="X:/wsi/ra/Repository" />
  <property name="cvs.destination.windows"        value="${source.directory}" />

  <!-- ENVIRNONMENT PROPERTIES -->
  <property environment="env"/>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Usage
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="usage" unless="silent">
    <echo>
      Supported targets (default=compileAll):
      -------------------------------------------------------------------------
      check      - checks if all needed binary and source libraries are
                   available.
      compile    - compile all project files.
      compileAll - 1. gets an actual version from the WSI library
                   2. and compiles all project files.
      javadoc    - build project javadoc files
      binaryDist - will create a complete binary distribution
      clean      - will clean up files, except the source files and the api
                   documentation
      run        - will start EvA2

      use 'ant -projecthelp' for further Main targets
    </echo>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Library check
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="check">
    <ant inheritAll="true" antfile="${check.libraries.ant}" target="binary.libraries.test">
      <property name="silent" value="true"/>
    </ant>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Init
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="buildDirectories" unless="noDirectories">
    <mkdir dir="${build.directory}" />
    <mkdir dir="${distribution.directory}" />
    <mkdir dir="${source.distribution.directory}" />
    <mkdir dir="${binary.distribution.directory}" />
    <mkdir dir="${javadoc.directory}" />
  </target>

  <target name="init">
    <tstamp />
    <antcall target="buildDirectories"></antcall>
    <condition property="isWindows">
      <and>
        <os family="windows" />
        <not>
          <os family="unix" />
        </not>
      </and>
    </condition>
    <condition property="isUnix">
      <and>
        <os family="unix" />
        <not>
          <os family="windows" />
        </not>
      </and>
    </condition>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Clean
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="clean" description="Cleans up project directories.">
    <delete dir="${build.directory}" />
    <delete dir="${distribution.directory}" />
  </target>

  <target name="cleanAll" depends="init, clean">
  	<!--
    <ant inheritAll="false" antfile="build.xml" dir="${library.WSI.ant}" target="clean">
      <property name="silent" value="true"/>
    </ant>-->
  </target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Update libraries
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
  <target name="update.libraries">
  </target>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Compile
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="compileAll" depends="usage, update.libraries" description="Update libraries and compile the project.">
    <antcall target="compile">
    </antcall>
    <antcall target="compileProbs">
    </antcall>
  </target>

  <target name="compileInfo" unless="silent">
    <echo message="ANT_HOME is set to = ${env.ANT_HOME}"/>
    <echo message="JAVA_HOME is set to = ${env.JAVA_HOME}"/>
    <echo message="You are using JDK version ${ant.java.version}"/>
    <echo message="currently JDK version 1.5 is recomended!"/>
    <echo message=""/>
    <echo message="use 'ant compileAll' - to compile all java sources (+ WSI)."/>
    <echo message="use 'ant compile'    - to compile only the java sources (faster)."/>
  </target>

  <target name="compile" depends="usage, init, check, compileInfo" description="Compiles the project." >
  <!-- COMPILE PROJECT -->
  <javac destdir="${build.directory}" optimize="on" deprecation="on" nowarn="on" debug="${debug.flag}" >
     <src path="${source.directory}" />
     <exclude name="ant/**" />
     <exclude name="build/**" />
     <exclude name="dist/**" />
     <exclude name="doc/**" />
     <exclude name="resources/**" />
     <exclude name="images/**" />
     <exclude name="lib/**" />
     <exclude name="project/**" />
	<classpath>
        <pathelement path="${project.class.path}" />
   <!--     <pathelement path="${library.WSI}" />
        <pathelement path="${library.JavaNNS}" /> -->
	<fileset dir="${library.directory}">
        	<include name="*.jar" />
        </fileset>
      </classpath>
   </javac>

   <!-- GENERATE RMI STUB FILES -->
   <rmic includes="wsi/ra/jproxy/RMIInvocationHandlerImpl.class"       stubversion="-v1.2" base="${build.directory}"/>
   <rmic includes="wsi/ra/jproxy/RMIThreadInvocationHandlerImpl.class" stubversion="-v1.2" base="${build.directory}"/>

   <!-- COPY DATA FILES TO BUILD DIRECTORY -->
    <copy todir="${build.directory}/resources">
      <fileset dir="${resources.directory}" includes="**/*" />
   </copy>
  	
    <copy todir="${JE2Probs.directory}/${build.directory}/resources">
      <fileset dir="${JE2Probs.directory}/${resources.directory}" includes="**/*" />
   </copy>
  	
    <copy todir="${JE2ESModel.directory}/${build.directory}/resources">
      <fileset dir="${JE2ESModel.directory}/${resources.directory}" includes="**/*" />
   </copy>
	
    <copy todir="${JE2Research.directory}/${build.directory}/resources">
      <fileset dir="${JE2Research.directory}/${resources.directory}" includes="**/*" />
   </copy>
  </target>
	
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	        Compile JE2Probs
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
	<target name="compileProbs" depends="usage, init, compileInfo" description="Compiles the Probs project." >
	  <!-- COMPILE PROBS PROJECT -->
	  	<ant inheritAll="false" antfile="${ant.directory}/build.xml" dir="${JE2Probs.directory}" target="compile">
			<property name="silent" value="true"/>
		</ant>
	</target>
	
<!-- =================================================================== -->
<!-- Jars all classes into one jar file                                  -->
<!-- =================================================================== -->
<target name="bundle" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
   <property name="bin.dist.dir"  value="${binary.distribution.directory}/eva2-${DSTAMP}" />
    <mkdir dir="${bin.dist.dir}" />
    <mkdir dir="${bin.dist.dir}/${library.directory}" />
<delete> <fileset dir="${bin.dist.dir}/${library.directory}" includes="*EvA*jar" /> </delete>
<jar jarfile="${bin.dist.dir}/${library.directory}/EvA2Base.jar"  basedir="${build.directory}">

<!--<fileset dir="${classes.dir}" excludes="*test*"/>-->
<manifest> <attribute name="Main-Class" value="eva2.client.EvAClient"/> </manifest>
</jar>
</target>

 <!--  ===================================================================
  -->
 <!--  Jars all classes into one jar file
  -->
 <!--  ===================================================================
  -->
 <target name="bundlehannes" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
  <property name="bin.dist.dir" value="${binary.distribution.directory}/eva2-${DSTAMP}" />
  <mkdir dir="${bin.dist.dir}" />
  <mkdir dir="${bin.dist.dir}/${library.directory}" />
 <delete>
  <fileset dir="${bin.dist.dir}/${library.directory}" includes="*EvA*jar" />
  </delete>
 <jar jarfile="${bin.dist.dir}/${library.directory}/EvA2Base.jar" basedir="${build.directory}" filesetmanifest="mergewithoutmain">
 <!--  JKW: That's bad practice, if we have internal dependencies -->
 <!--  JKW: Use a correct shell script or ant task to run application, which  -->
 <!--  JKW: resolves the classpath automatically from all libraries in the library directory  -->
 <zipgroupfileset dir="${library.directory}">
  <include name="**/*.jar" />
  </zipgroupfileset>
 <!-- <fileset dir="${classes.dir}" excludes="*test*"/>
  -->
 <manifest>
  <attribute name="Main-Class" value="eva2.client.EvAClient" />
  </manifest>
  </jar>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Binary Distribution
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<target name="binaryDist" depends="compile" description="Compiles the project and puts the whole stuff into a jar-file..">
    <property name="bin.dist.dir"  value="${binary.distribution.directory}/eva-${DSTAMP}" />
    <mkdir dir="${bin.dist.dir}" />
<delete>
      <fileset dir="${bin.dist.dir}/" includes="${jar.name}.jar" />
</delete>

<jar jarfile="${bin.dist.dir}/${jar.name}.jar"  basedir="${build.directory}" >
<manifest> <attribute name="Main-Class" value="eva2.client.EvAClient"/> </manifest>
</jar>
    <copy todir="${distribution.directory}">
      <fileset dir="${bin.dist.dir}">
        <include name="${jar.name}.jar" />
      </fileset>
    </copy>
	
	<!--
    <copy todir="${bin.dist.dir}/${library.directory}">
      <fileset dir="${library.directory}">
        <include name="**/**" />
        <exclude name="CVS" />
      </fileset>
    </copy>

    <copy todir="${bin.dist.dir}/ant">
      <fileset dir="ant">
        <include name="**/**" />
        <exclude name="CVS" />
      </fileset>
    </copy>

    <copy todir="${bin.dist.dir}">
      <fileset dir=".">
        <include name="run.sh"/>
        <include name="run.bat"/>
        <include name="run_eva.sh"/>
        <include name="run_eva.bat"/>
        <include name="*.txt"/>
        <include name="*.html"/>
      </fileset>
    </copy>

    <copy todir="${bin.dist.dir}/html/manual">
      <fileset dir="html/manual">
        <include name="**/**.gif" />
        <include name="**/**.jpg" />
        <include name="**/**.ps" />
        <include name="**/**.pdf" />
        <include name="**/**.htm" />
        <include name="**/**.html" />
        <exclude name="CVS, *.tar*, *.zip" />
      </fileset>
    </copy>
    <copy todir="${bin.dist.dir}/${javadoc.directory}">
      <fileset dir="${javadoc.directory}">
        <include name="**/**" />
      </fileset>
    </copy>

    <copy todir="${bin.dist.dir}/${tutorial.directory}">
      <fileset dir="tutorial">
        <include name="**/**" />
        <exclude name="CVS" />
      </fileset>
    </copy>
-->

    <tar tarfile="${distribution.directory}/eva2-bin-${DSTAMP}.tar">
      <tarfileset dir="${binary.distribution.directory}">
        <include name="**" />
        <exclude name="*.tar*, *.zip" />
      </tarfileset>
    </tar>
    <gzip zipfile="${distribution.directory}/eva2-bin-${DSTAMP}.tar.gz"
        src="${distribution.directory}/eva2-bin-${DSTAMP}.tar" />
    <delete file="${distribution.directory}/eva2-bin-${DSTAMP}.tar" />

    <zip zipfile="${distribution.directory}/eva2-bin-${DSTAMP}.zip">
      <zipfileset dir="${binary.distribution.directory}">
        <include name="**" />
        <exclude name="*.tar*, *.zip" />
      </zipfileset>
    </zip>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Source Distribution
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="sourceDist" depends="init">
  	<!--<fail message="Not properly supported yet!"/>-->

    <property name="src.dist.dir"  value="${source.distribution.directory}/eva2-${DSTAMP}" />
    <mkdir dir="${src.dist.dir}" />

  	<!--<copy todir="${src.dist.dir}">
      <fileset dir=".">
        <include name="build.xml" />
        <include name="build.sh" />
        <include name="build.bat" />
        <include name="run.sh" />
        <include name="run.bat" />
        <include name="*.txt" />
      </fileset>
    </copy>-->

    <copy todir="${src.dist.dir}/${source.directory}">
      <fileset dir="${source.directory}">
      	<include name="**/*java" />
      	<include name="**/*txt" />
      </fileset>
    </copy>

    <copy todir="${src.dist.dir}/${resources.directory}">
      <fileset dir="${resources.directory}">
      	<include name="**/**" />
      </fileset>
    </copy>
  	
    	
    <mkdir dir="${src.dist.dir}/${library.directory}" />
    <copy todir="${src.dist.dir}/${library.directory}">
      <fileset dir="${library.directory}" includes="**jar" />
    </copy>

  	<!--<copy todir="${src.dist.dir}/doc">
      <fileset dir="doc">
      	<include name="**.pdf" />
      	<include name="**.tex" />
        <include name="**.sh" />
        <include name="**.eps" />
        <include name="**.gif" />
        <include name="**.jpg" />
        <include name="**.bib" />
        <include name="**.bst" />
        <include name="**.zip" />
        <include name="**.htm" />
        <include name="**.html" />
      </fileset>
    </copy>-->

    <tar tarfile="${distribution.directory}/${srcpack.name}.tar"
         basedir="${src.dist.dir}" includes="**" excludes="*.tar*, *.zip"/>
    <gzip zipfile="${distribution.directory}/${srcpack.name}.tar.gz"
          src="${distribution.directory}/${srcpack.name}.tar" />
    <delete file="${distribution.directory}/${srcpack.name}.tar" />

    <zip zipfile="${distribution.directory}/${srcpack.name}.zip">
      <zipfileset dir="${src.dist.dir}">
        <include name="**" />
        <exclude name="*.tar*, *.zip" />
      </zipfileset>
    </zip>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Generate Distribution
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="dist" depends="binaryDist, sourceDist">
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	        Generate Distribution and put it online. This also replaces the 
	        Probs and ESModel packages so keep them synchronized.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

	<target name="distToWWW" depends="init">
		<mkdir dir="${web.download.directory}/old-${DSTAMP}-${TSTAMP}" />
		<copy todir="${web.download.directory}/old-${DSTAMP}-${TSTAMP}">
	      <fileset dir="${web.download.directory}">
	      	<include name="**Src.tar.gz" />
	      	<include name="**.jar" />
	      </fileset>
	    </copy>
	    <copy todir="${web.download.directory}">
	      <fileset dir="${distribution.directory}">
	      	<include name="**Src.tar.gz" />
	      	<include name="**.jar" />
	      </fileset>
	      <fileset dir="${source.directory}/eva2">
	      	<include name="EvAInfo.java" />
	      </fileset>
	    </copy>
	</target>

	
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Run EvA2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="run" description="Runs EvA2.">
    <java classname="eva2.client.EvAClient" fork="yes">
      <jvmarg value="-Xmx512m"/>
      <classpath refid="project.class.path" />
    </java>
  </target>

  <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Run EvA2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="Altana" description="Runs Altana CombiLib Problem.">
    <java classname="eva2.server.oa.go.GOAltana" fork="yes">
      <jvmarg value="-Xmx512m"/>
      <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="Portfolio" description="Runs GOPortfolio.">
    <java classname="eva2.server.oa.go.GOPortfolio" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="PortfolioLS" description="Runs GOPortfolioLS.">
    <java classname="eva2.server.oa.go.GOPortfolioLS" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="PMOEA" description="Runs ParallelMOEAs.">
    <java classname="eva2.server.oa.go.GOParallelMOEA" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GridMC" description="Runs a Grid Search for GO.">
    <java classname="eva2.server.oa.go.GOGridSearchTwo" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>


  <target name="GOSSFirst" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemComparing" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSMSHC" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemMSHC" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSESPopSize" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemESPopSize" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSPmPc" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemPmPc" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSESMutation" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemESMutation" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSGACrossover" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemGACrossover" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="GOSSMALSLI" description="Runs a comparison on system identification.">
    <java classname="eva2.server.oa.go.GOSystemMA" fork="yes">
        <jvmarg value="-Xmx512m" />
        <classpath refid="project.class.path" />
    </java>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        Javadoc
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="javadoc" description="Generates the JavaDoc-API Documentation.">
    <javadoc packagenames="eva2.*"
    windowtitle ="EvA2 API Documentation"
    doctitle    ="EvA2 API Documentation"
    author      ="true"
    version     ="true"
    use         ="true"
    destdir="${javadoc.directory}"
    private     ="true">
            <classpath refid="project.class.path" />
            <sourcepath>
              <pathelement path="${source.directory}" />
            </sourcepath>
            <doctitle><![CDATA[<h1>Test</h1>]]></doctitle>

            <header><![CDATA[<font size="-1"><b><i>
                             <A HREF="http://www.ra.cs.uni-tuebingen.de/forschung/"
                                target="_top">EvA2
                             </A>
                             </b></i></font>]]>
            </header>

        <footer><![CDATA[eva2<br>
                         <A HREF="http://www.ra.cs.uni-tuebingen.de/forschung/"
                            target="_top">EvA2
                         </A>]]>
        </footer>
            <link offline="true"
                  href="http://java.sun.com/j2se/jdk1.5.0_03/docs/api/"
                  packagelistLoc="${env.JAVA_HOME}/docs/api"
            />
            <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
    </javadoc>
  </target>

<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        What's about the software design ?!;-)
        Download required libraries from the JOELib download site:
        http://sourceforge.net/projects/joelib
        Package name: optional-softwaredesign-libs
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->

  <target name="pmd" depends="init" description="SOFTWAREDESIGN: Project Mess Detector !;-)">
      <echo>Checking Project Mess Detection (PMD) rulesets.</echo>
      <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
        <classpath>
          <pathelement path="${project.class.path}" />
          <fileset dir="${library.directory}">
            <include name="*.jar" />
          </fileset>
        </classpath>
      </taskdef>

      <pmd shortFilenames="true" rulesetfiles="rulesets/basic.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_basic.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_basic.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/braces.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_braces.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_braces.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/codesize.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_codesize.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_codesize.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/controversial.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_controversial.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_controversial.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/coupling.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_coupling.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_coupling.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/finalizers.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_finalizers.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_finalizers.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/imports.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_imports.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_imports.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/naming.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_naming.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_naming.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/strictexception.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_strictexception.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_strictexception.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/strings.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_strings.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_strings.html</echo>

      <pmd shortFilenames="true" rulesetfiles="rulesets/unusedcode.xml" failonerror="no">
          <formatter type="summaryhtml" toFile="${build.directory}/pmdReport4EvA2-${DSTAMP}_unusedcode.html"/>
          <fileset dir="${source.directory}">
              <include name="**/*.java"/>
          </fileset>
      </pmd>
     <echo>result written to ${basedir}/${build.directory}/pmdReport4EvA2-${DSTAMP}_unusedcode.html</echo>

      <!-- check for duplicated code -->
      <echo>WARNING: use environment variable: ANT_OPTS=-Xmx512m or this task will fail.</echo>
      <echo>Checking for duplicated code using the Copy/Paste Detector (CPD).</echo>
      <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" >
        <classpath>
          <pathelement path="${project.class.path}" />
          <fileset dir="${library.directory}">
            <include name="*.jar" />
          </fileset>
        </classpath>
      </taskdef>
      <cpd format="text" minimumTokenCount="200" outputFile="${build.directory}/duplicatedCodeReport4EvA2-${DSTAMP}.txt">
        <fileset dir="${source.directory}">
            <include name="**/*.java"/>
        </fileset>
      </cpd>
    <echo>result written to ${basedir}/${build.directory}/duplicatedCodeReport4EvA2-${DSTAMP}.txt</echo>
  </target>


  <target name="javancss" depends="init" description="SOFTWAREDESIGN: Determining the NCSS and CCN code metrics for JOELib.">
    <echo>Starts JavaNCSS ...</echo>
    <taskdef name="javancss" classname="javancss.JavancssAntTask">
      <classpath>
          <pathelement path="${project.class.path}" />
          <fileset dir="${library.directory}">
            <include name="*.jar" />
          </fileset>
        </classpath>
    </taskdef>
    <echo>Cyclomatic
Complexity             Ease of       Risk
Number (CCN)           maintenance
(McCabe metric)
---------------------------------------------
1-10, simple           easy          minimum
11-20, complex         moderate      moderate
21-50, more complex    hard          high
>50, unstable          very hard     very high

</echo>
     <javancss srcdir="${source.directory}"
            includes="**/*.java"
            excludes="jama/**/*.java, jmat/**/*.java, cformat/**/*.java"
            abortOnFail="false"
            ccnPerFuncMax="30"
            generateReport="true"
            outputfile="${build.directory}/javancssReport4EvA2-${DSTAMP}.txt"
            format="text"
            packageMetrics="true"
            classMetrics="false"
            functionMetrics="false"
            />
    <echo>result written to ${basedir}/${build.directory}/javancssReport4EvA2-${DSTAMP}.txt</echo>
  </target>

  <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
    <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
      <classpath refid="project.class.path" />
    </taskdef>
    <jalopy classpathref="project.class.path"
            fileformat="unix"
            convention="../${source.directory}/jalopy.format.convention.xml"
            history="file"
            historymethod="adler32"
            loglevel="error"
            threads="2"
            backup="bak">
      <fileset dir="${source.directory}">
        <include name="**/*.java"/>
      </fileset>
    </jalopy>
  </target>

  <target name="vizant" description="SOFTWAREDESIGN: create dependency graph for ANT files for the JOELib project.">
    <echo>Starts VizANT ...</echo>
    <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant">
      <classpath>
        <pathelement path="${project.class.path}" />
        <fileset dir="${library.directory}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
    <vizant antfile="ant/build.xml" outfile="${build.directory}/vizant_build.dot">
      <attrstmt type="node">
        <attr name="style" value="filled"/>
        <attr name="shape" value="egg"/>
        <attr name="color" value="grey90"/>
      </attrstmt>
    </vizant>
    <vizant antfile="ant/build.xml" outfile="${build.directory}/vizant_check.dot">
      <attrstmt type="node">
        <attr name="style" value="filled"/>
        <attr name="shape" value="egg"/>
        <attr name="color" value="grey90"/>
      </attrstmt>
    </vizant>
    <!-- Here you will need GraphViz at http://www.research.att.com/sw/tools/graphviz/ -->
<!--
    <exec executable="dot" ><arg line="-Tsvg ${build.directory}/vizant_build.dot -o ${build.directory}/vizant_build.svg"/></exec>
    <exec executable="dot" ><arg line="-Tsvg ${build.directory}/vizant_check.dot -o ${build.directory}/vizant_check.svg"/></exec>
-->
    <echo>result written to ${basedir}/${build.directory}/vizant_build.dot ...</echo>
    <echo>result written to ${basedir}/${build.directory}/vizant_check.dot.</echo>
  </target>

  <target name="findbugs.calculate" depends="compile">
    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
      <classpath>
        <pathelement location="${env.JAVA_HOME}/jre/lib/rt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/dt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
        <pathelement path="${project.class.path}" />
        <fileset dir="${library.directory}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </taskdef>
    <property name="findbugs.home" value="${basedir}/lib/findbugs" />
    <findbugs home="${findbugs.home}"
              output="xml"
              outputFile="build/joelib-fb.xml" >
      <auxClasspath>
        <pathelement location="${env.JAVA_HOME}/jre/lib/rt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/dt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
        <pathelement path="${project.class.path}" />
        <fileset dir="${library.directory}">
          <include name="*.jar" />
        </fileset>
      </auxClasspath>
      <sourcePath path="${basedir}/${source.directory}" />
      <class location="${basedir}/${build.directory}" />
    </findbugs>
  </target>

  <target name="findbugsGUI">
    <property name="findbugs.home" value="${basedir}/lib/findbugs" />
    <java classname="edu.umd.cs.findbugs.gui.FindBugsFrame" fork="yes"
          dir="${build.directory}">
      <classpath>
        <pathelement location="${env.JAVA_HOME}/jre/lib/rt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/dt.jar" />
        <pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
        <pathelement path="${project.class.path}" />
        <fileset dir="${library.directory}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${library.directory}/findbugs/lib">
          <include name="*.jar" />
        </fileset>
      </classpath>
      <jvmarg value="-Dfindbugs.home=${findbugs.home}"/>
    </java>
  </target>

  <target name="findbugs" depends="compile" description="SOFTWAREDESIGN: Run bug detector for JOELib and comfortable GUI to analyze results.">
    <echo>Starts findBugs ...</echo>
    <antcall target="findbugs.calculate"/>
    <echo>result written to ${basedir}/${build.directory}/EvA2-fb.xml, now you can open this file with the findBugs GUI ...</echo>
    <echo>open with 'File->LoadBugs' then open '${basedir}/${build.directory}/EvA2-fb.xml'.</echo>
    <antcall target="findbugsGUI"/>
  </target>
</project>

<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   END OF FILE
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
