<!-- Group 2, build.xml for ScheduleV1 -->
<!-- Author: Charley Ruggiero -->
<!-- Last Modified: 4-10-06 -->


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

  <property file="global.properties" />

  <property name="model" location="classes" /> 
  
<path id="servlet-classpath">
    <fileset dir="${tomcat.dir}/common/lib">
        <include name="*.jar" />
    </fileset>
    <fileset dir="${tomcat.dir}/common/endorsed">
        <include name="*.jar" />
    </fileset>
</path>

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

<!-- ******************************TEST****************************** -->
<target name="test" >
  <junit printsummary="yes" haltonfailure="no">

    <classpath>
      <pathelement location="${build}" />
    </classpath>

    <test name="com.example.test.AllTests" />

  </junit>
</target>

<!-- ****************************COMPILE**************************** -->
<target name="compile" depends="clean">
    <echo message="Compiling servlet!"/>
    <javac srcdir="${src}" destdir="${build}"
           includes="com/example/model/**,com/example/web/**,com/example/test/**">
           <classpath refid="servlet-classpath" /> 
           <classpath refid="junit-classpath" />
    </javac>
</target>

<!-- ****************************CLEAN****************************** -->
<target name="clean">

  <echo message="Deleting and remaking the build and dist directories." />
  <delete dir="${build}" /> 
  <mkdir dir="${build}" /> 

  <delete dir="${dist}" /> 
  <mkdir dir="${dist}" /> 

  <delete dir="${docs}" /> 
  <mkdir dir="${docs}" /> 

</target>

<!-- ****************************CREATE WAR************************* -->
<target name="create-war" description="creates war file" depends="compile">
  <echo message="Creating ${web-app-name}.war" />

  <war destfile="${dist}/${web-app-name}.war" 
       webxml="${etc}/web.xml">
       <classes dir="${build}" />
       <fileset dir="${web}" />
  </war>
</target>

<!-- ****************************DEPLOY WAR************************* -->
<target name="deploywar" description="deploys war file" depends="compile, create-war">
  <echo message="Deploying ${web-app-name}.war" />

  <delete dir="${war.destination}${web-app-name}">
    <fileset dir="${war.destination}">
      <include name="${web-app-name}.war"></include>
    </fileset>
  </delete>

  <copy todir="${war.destination}">
    <fileset dir="${dist}">
      <include name="${web-app-name}.war"></include>
    </fileset>
  </copy>

</target>

<!-- ****************************CREATE JAVADOC********************* -->
<target name="javadoc" depends="clean">
  <javadoc packagenames="com.example.model.*,com.example.web.*" sourcepath="${src}" 
           destdir="${docs}" author="true"
           version="true" use="true" windowtitle="ScheduleV1 Docs">
     <classpath refid="servlet-classpath" /> 
     <classpath refid="junit-classpath" />
  </javadoc>
</target>  


</project>
