<?xml version="1.0"?>

<project name="PojoCache tasks">
   <!--
   Tasks definition for JDK1.4 annoc and aopc. In addition to annotate your POJO with JDK-14 style
   annotation, you will also need to define the "source" and "build" directory. It will byte-code
   instrumented your POJOs and update them under build directory. You can verify this by doing
   a listing there to confirm creation of new (and additional) classes.

   To use this, you can use Ant import to import it into you regular build.xml (see the example
   build.xml here). You will need to pass in the following properties: user.source, where your java source
   is located; user.build, where you output classes is located, and finally user.classpath is the
   path element that you java class is using.
   -->
   <!-- Assuming we are at tools directory -->
   <property name="cache_home" value="${basedir}/.."/>
   <property name="cache_lib" value="${cache_home}/lib"/>
   <property name="cache_resource" value="${cache_home}/resources"/>

   <!-- set local properties for this build -->
   <path id="pojocache.lib.classpath">
      <fileset dir="${cache_lib}">
         <include name="jboss-aop.jar"/>
         <include name="jboss-cache.jar"/>
         <include name="jboss-common.jar"/>
         <include name="concurrent.jar"/>
         <include name="javassist.jar"/>
         <include name="trove.jar"/>
         <include name="qdox.jar"/>
      </fileset>
   </path>

   <path id="jboss.aop.classpath">
      <fileset dir="${cache_lib}">
         <include name="jboss-aop.jar"/>
      </fileset>
   </path>

   <!-- pre-compile directory with annotationc using jdk1.4 -->
   <target name="annoc" description="Annotation precompiler for aop class">
      <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="jboss.aop.classpath"/>
      <annotationc compilerclasspathref="pojocache.lib.classpath" bytecode="true">
         <classpath refid="pojocache.lib.classpath"/>
         <classpath refid="user.classpath"/>
         <src path="${user.source}"/>
         <!--include name="examples/*.java"/-->
         <!--exclude name="test/*.java"/-->
      </annotationc>
   </target>

   <!-- pre-compile directory with aopc -->
   <target name="aopc" depends="annoc" description="Precompile aop test classes after annoc">
      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath"/>
      <aopc compilerclasspathref="pojocache.lib.classpath" verbose="true">
         <!-- Can be more specific here -->
         <!--src path="${build}/examples"/-->
         <src path="${user.build}"/>
         <aoppath path="${cache_resources}/jboss-aop.xml"/>
         <classpath refid="user.classpath"/>
      </aopc>
   </target>
</project>
