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

<!-- ==========================================================================
     Buildfile for Project 3, version 8.0
     Computer Science E-259

     This buildfile "shipped" in the root of the following hierarchy.

     project3-8.0/
       conf/
       src/
        cscie259/
          project3/
            wahoo/
       temp/
       webapps/
         ROOT/
           docs/
             cscie259/
               project3/
                 wahoo/
           dtd/
           images/
           WEB-INF/
           xml/
             cache/
           xsl/
    
     To compile Wahoo, execute `ant compile` or `ant` from within
     project3-8.0/.

     To generate Javadoc for your code (in project3-8.0/webapps/ROOT/docs/),
     execute `ant javadoc` from within project3-8.0/.

     To publish Javadoc for your code at
     http://www.people.fas.harvard.edu/~username/cscie259/javadoc/project3-8.0/,
     where username is your FAS username, execute `ant publish-javadoc` 
     from within project3-8.0/.

     To delete your bytecodes as well as Tomcat's logs and runtime
     directories, execute `ant clean` from within project3-8.0/.
============================================================================ -->

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

    <description>Project 3</description>
 
    <!-- set global properties for this build -->
    <property name="build" location="webapps/ROOT/WEB-INF/classes"/>
    <property name="conf" location="conf"/>
    <property name="docs" location="webapps/ROOT/docs"/>
    <property name="logs" location="logs"/>
    <property name="src" location="src"/>
    <property name="temp" location="temp"/>
    <property name="work" location="work"/>

    <!-- init -->
    <target name="init">

        <!-- set the standard DSTAMP, TSTAMP, and TODAY properties -->
        <!-- according to the default formats                      -->
        <tstamp/>

        <!-- Create the build directory structure used by compile -->
        <mkdir dir="${build}"/>

    </target>

    <!-- compile -->
    <target name="compile" 
            depends="init" 
            description="compile cscie259.project3.wahoo.*">
        <javac srcdir="${src}"
               destdir="${build}" 
               debug="true" 
               fork="true"
               includes="cscie259/project3/wahoo/*"
               listfiles="true"/>
    </target>

    <!-- javadoc -->
    <target name="javadoc" 
            description="generate Javadoc">
        <delete includeemptydirs="true">
            <fileset dir="${docs}" includes="**/*"/>
        </delete>
        <javadoc packagenames="cscie259.project3.*"
                 sourcepath="${src}"
                 destdir="${docs}"
                 author="true"
                 version="true"
                 private="true"
                 nodeprecated="true"
                 windowtitle="Project 3"
                 header="Project 3"/>
    </target>

     <!-- publish javadoc -->
     <target name="publish-javadoc"
             depends="javadoc"
             description="publish Javadoc">
         <copy todir="${user.home}/public_html/cscie259/javadoc/project3-8.0">
              <fileset dir="${docs}"/>
         </copy>
         <chmod parallel="false" 
                perm="a+rX" 
                dir="${user.home}/public_html/cscie259"
                includes="**/*" 
                type="both"/>
     </target> 

    <!-- clean -->
    <target name="clean" 
            description="remove class, log, temp, and work files">
        <delete dir="${build}"/>
        <delete dir="${conf}/Catalina"/>
        <delete dir="${logs}"/>
        <delete includeemptydirs="true">
            <fileset dir="${temp}" includes="**/*"/>
        </delete>
        <delete dir="${work}"/>
    </target>

</project>

