<?xml version="1.0"?>

<!-- Chengyu Sun         -->
<!-- csun@calstatela.edu -->

<project name="CS320" default="build" basedir=".">

  <description>Build file for CS320 code samples.</description>

  <property name="tomcat.home" location="/home/tomcat/tomcat"/>
  <property name="src.dir" location="src"/>
  <property name="web.dir" location="web"/>
  <property name="class.dir" location="classes"/>
  <property name="install.dir" location="/home/cs320stu31/www"/>

  <!-- classpath -->
  <path id="project.class.path">
    <pathelement path="${java.class.path}"/>
    <fileset dir="${tomcat.home}">
      <include name="common/lib/**/*.jar"/>
      <include name="shared/lib/**/*.jar"/>
    </fileset>
  </path>

  <!-- please don't copy .*.swp -->
  <defaultexcludes add="**/.*.swp"/>

<!--=========-->
<!-- targets -->
<!--=========-->

  <target name="build" depends="init">
    <javac destdir="${class.dir}" debug="on" deprecation="on">
      <src path="${src.dir}"/>
      <classpath refid="project.class.path"/>
    </javac> 
  </target>

  <target name="init">
    <mkdir dir="${class.dir}"/>
  </target>

  <target name="clean">
    <delete dir="${class.dir}"/>
  </target>

  <target name="install" depends="build">
    <copy todir="${install.dir}/WEB-INF/classes">
      <fileset dir="${class.dir}" includes="**/*"/>
    </copy>
    <copy todir="${install.dir}">
      <fileset dir="${web.dir}" includes="**/*"/>
    </copy>
  </target>

  <target name="uninstall">
    <delete includeemptydirs="true">
      <fileset dir="${install.dir}" includes="**/*" excludes="WEB-INF/**/*"/>
      <fileset dir="${install.dir}" includes="WEB-INF/classes/**/*"/>
    </delete>
  </target>

</project>

