<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: build.xml 5196 2008-01-22 19:06:36Z manik.surtani@jboss.com $ -->

<project default="compile" name="JBossCache">

   <property name="module.name" value="JBossCache"/>
   <!--We now requires version to have no white space since Ant+JBossAop will sometime choke. -->
   <property name="module.version" value="1.4.1.SP8_CP01"/>
   <property name="implementation.url" value="http://www.jboss.com/products/jbosscache"/>
   <property file="build.properties"/>
   <property name="root.dir" value="${basedir}"/>
   <property name="doc.dir" value="${root.dir}/docs"/>
   <property name="src.dir" value="${root.dir}/src"/>
   <property name="tests.dir" value="${root.dir}/tests"/>
   <property name="examples.dir" value="${root.dir}/examples"/>
   <property name="tools.dir" value="${root.dir}/tools"/>
   <property name="functional.tests.dir" value="${tests.dir}/functional"/>
   <property name="stress.tests.dir" value="${tests.dir}/stress"/>
   <property name="interop.tests.dir" value="${tests.dir}/interop"/>
   <property name="perf.tests.dir" value="${tests.dir}/perf"/>
   <property name="jrunit.tests.dir" value="${tests.dir}/perf"/>
   <property name="interop.tests.dir" value="${tests.dir}/interop"/>
   <property name="compat.tests.dir" value="${tests.dir}/compat"/>
   <property name="etc.dir" value="${root.dir}/etc"/>
   <property name="dependencies" value="dependencies.xml"/>
   <property name="resources.dir" value="${root.dir}/src/resources"/>
   <property name="tmp.dir" value="${root.dir}/tmp"/>
   <property name="output.dir" value="${root.dir}/output"/>
   <property name="output.etc.dir" value="${output.dir}/etc"/>
   <property name="output.resources.dir" value="${output.dir}/resources"/>
   <property name="output.interop.dir" value="${output.dir}/interop"/>
   <property name="compile.dir" value="${output.dir}/classes"/>
   <property name="compiletest.dir" value="${output.dir}/test-classes"/>
   <property name="lib.dir" value="${root.dir}/lib"/>
   <property name="sleepycat.dir" value="${lib.dir}/sleepycat"/>
   <property name="dist.dir" value="${root.dir}/dist"/>
   <property name="dist.lib" value="${dist.dir}/lib"/>
   <property name="build.reports" value="${output.dir}/reports"/>
   <property name="build.reports.html" value="${build.reports}/html"/>
   <property name="build.lib" value="${output.dir}/lib"/>
   <property name="build.api" value="${output.dir}/api"/>
   <property name="build.etc" value="${root.dir}/etc"/>
   <property name="javadoc.packages" value="org.jboss.cache.*"/>
   <property name="junit.timeout" value="300000"/>
   <property name="junit.timeout.stresstest" value="6000000"/>
   <property name="junit.timeout.performance" value="60000"/>
   <property name="junit.timeout.compat" value="300000"/>
   <property name="junit.maxmem" value="1024M"/>
   <property name="junit.batchtest.todir" value="${build.reports}"/>
   <property name="ant.dir" value="${root.dir}/ant-dist"/>
   <property name="manifest.file" value="${dist.lib}/default.mf"/>
   <!-- Test if JDK5 is available -->
   <available classname="java.lang.Enum" property="HAVE_JDK_1.5"/>
   <!-- -->
   <condition property="ENABLE_COMPAT_TESTS">
      <or>
         <equals arg1="${ant.java.version}" arg2="1.5"/>
         <equals arg1="${ant.java.version}" arg2="1.4"/>
      </or>
   </condition>
   <property name="src.dir.50" value="${root.dir}/src-50"/>
   <property name="tests.dir.50" value="${root.dir}/tests-50"/>
   <property name="compile.dir.50" value="${output.dir}/classes-50"/>
   <property name="compiletest.dir.50" value="${output.dir}/test-classes-50"/>
   <property name="output.resources.dir.50" value="${output.dir}/resources-50"/>
   <property name="functional.tests.dir.50" value="${tests.dir.50}/functional"/>
   <property name="perf.tests.dir.50" value="${tests.dir.50}/perf"/>
   <property name="resources.dir.50" value="${src.dir.50}/resources"/>
   <property name="lib.dir.50" value="${root.dir}/lib-50"/>
   <property name="dist.lib.50" value="${dist.dir}/lib-50"/>
   <property name="deprecation" value="off"/>


   <!-- Tests that are currently broken - "known failures" to be excluded when running all-unittests-cc -->
   <!--
       Only one test per line.  Please add a comment with a reference to a JIRA task about this failure.
   -->
   <patternset id="known.failures">

      <!-- See JBCACHE-814 -->
      <exclude name="org/jboss/cache/eviction/ConcurrentEvictionTest*"/>
      <exclude name="org/jboss/cache/passivation/ConcurrentPassivationTest*"/>
      
      <!-- See JBCACHE-641 -->
      <exclude name="org/jboss/cache/eviction/ReplicatedLRUPolicyTest*"/>
      <!-- See JBCACHE-407 -->
      <exclude name="org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest*"/>
      <!-- See JBCACHE-462 -->
      <exclude name="org/jboss/cache/aop/eviction/AopLRUPolicyUpdateEvictionTest*"/>
      <!-- See JBCACHE-461 -->
      <exclude name="org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest*"/>
      <!-- See JBCACHE-479 -->
      <exclude name="org/jboss/cache/aop/loader/FileCacheLoaderAopCollectionsTest*"/>
      <!-- See JBCACHE-477 -->
      <exclude name="org/jboss/cache/aop/collection/CachedListAopTxTest*"/>
      <!-- See JBCACHE-315 -->
      <exclude name="org/jboss/cache/statetransfer/ForcedStateTransferTest*"/>
      <!-- See JBCACHE-654 -->
      <exclude name="org/jboss/cache/aop/memory/*Test*"/>
   </patternset>

   <patternset id="junit.excludes">
      <!-- ALWAYS leave this empty - it is populated later on depending on type of test run -->
   </patternset>

   <path id="library.classpath">
      <fileset dir="${lib.dir}">
         <include name="*.jar"/>
      </fileset>
      <fileset dir="${sleepycat.dir}">
         <include name="*.jar"/>
      </fileset>
   </path>

   <path id="output.classpath">
      <pathelement location="${compile.dir}"/>
      <pathelement location="${output.etc.dir}"/>
      <pathelement location="${compiletest.dir}"/>
      <pathelement location="${functional.tests.dir}" />
   </path>

   <path id="output.classpath.50">
      <pathelement location="${compile.dir.50}"/>
      <pathelement location="${compile.dir}"/>
      <pathelement location="${output.etc.dir}"/>

      <!-- NOTE: Order of compiletest.dir.50 and compile.test.dir is IMPORTANT here!!!
      This is because we want to use the test/*.class under JDK50 first here!!!
      -->
      <dirset dir="${compiletest.dir.50}">
      </dirset>

      <dirset dir="${compiletest.dir}">
      </dirset>

   </path>

   <path id="previous.version.classpath">
      <pathelement location="${output.etc.dir}"/>
      <pathelement location="${compiletest.dir}"/>
      <fileset dir="${lib.dir}">
         <include name="*.jar"/>
     	 <exclude name="jgroups.jar"/>
      </fileset>
      <fileset dir="${output.interop.dir}">
         <include name="*.jar"/>
      </fileset>
   </path>

   <!-- NOTE: replaces the std jgroups version with 2.2.7.  This classpath
        is only meant for use in the interoptests target. -->
   <path id="current.version.classpath">
      <fileset dir="${lib.dir}">
         <include name="*.jar"/>
      	 <exclude name="jgroups.jar"/>
      </fileset>
      <fileset dir="${output.interop.dir}">
         <include name="jgroups.jar"/>
      </fileset>
      <fileset dir="${sleepycat.dir}">
         <include name="*.jar"/>
      </fileset>
      <pathelement location="${compile.dir}"/>
      <pathelement location="${output.etc.dir}"/>
      <pathelement location="${compiletest.dir}"/>
   </path>

   <!-- ================================================================== -->
   <!-- Compile                                                            -->
   <!-- ================================================================== -->
   <target name="compile" depends="compile-classes14, compile-classes50" description="Compiles all Java files">
   </target>

   <target name="compile-classes14" description="Compiles all Java files">

      <mkdir dir="${compile.dir}"/>
      <mkdir dir="${compiletest.dir}"/>

      <!-- compile JBossCache Java code -->
      <javac destdir="${compile.dir}"
             debug="on"
             deprecation="${deprecation}"
             optimize="off"
             includes="**/*.java"
             target="1.4"
             source="1.4"
             failonerror="true">
         <src path="${src.dir}"/>
         <classpath refid="library.classpath"/>
         <exclude name="**/obsolete/**"/>
         <exclude name="**/*1_4*"/>
      </javac>

      <!-- compile test classes -->
      <javac destdir="${compiletest.dir}"
             debug="on"
             deprecation="${deprecation}"
             optimize="off"
             includes="**/*.java"
             target="1.4"
             source="1.4"
             failonerror="true">
         <src path="${functional.tests.dir}"/>
         <src path="${stress.tests.dir}"/>
         <src path="${perf.tests.dir}"/>
         <src path="${jrunit.tests.dir}"/>
         <src path="${compat.tests.dir}"/>
         <src path="${interop.tests.dir}"/>
         <classpath path="${compile.dir}"/>
         <classpath refid="library.classpath"/>
         <exclude name="**/obsolete/**"/>
         <!--<exclude name="**/interop/**"/>-->
         <exclude name="**/*1_4*"/>
      </javac>

      <copy todir="${output.etc.dir}" filtering="no" overwrite="yes">
         <fileset dir="${etc.dir}">
            <include name="META-INF/*.xml"/>
            <include name="log4j.xml"/>
            <include name="jboss-aop.xml"/>
            <!-- The following copies the cache-jdbc.properties file for
                         running jdbc cache loader test against different DBMS -->
            <include name="cache-jdbc.properties"/>
         </fileset>
      </copy>

      <copy todir="${output.resources.dir}" filtering="no" overwrite="yes">
         <fileset dir="${resources.dir}">
            <include name="*.xml"/>
         </fileset>
      </copy>
   </target>

   <target name="compile-classes50" if="HAVE_JDK_1.5">
      <mkdir dir="${compile.dir.50}"/>
      <mkdir dir="${compiletest.dir.50}"/>

      <javac destdir="${compile.dir.50}"
             optimize="off"
             target="1.5"
             source="1.5"
             debug="on"
             deprecation="${deprecation}"
             failonerror="true">
         <src path="${src.dir.50}"/>
         <classpath refid="library.classpath"/>
      </javac>
      <!-- compile test classes -->
      <javac destdir="${compiletest.dir.50}"
             debug="on"
             deprecation="${deprecation}"
             optimize="off"
             includes="**/*.java"
             target="1.5"
             source="1.5"
             failonerror="true">
         <src path="${functional.tests.dir.50}"/>
         <!-- src path="${perf.tests.dir.50}"/ -->
         <classpath path="${compile.dir.50}"/>
         <classpath path="${compile.dir}"/>
         <classpath refid="library.classpath"/>
      </javac>

   </target>

   <!--   <target name="generate-rmi">-->
   <!--      <rmic classname="org.jboss.cache.loader.rmi.RemoteTreeCacheImpl" base="${compile.dir}"/> -->
   <!--   </target>-->


   <!-- ================================================================== -->
   <!-- Create jboss-cache.jar                                             -->
   <!-- ================================================================== -->
   <target name="jar" description="Builds jboss-cache.jar" depends="compile, manifest, jar-14, jar-50">
   </target>

   <target name="jar-14" depends="compile-classes14, manifest" description="Builds jboss-cache.jar">
      <mkdir dir="${dist.lib}"/>
      <jar jarfile="${dist.lib}/jboss-cache.jar" manifest="${manifest.file}">
         <fileset dir="${compile.dir}">
            <include name="org/jboss/cache/**"/>
            <!-- this exclude is now unnecessary since tests are compiled to a separate output dir -->
            <!-- <exclude name="org/jboss/cache/**/*Test*"/> -->
         </fileset>
         <fileset dir="${etc.dir}">
            <include name="${dependencies}"/>
         </fileset>
      </jar>
   </target>

   <target name="jar-50" depends="compile-classes50, manifest" description="Builds jboss-cache.jar" if="HAVE_JDK_1.5">
      <mkdir dir="${dist.lib.50}"/>
      <jar jarfile="${dist.lib.50}/jboss-cache-jdk50.jar" manifest="${manifest.file}">
         <fileset dir="${compile.dir}">
            <include name="org/jboss/cache/**"/>
         	<!-- No reason to exclude these -->
            <!--exclude name="org/jboss/cache/aop/AopMarker.class"/>
            <exclude name="org/jboss/cache/aop/InstanceOfAopMarker.class"/-->
            <exclude name="org/jboss/cache/aop/annotation/*.class"/>
            <!-- this exclude is now unnecessary since tests are compiled to a separate output dir -->
            <!-- <exclude name="org/jboss/cache/**/*Test*"/> -->
         </fileset>
         <fileset dir="${compile.dir.50}">
            <include name="org/jboss/cache/aop/**"/>
         </fileset>
         <fileset dir="${etc.dir}">
            <include name="${dependencies}"/>
         </fileset>
      </jar>
   </target>

   <target name="manifest">
      <tstamp/>
      <mkdir dir="${dist.lib}"/>
      <manifest file="${manifest.file}">
         <attribute name="Built-By" value="${user.name}"/>
         <attribute name="Created-On" value="${TODAY}"/>
         <attribute name="Main-Class" value="org.jboss.cache.Version"/>
         <attribute name="Specification-Title" value="JBossCache"/>
         <attribute name="Specification-Version" value="${module.version}"/>
         <attribute name="Specification-Vendor" value="JBoss Inc."/>
         <attribute name="Implementation-Title" value="${module.name}"/>
         <attribute name="Implementation-Version" value="${module.version}"/>
         <attribute name="Implementation-Vendor" value="JBoss Inc."/>
      </manifest>
   </target>


   <!-- ================================================================== -->
   <!-- Documentation                                                      -->
   <!-- ================================================================== -->
   <target name="javadocs" description="Create Javadoc documentation in the ./doc/javadoc directory">
      <javadoc packagenames="${javadoc.packages}"
               sourcepath="${src.dir}"
               destdir="${build.api}"
               classpathref="library.classpath"
               author="true"
               version="true"
               use="true"
               bottom="Copyright &#169; 1998-2005 JBoss Inc . All Rights Reserved."
               useexternalfile="yes"/>
   </target>


   <target name="version" description="Prints version of JBossCache">
      <java classname="org.jboss.cache.Version" classpath="${compile.dir}"/>
   </target>


   <!-- ================================================================== -->
   <!-- Cleaning                                                           -->
   <!-- ================================================================== -->
   <target name="clean">
      <delete dir="${output.dir}"/>
      <delete dir="${build.lib}"/>
      <delete dir="${build.api}"/>
      <delete dir="${build.reports}"/>
      <delete dir="${dist.dir}"/>
      <delete dir="${tmp.dir}"/>
      <delete dir="${root.dir}/jbossdb"/>
      <delete>
         <fileset dir="${basedir}" defaultexcludes="no">
            <include name="**/*~"/>
            <include name="derby.*"/>
         </fileset>
      </delete>
   </target>

   <target name="clean-tests">
      <delete dir="${output.dir}/tests-classes"/>
      <delete dir="${output.dir}/tests-classes-50"/>
   </target>


   <!-- ================================================================== -->
   <!-- Tests                                                              -->
   <!-- ================================================================== -->

   <target name="one-test" depends="compile,unittests-init" description="Runs a single unit test">
      <junit printsummary="yes" timeout="${junit.timeout.stresstest}" fork="yes">
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <test name="${test}" todir="${build.reports}"/>
         <jvmarg value="-Dlib.dir=${lib.dir}"/>
      </junit>
   </target>

   <target name="one-test-aop" depends="generateClassLoader, compile,unittests-init"
           description="Runs a single unit test">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <jvmarg value="-Djboss.aop.path=${output.etc.dir}/jboss-aop.xml"/>
         <jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
         <!--  start of Optimizeit support
               sample script
         #!/bin/sh
         # sample opt.sh script
         # usage:  ./opt.sh  -Dtest=org.jboss.cache.aop.LocalPerfAopTest one-test-aop
         export OPTITDIR=/home/smarlow/optimeit/OptimizeitSuite60
         export PATH=$PATH:/home/smarlow/optimeit/OptimizeitSuite60
         export LD_LIBRARY_PATH=$OPTITDIR/lib:$LD_LIBRARY_PATH
         ./build.sh -Dbootclasspath=$OPTITDIR/lib/oibcp.jar -Doptjar=$OPTITDIR/lib/optit.jar -DOPTITDIR=$OPTITDIR  "$@"
         -->
         <!--
         <jvmarg value="-Xrunpri:startAudit=t,noexit=t"/>
         <jvmarg value="-DOPTITDIR=${OPTITDIR}"/>
         <classpath location="${optjar}"/>
end of optimizeIt support
-->
         <!-- support for JDWP debug
                <jvmarg value="-Xdebug"/>
                <jvmarg value="-Xnoagent"/>
                <jvmarg value="-Djava.compiler=NONE"/>
                <jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=localhost:2401"/>
         -->
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <test name="${test}" todir="${build.reports}"/>
      </junit>
   </target>

   <target name="one-test-aop50" depends="compile, unittests-init" description="Runs a single unit test">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <jvmarg value="-Djboss.aop.path=${output.resources.dir}/jboss-aop.xml"/>
         <!--
         <jvmarg value="-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader"/>
         -->
         <jvmarg value="-javaagent:${lib.dir.50}/jboss-aop-jdk50.jar"/>
         <classpath refid="output.classpath.50"/>
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <classpath refid="library.classpath"/>
         <formatter type="xml" usefile="true"/>
         <test name="${test}" todir="${build.reports}"/>
      </junit>
   </target>

   <target name="one-test-aop50WithAopC" depends="compile, aopc50, unittests-init"
           description="Runs a single unit test">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="output.classpath.50"/>
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <classpath refid="library.classpath"/>
         <formatter type="xml" usefile="true"/>
         <test name="${test}" todir="${build.reports}"/>
      </junit>
   </target>

   <target name="unittests-init">
      <mkdir dir="${build.reports}"/>
   </target>

   <target name="test-jar" depends="compile">
      <jar jarfile="${output.dir}/testMarshall.jar">
         <fileset dir="${compiletest.dir}">
            <include name="org/jboss/cache/marshall/Address.class"/>
            <include name="org/jboss/cache/marshall/Person.class"/>
         </fileset>
      </jar>
   </target>


   <!--
      <target name="tcp-cache-service" depends="compile"
              description="Creates the service archive used to deploy a TcpCacheServer as a JBoss MBean">
         <mkdir dir="${dist.dir}"/>
         <jar jarfile="${dist.dir}/TcpCacheServer.sar"
              basedir="${compile.dir}"
              includes="org/jboss/cache/loader/tcp/TcpCacheServer*">
            <metainf dir="${etc.dir}/TcpCacheServer"
                     includes="jboss-service.xml"/>
         </jar>
      </target>
   -->


   <!-- pre-compile directory with annotationc using jdk1.4 -->
   <target name="annoc" depends="compile" description="Annotation precompiler for aop class">
      <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="library.classpath"/>
      <annotationc compilerclasspathref="library.classpath" bytecode="true">
         <classpath path="${compile.dir}"/>
         <classpath path="${compiletest.dir}"/>
         <classpath path="${output.resources.dir}"/>
         <src path="${functional.tests.dir}"/>
         <src path="${perf.tests.dir}"/>
         <include name="org/jboss/cache/aop/test/**/*.java"/>
         <include name="org/jboss/cache/data/*.java"/>
      </annotationc>
   </target>

   <!-- pre-compile directory with aopc -->
   <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="library.classpath"/>
   <target name="aopcWithAnnoc" depends="annoc" description="Precompile aop test classes after annoc">
      <aopc compilerclasspathref="library.classpath" verbose="true">
         <src path="${compiletest.dir}/org/jboss/cache/aop/test"/>
         <src path="${compiletest.dir}/org/jboss/cache/data"/>
         <aoppath path="${output.resources.dir}/jboss-aop.xml"/>
         <classpath refid="output.classpath"/>
      </aopc>
      <aopc compilerclasspathref="library.classpath" verbose="true">
         <src path="${compiletest.dir}/org/jboss/cache/aop/test/propagation/impl"/>
         <aoppath path="${output.resources.dir}/jboss-aop.xml"/>
         <classpath refid="output.classpath"/>
      </aopc>
   </target>

   <!-- pre-compile directory with aopc -->
   <target name="aopc" depends="compile" description="Precompile aop test classes">
      <aopc compilerclasspathref="library.classpath" classpathref="library.classpath" verbose="true">
         <src path="${compiletest.dir}/org/jboss/cache/aop/test"/>
         <aoppath path="${output.etc.dir}/jboss-aop.xml"/>
         <classpath>
            <path refid="output.classpath"/>
         </classpath>
      </aopc>
   </target>

   <!-- pre-compile directory with aopc50 -->
   <target name="aopc50" depends="compile" description="Precompile aop test classes">
      <aopc compilerclasspathref="library.classpath" classpathref="library.classpath" verbose="true">
         <src path="${compiletest.dir.50}/org/jboss/cache/aop/test"/>
         <!--src path="${compiletest.dir.50}/org/jboss/cache/data"/-->
         <aoppath path="${output.resources.dir}/jboss-aop.xml"/>
         <classpath>
            <path refid="output.classpath.50"/>
         </classpath>
      </aopc>
   </target>

   <target name="functionaltests" depends="compile,test-jar,unittests-init"
           description="Runs all non-AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes" maxmemory="${junit.maxmem}">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <jvmarg value="-Dtest.jar.dir=${output.dir}"/>
         <jvmarg value="-Dlib.dir=${lib.dir}"/>
         <formatter type="xml" usefile="true"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/*Test.*"/>
               <exclude name="**/aop/**/*"/>
               <exclude name="**/interop/**/*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="jrunit-tests" depends="compile,test-jar,unittests-init" description="Executes JRunit Benchmark Tests">
      <taskdef name="receiver" classname="org.jboss.jrunit.controller.ant.AntBenchmarkReceiver"
               classpathref="library-with-jdbc.classpath"/>

      <taskdef name="quit" classname="org.jboss.jrunit.controller.ant.AntQuitBenchmark"
               classpathref="library-with-jdbc.classpath"/>
      <receiver>
         <databasereceiver jdbcClass="${jdbc-driver-class}"
                           jdbcURL="${jdbc-driver-url}" jdbcUserName="${jdbc-driver-user}"
                           jdbcPassword="${jdbc-driver-password}" onlyIf="jdbc-driver-class"/>
         <filereceiver directory="${output.dir}" onlyif="output.dir"/>

         <customreport parameter="${output.dir}"
                       className="org.jboss.jrunit.controller.reporters.SerializerReporter"/>
      </receiver>

      <junit printsummary="yes" timeout="${junit.timeout.performance}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <!-- jvmarg value="-Dbind.address=${bind.address}"/ -->
         <jvmarg value="-Dtest.jar.dir=${output.dir}"/>
         <formatter type="xml" usefile="true"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${jrunit.tests.dir}"
                     includes="**/*JRunitTest.java"/>
         </batchtest>
      </junit>

      <quit/>
   </target>

   <target name="functionalAopTestsWithAnnoC" depends="compile,aopcWithAnnoc,unittests-init"
           description="Runs all AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.resources.dir}/jboss-aop.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>


   <target name="functionalAopTestsWithAopC" depends="compile,aopc,unittests-init"
           description="Runs all AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.etc.dir}/jboss-aop.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="functionalAop50TestsWithAopC" depends="compile,aopc50,unittests-init"
           description="Runs all AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath.50"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.resources.dir}/jboss-aop.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
            <fileset dir="${functional.tests.dir.50}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="functionalAopTests50" depends="compile, unittests-init" description="Runs all AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <jvmarg value="-Djboss.aop.path=${output.resources.dir}/jboss-aop.xml"/>
         <jvmarg value="-javaagent:${lib.dir.50}/jboss-aop-jdk50.jar"/>
         <classpath refid="output.classpath.50"/>
         <classpath refid="library.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <sysproperty key="log4j.configuration" value="file:${etc.dir}/log4j.xml"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
            <fileset dir="${functional.tests.dir.50}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <!--
   This is new target since 1.2.4. Since the old way using SystemClassLoader ie error prone, it has been replcaed in
   JBossAop 1.3.1 for the new GeneratedInstrumentedClassLoader. But for this to work, we will need this target
   to generate a temporarily ClassLoader under gen-bootclasspath directory
   -->
   <target name="generateClassLoader"
           description="Generate a new modified class loader so we can perform load time instrumentation">
      <property name="build.bootclasspath" value="${output.dir}/gen-bootclasspath"/>
      <java classname="org.jboss.aop.hook.GenerateInstrumentedClassLoader">
         <classpath>
            <path refid="library.classpath"/>
         </classpath>
         <arg value="${build.bootclasspath}"/>
      </java>
      <path id="bootclasspath">
         <pathelement location="${build.bootclasspath}"/>
         <path refid="library.classpath"/>
      </path>
      <property name="bootclasspath" refid="bootclasspath"/>
   </target>

   <target name="functionalAopTests" depends="generateClassLoader, compile,unittests-init"
           description="Runs all AOP functional tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.etc.dir}/jboss-aop.xml"/>
         <jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <batchtest todir="${build.reports}">
            <fileset dir="${functional.tests.dir}">
               <include name="**/aop/**/*Test.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="perfAopTests" depends="compile,aopc,unittests-init" description="Runs all AOP performance tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.etc.dir}/jboss-aop.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <batchtest todir="${build.reports}">
            <fileset dir="${perf.tests.dir}">
               <include name="**/aop/**/*AopTest.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="stressAopTests" depends="compile,aopc,unittests-init" description="Runs all AOP stress tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <formatter type="xml" usefile="true"/>
         <jvmarg value="-Djboss.aop.path=${output.etc.dir}/jboss-aop.xml"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <batchtest todir="${build.reports}">
            <fileset dir="${stress.tests.dir}">
               <include name="**/aop/**/*AopTest.*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="all-functionaltests" depends="functionaltests, functionalAopTestsWithAnnoC"
           description="Runs all functional tests (including AOP tests)">
   </target>

   <target name="perftests" depends="compile,unittests-init" description="Runs all non-AOP perf tests">
      <junit printsummary="yes" timeout="${junit.timeout}" fork="yes" maxmemory="${junit.maxmem}">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <formatter type="xml" usefile="true"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${perf.tests.dir}">
               <include name="**/*Test.*"/>
               <exclude name="**/aop/**/*"/>
               <exclude name="**/*JRunitTest.*"/>
               <exclude name="**/benchmark/**/*"/>
               <exclude name="**/manualtests/**/*"/>
               <exclude name="**/optimistic/Local*"/>
               <exclude name="**/interop/**/*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="all-perftests" depends="perftests, perfAopTests"
           description="Runs all perf tests (including AOP tests)">
   </target>

   <target name="stresstests" depends="compile,unittests-init" description="Runs all non-AOP perf tests">
      <junit printsummary="yes" timeout="${junit.timeout.stresstest}" fork="yes" maxmemory="${junit.maxmem}">
         <classpath refid="library.classpath"/>
         <classpath refid="output.classpath"/>
         <jvmarg value="-Dbind.address=${bind.address}"/>
         <jvmarg value="-Djava.net.preferIPv4Stack=true" />
         <formatter type="xml" usefile="true"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${stress.tests.dir}">
               <include name="**/*Test.*"/>
               <exclude name="**/aop/**/*"/>
               <exclude name="**/interop/**/*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="interoptests" depends="compile,test-jar,unittests-init">

      <!-- Download the cache version against which we check interop -->
      <mkdir dir="${output.interop.dir}"/>
   	
      <get dest="${output.interop.dir}/jboss-cache.jar"
           src="http://repository.jboss.com/jboss/cache/1.2.3.1/lib/jboss-cache.jar" verbose="true"/>
   	  <!-- 
   	       In 1.4.1 we moved to JG 2.4.1 by default, so we need to bring down the old jgroups as well.
   	       The current.version.classpath and previous.version.classpath will use the old jgroups.
   	  -->
      <get dest="${output.interop.dir}/jgroups.jar"
           src="http://repository.jboss.com/jgroups/2.2.7/lib/jgroups.jar" verbose="true"/>

      <start-interop-target name="previous version" conf="META-INF/interopPrevSync-service.xml"
                            classpath="previous.version.classpath"/>
      <sleep seconds="3"/>
      <run-interop-tests name="current version" desc="PrevTargetSync" conf="META-INF/interopCurSync-service.xml"
                         classpath="current.version.classpath"/>
      <stop-interop-target/>

      <start-interop-target name="current version" conf="META-INF/interopCurSync-service.xml"
                            classpath="current.version.classpath"/>
      <sleep seconds="3"/>
      <run-interop-tests name="previous version" desc="CurTargetSync" conf="META-INF/interopPrevSync-service.xml"
                         classpath="previous.version.classpath"/>
      <stop-interop-target/>

      <start-interop-target name="previous version" conf="META-INF/interopPrevAsync-service.xml"
                            classpath="previous.version.classpath"/>
      <sleep seconds="3"/>
      <run-interop-tests name="current version" desc="PrevTargetAsync" conf="META-INF/interopCurAsync-service.xml"
                         classpath="current.version.classpath"/>
      <stop-interop-target/>

      <start-interop-target name="current version" conf="META-INF/interopCurAsync-service.xml"
                            classpath="current.version.classpath"/>
      <sleep seconds="3"/>
      <run-interop-tests name="previous version" desc="CurTargetAsync" conf="META-INF/interopPrevAsync-service.xml"
                         classpath="previous.version.classpath"/>
      <stop-interop-target/>

   </target>

   <macrodef name="start-interop-target">
      <attribute name="name"
                 description="The name of the cache"/>
      <attribute name="conf"
                 description="The config file name passed to the cache"/>
      <attribute name="classpath"
                 description="The config file name passed to the cache"/>
      <sequential>
         <echo message="Will start a @{name} JBossCache instance with @{conf}"/>
         <java classname="org.jboss.cache.interop.Main" fork="true" spawn="true">
            <classpath refid="@{classpath}"/>
            <arg value="@{conf}"/>
         </java>
      </sequential>
   </macrodef>

   <macrodef name="stop-interop-target">
      <sequential>
         <echo message="Will stop the JBossCache instance"/>
         <java classname="org.jboss.cache.interop.Shutdown" fork="true">
            <classpath>
               <path refid="library.classpath"/>
               <path refid="output.classpath"/>
            </classpath>
         </java>
      </sequential>
   </macrodef>

   <macrodef name="run-interop-tests">
      <attribute name="name"
                 description="The name of the cache"/>
      <attribute name="desc"
                 description="The summary desc"/>
      <attribute name="conf"
                 description="The config file name passed to the cache"/>
      <attribute name="classpath"
                 description="The config file name passed to the cache"/>
      <sequential>
         <echo message="Running tests with a @{name} JBossCache instance with @{conf}"/>
         <junit printsummary="yes" timeout="${junit.timeout}" fork="yes" maxmemory="${junit.maxmem}">
            <classpath refid="@{classpath}"/>
            <sysproperty key="interop.test.config" value="@{conf}"/>
            <formatter type="xml" usefile="true" extension="-@{desc}.xml"/>
            <batchtest todir="${build.reports}">
               <fileset dir="${interop.tests.dir}">
                  <include name="**/*Test.*"/>
                  <exclude name="**/aop/**/*"/>
                  <exclude name="**/*JRunitTest*"/>
                  <patternset refid="junit.excludes"/>
               </fileset>

            </batchtest>
         </junit>
      </sequential>
   </macrodef>

   <target name="compat-tests" depends="jar, unittests-init"
           if="ENABLE_COMPAT_TESTS">
      <condition property="libdir.list" value="lib-50,lib, dist/lib-50">
         <equals arg1="${ant.java.version}" arg2="1.5"/>
      </condition>
      <condition property="libdir.list" value="lib, dist/lib">
         <equals arg1="${ant.java.version}" arg2="1.4"/>
      </condition>

      <junit printsummary="yes" timeout="${junit.timeout.compat}" fork="yes" maxmemory="${junit.maxmem}">
         <classpath>
            <pathelement path="${compiletest.dir}"/>
         </classpath>
         <sysproperty key="libdir.list" value="${libdir.list}"/>
         <formatter type="xml" usefile="true"/>
         <batchtest todir="${build.reports}">
            <fileset dir="${compat.tests.dir}">
               <exclude name="**/tools/**/*"/>
               <patternset refid="junit.excludes"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="unittests"
           depends="functionaltests, perftests, stresstests"
           description="Run all non-AOP unit tests (functional, perf, stress)"/>

   <target name="all-unittests"
           depends="all-functionaltests, all-perftests, stresstests"
           description="Run all unit tests, including AOP-based ones (functional, perf, stress)"/>

   <target name="all-unittests-cc" depends="clean"
           description="Run all unit tests, including AOP-based ones (functional, perf, stress) for CruiseControl, (excludes 'known failures')">
      <!--<patternset id="my.junit.excludes">-->
      <!--<patternset refid="known.failures" />-->
      <!--<exclude name="org/jboss/cache/C*" />-->
      <!--</patternset>-->
      <antcall target="all-unittests" inheritrefs="false">
         <!--<param name="junit.excludes" id="junit.excludes" refid="my.junit.excludes" />-->
         <reference refid="known.failures" torefid="junit.excludes"/>
      </antcall>
   </target>

   <target name="findxalan">
      <available property="xalan.available" classname="org.apache.xalan.Version"/>
      <fail unless="xalan.available"
            message="Xalan was not found. Please add the xalan.jar file from the lib directory to the CLASSPATH and retry"/>
   </target>


   <target name="reports"
           description="Generates HTML from unit tests (target unitests-* must have run before)">
      <delete dir="${build.reports.html}"/>
      <mkdir dir="${build.reports.html}"/>
      <junitreport todir="${build.reports.html}">
         <fileset dir="${build.reports}" includes="**/TEST-*.xml"/>
         <report todir="${build.reports.html}"/>
      </junitreport>
      <echo message="********************************************************************"/>
      <echo message="The unit test report is available in ${build.reports.html}/index.html"/>
      <echo message="********************************************************************"/>
   </target>

   <!-- ================================================================== -->
   <!-- Build all html/pdf docs in various sub dirs                        -->
   <!-- ================================================================== -->
   <target name="docs" description="Build all html and pdf docs">

      <echo message="Building docs from docbook ..."/>
      <!-- Bail out if ../docbook-support dir does not exist -->
      <available file="${root.dir}/../docbook-support" type="dir"
                 property="docbook.support.present"/>
      <fail message="docbook-support directory does not exist, please check it out from jboss first (module name is 'docbook-support'."
            unless="docbook.support.present"/>

      <ant dir="${root.dir}/docs/faq" antfile="build.xml"
           target="all.doc"/>
      <ant dir="${root.dir}/docs/tutorial" antfile="build.xml"
           target="all.doc"/>
      <ant dir="${root.dir}/docs/TreeCache" antfile="build.xml"
           target="all.doc"/>
      <ant dir="${root.dir}/docs/PojoCache" antfile="build.xml"
           target="all.doc"/>
   </target>

   <!-- ================================================================== -->
   <!-- Install & Release                                                  -->
   <!-- ================================================================== -->

   <target name="dist" description="Creates a full standalone distribution" depends="dist-message, dist50"/>

   <target name="dist-message" unless="HAVE_JDK_1.5">
      <fail message="WARNING ... Need to use JDK15 compiler to build distro (instead of 1.4). Will not build."/>
   </target>

   <target name="dist50" description="Creates a full standalone distribution" depends="jar, docs, javadocs"
           if="HAVE_JDK_1.5">

      <!-- Now make temp dirs, copy files and create the zip files -->
      <mkdir dir="${tmp.dir}"/>
      <mkdir dir="${tmp.dir}/lib"/>
      <mkdir dir="${tmp.dir}/docs"/>
      <mkdir dir="${tmp.dir}/examples"/>
      <mkdir dir="${tmp.dir}/tools"/>
      <mkdir dir="${tmp.dir}/tests"/>
      <mkdir dir="${tmp.dir}/etc"/>
      <mkdir dir="${tmp.dir}/resources"/>
      <mkdir dir="${tmp.dir}/docs/javadoc"/>
      <mkdir dir="${tmp.dir}/docs/faq"/>
      <mkdir dir="${tmp.dir}/docs/tutorial"/>
      <mkdir dir="${tmp.dir}/docs/TreeCache"/>
      <mkdir dir="${tmp.dir}/docs/PojoCache"/>
      <mkdir dir="${tmp.dir}/ant-dist"/>
      <mkdir dir="${tmp.dir}/src"/>
      <mkdir dir="${tmp.dir}/lib-50"/>
      <mkdir dir="${tmp.dir}/tests-50"/>

      <copy todir="${tmp.dir}/ant-dist" filtering="no">
         <fileset dir="${ant.dir}"/>
      </copy>

      <chmod dir="${tmp.dir}/ant-dist/bin" perm="+x" includes="*"/>

      <copy todir="${tmp.dir}" filtering="no">
         <fileset dir="${etc.dir}">
            <include name="build.xml"/>
            <include name="*.sh"/>
            <include name="*.bat"/>
            <include name="build.properties"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/resources" filtering="no">
         <fileset dir="${resources.dir}">
            <include name="jboss-aop.xml"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}" filtering="no">
         <fileset dir="${doc.dir}">
            <include name="Changelog.txt"/>
            <include name="Readme.txt"/>
            <include name="ReleaseNotes.txt"/>
	         <include name="JBossORG-EULA.txt" />
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/etc" filtering="no">
         <fileset dir="${etc.dir}">
            <include name="log4j.release.xml"/>
            <exclude name="log4j.xml"/>
            <include name="jboss-aop.xml"/>
            <include name="META-INF/*.xml"/>
            <include name="cache-jdbc.properties"/>
         </fileset>
      </copy>

      <move file="${tmp.dir}/etc/log4j.release.xml" tofile="${tmp.dir}/etc/log4j.xml" />

      <copy todir="${tmp.dir}/tests" filtering="no">
         <fileset dir="${functional.tests.dir}">
            <include name="**/*.java"/>
            <include name="**/*.clazz"/>
            <exclude name="**/loader/Bdbje*.java"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/tests-50" filtering="no">
         <fileset dir="${functional.tests.dir.50}">
            <include name="**/*.java"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/examples" filtering="no">
         <fileset dir="${examples.dir}">
            <!--include name="**/*.java"/-->
            <exclude name="**/CVS/*"/>
            <!-- Need this because of phantom directories -->
            <exclude name="**/aop/**"/>
            <!-- Exclude this for now -->
            <exclude name="**/article/**"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/tools" filtering="no">
         <fileset dir="${tools.dir}">
            <!--include name="**/*.java"/-->
            <exclude name="**/CVS/*"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/lib" filtering="no">
         <fileset dir="${lib.dir}">
            <include name="*.jar"/>
            <include name="**/licenses/*"/>
            <exclude name="jrunit*.jar"/>
            <exclude name="jfreechart*.jar"/>
            <exclude name="jcommon*.jar"/>
         </fileset>
         <fileset dir="${dist.lib}">
            <include name="jboss-cache.jar"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/lib-50" filtering="no">
         <fileset dir="${lib.dir.50}">
            <include name="*.jar"/>
            <include name="**/licenses/*"/>
         </fileset>
         <fileset dir="${dist.lib.50}">
            <include name="jboss-cache-jdk50.jar"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/docs/javadoc" filtering="no">
         <fileset dir="${build.api}">
            <include name="**/*"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}/docs/faq" filtering="no">
         <fileset dir="${doc.dir}/faq/build"/>
      </copy>

      <copy todir="${tmp.dir}/docs/tutorial" filtering="no">
         <fileset dir="${doc.dir}/tutorial/build"/>
      </copy>

      <copy todir="${tmp.dir}/docs/TreeCache" filtering="no">
         <fileset dir="${doc.dir}/TreeCache/build"/>
      </copy>

      <copy todir="${tmp.dir}/docs/PojoCache" filtering="no">
         <fileset dir="${doc.dir}/PojoCache/build"/>
      </copy>

      <copy todir="${tmp.dir}/src" filtering="no">
         <fileset dir="${src.dir}">
            <exclude name="**/CVS/*"/>
         </fileset>
      </copy>

      <copy todir="${tmp.dir}" filtering="no">
         <fileset dir="${etc.dir}">
            <include name="*.bsh"/>
         </fileset>
      </copy>

      <delete file="${dist.dir}/jboss-cache-dist-${module.version}.zip"/>
      <delete file="${dist.dir}/jboss-cache-minimal-dist-${module.version}.zip"/>
      <delete file="${dist.dir}/bdbje-for-jbosscache-${module.version}.zip"/>

      <chmod perm="+x">
         <fileset dir="${dist.dir}">
            <include name="**/*.sh"/>
            <include name="**/*.bsh"/>
            <include name="**/*.bat"/>
         </fileset>
      </chmod>

      <zip zipfile="${dist.dir}/jboss-cache-srcOnly-${module.version}.zip">
         <zipfileset dir="${tmp.dir}" prefix="${module.name}-${module.version}" filemode="755">
            <include name="src/**"/>
            <include name="*EULA*" />
         </zipfileset>
      </zip>

      <zip zipfile="${dist.dir}/jboss-cache-dist-${module.version}.zip">
         <zipfileset dir="${tmp.dir}" prefix="${module.name}-${module.version}" filemode="755">
            <include name="**/*"/>
            <exclude name="src/**"/>
         </zipfileset>
      </zip>

      <!-- now remove stuff to make a minimal zip -->
      <delete dir="${tmp.dir}/docs"/>
      <delete dir="${tmp.dir}/examples"/>
      <delete dir="${tmp.dir}/tests"/>
      <delete dir="${tmp.dir}/ant-dist"/>
      <delete dir="${tmp.dir}/src"/>
      <delete>
         <fileset dir="${tmp.dir}" includes="**/*.bsh"/>
         <fileset dir="${tmp.dir}" includes="**/junit.jar"/>
         <fileset dir="${tmp.dir}" includes="**/jrunit.jar"/>
         <fileset dir="${tmp.dir}" includes="**/runShellDemo.*"/>
         <fileset dir="${tmp.dir}" includes="**/bsh*.jar"/>
         <fileset dir="${tmp.dir}" includes="**/build.*"/>
      </delete>

      <zip zipfile="${dist.dir}/jboss-cache-minimal-dist-${module.version}.zip">
         <zipfileset dir="${tmp.dir}" prefix="${module.name}-${module.version}" filemode="755">
            <include name="**/*"/>
         </zipfileset>
      </zip>

      <zip zipfile="${dist.dir}/bdbje-for-jbosscache-${module.version}.zip">
         <zipfileset dir="${sleepycat.dir}">
            <include name="*"/>
         </zipfileset>
      </zip>

      <!-- Remove temp dirs -->
      <delete dir="${tmp.dir}"/>

      <!-- build checksums -->
      <checksum file="${dist.dir}/jboss-cache-srcOnly-${module.version}.zip"/>
      <checksum file="${dist.dir}/jboss-cache-dist-${module.version}.zip"/>
      <checksum file="${dist.dir}/jboss-cache-minimal-dist-${module.version}.zip"/>
      <checksum file="${dist.dir}/bdbje-for-jbosscache-${module.version}.zip"/>
   </target>

   <target name="perfTestJar" depends="compile-classes14, manifest" description="Builds jar file for the perf test">
      <jar jarfile="${output.dir}/perfTest.jar">
         <fileset dir="${compiletest.dir}">
            <include name="org/jboss/cache/data/**"/>
            <include name="org/jboss/cache/Server*.class"/>
         </fileset>
      </jar>
   </target>


</project>
