<?xml version="1.0"?>

<!-- build configuration -->
<project name="depends" default="compile" basedir=".">

  <!-- things you may want to change -->
  <property name="build.compiler" value="jikes"/>
  <property name="build.optimize" value="on"/>

  <!-- things you probably don't want to change -->
  <property name="app.name" value="depends"/>
  <property name="copyright.holder" value="Michael Bayne"/>
  <property name="deploy.dir" value="dist"/>
  <property name="dist.jar" value="${app.name}.jar"/>
  <property name="javadoc.dir" value="${deploy.dir}/docs"/>

  <!-- things you definitely don't want to change -->
  <property name="doc.packages" value="com.samskivert.depends.*"/>
  <property name="doc.overview" value="com/samskivert/depends/overview.html"/>
  <property name="src.dir" value="src/java"/>

  <!-- prepares the application directories -->
  <target name="prepare">
    <tstamp><format property="year" pattern="yyyy" /></tstamp>
    <mkdir dir="${deploy.dir}"/>
    <mkdir dir="${deploy.dir}/classes"/>
    <mkdir dir="${javadoc.dir}"/>
    <copy todir="${deploy.dir}/classes">
      <fileset dir="${src.dir}" includes="**/*.properties"/>
    </copy>
  </target>

  <!-- cleans out the installed application -->
  <target name="clean">
    <delete dir="${deploy.dir}"/>
  </target>

  <!-- builds the java class files -->
  <target name="compile" depends="prepare">
    <javac srcdir="${src.dir}" destdir="${deploy.dir}/classes"
           debug="on" optimize="${build.optimize}" deprecation="off">
    </javac>
  </target>

  <!-- builds the javadoc documentation -->
  <target name="javadoc" depends="prepare">
    <javadoc sourcepath="${src.dir}"
             packagenames="${doc.packages}"
             windowtitle="${app.name} API"
             doctitle="${app.name} API"
             overview="${src.dir}/${doc.overview}"
             destdir="${javadoc.dir}"
             additionalparam="-breakiterator">
      <bottom>Copyright &#169; 2000-${year} ${copyright.holder}.
              All Rights Reserved.</bottom>
      <link href="http://java.sun.com/j2se/1.4/docs/api/"/>
    </javadoc>
  </target>

  <!-- builds our distribution files -->
  <target name="dist" depends="prepare,compile">
    <jar destfile="${deploy.dir}/${dist.jar}"
         basedir="${deploy.dir}/classes"/>
  </target>

  <!-- a target for rebuilding everything -->
  <target name="all" depends="clean,prepare,compile,javadoc,dist"/>

</project>
