<?xml version="1.0"?>

<project name="aop examples annotated" default="help">

   <property name="build.sysclasspath" value="ignore"/>
   <property name="junit.timeout" value="180000"/>
   <!-- 3 minutes -->

   <property file="./build.properties"/>

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

   <!-- Need to define these before importing PojoCacheTasks.xml -->
   <!-- You define your own classpath here -->
   <path id="user.classpath">
      <pathelement path="${build}"/>
      <path refid="lib.classpath"/>
   </path>
   <property name="user.build" value="${build}"/>
   <property name="user.source" value="${source}"/>

   <import file="PojoCacheTasks.xml" />

   <target name="help" description="help page">
      <echo message="build.sh &lt;command&gt; where command is:"/>
      <echo message="         compile       -- compile the examples code"/>
      <echo message="         clobber       -- clean up the whole directory"/>
      <echo message="         run.aop.example -- run aop examples with annoc and aopc pre-compiler"/>
      <echo message="         run.aop.demo  -- run demo gui for aop cache"/>
   </target>

   <!-- set up directory -->
   <target name="init" description="Prepare to build.">
      <!-- Create the time stamp -->
      <tstamp/>
      <!-- Create the build directory structure used by compile and copy the deployment descriptors into it-->
      <mkdir dir="${build}"/>
      <mkdir dir="${reports}"/>
   </target>

   <target name="clean" description="Clean up compiled classes">
      <delete dir="${output}"/>
   </target>

   <target name="clobber" depends="clean"/>

   <!-- compile directory -->
   <target name="compile" depends="init" description="Build unit testing class">
      <javac srcdir="${source}"
             destdir="${build}"
             includes="**/**"
             debug="true"
             deprecation="true">
         <classpath>
            <path refid="lib.classpath"/>
         </classpath>
      </javac>

      <copy todir="${output}/etc">
         <fileset dir="${cache_etc}">
            <include name="**/*"/>
         </fileset>
      </copy>
   </target>

   <target name="run.aop.example" depends="compile, aopc" description="run standalone server replicator.">
      <java classname="test.examples.StudentMaintTest" fork="yes">
         <classpath refid="lib.classpath"/>
         <classpath path="${build}"/>
         <classpath path="${output}/etc"/>
      </java>
   </target>

   <target name="run.aop.demo" depends="compile" description="run tree cache demo.">
      <java classname="org.jboss.cache.aop.TreeCacheAopView" fork="yes">
         <jvmarg value="-Xmx128M"/>
         <classpath refid="lib.classpath"/>
         <sysproperty key="log4j.configuration" value="file:${output}/etc/log4j.xml"/>
         <classpath path="${output}/etc"/>
         <classpath path="${build}"/>
      </java>
   </target>


</project>
