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

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

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

     project1-8.0/
       docs/
         cscie259/
           project1/
             mf/
       meta/
       samples/
         xml/
       src/
         cscie259/
           project1/
             mf/

     To compile the code explored in questions 11 through 21,
     execute `ant compile-Tester` from within project1-8.0/.

     To compile the code explored in question 22, execute
     `ant compile-AttributeConverter` from within project1-8.0/.

     To compile both simultaneously, execute `ant compile` or `ant`
     from within project1-8.0/.

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

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

     To delete your build/ directory along with its contents,
     execute `ant clean` from within project1-8.0/.
============================================================================ -->

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

    <description>Project 1</description>

    <!-- set global properties for this build -->
    <property name="build" location="build"/>
    <property name="docs" location="docs"/>
    <property name="meta" location="meta"/>
    <property name="src" location="src"/>

    <!-- 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-Tester -->
    <target name="compile-Tester"
            depends="init"
            description="compile cscie259.project1.mf.*">
        <javac srcdir="${src}"
               debug="true"
               destdir="${build}"
               fork="true"
               includes="cscie259/project1/mf/*.java"
               listfiles="true"/>
    </target>

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

    <!-- compile -->
    <target name="compile"
            depends="compile-Tester,compile-AttributeConverter"
            description="compile everything"/>

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

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

    <!-- clean -->
    <target name="clean"
            description="remove build directory">
        <delete dir="${build}"/>
    </target>

</project>

