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