<?xml version="1.0"?>
<project name="COW" default="tomcat_dist" basedir=".">
    
  <description>
    The ant build file for project COW
    (doCOWl)
  </description>
    
  <property name="bin" location="bin"/>
  <property name="conf" location="conf"/>
  <property name="lib" location="lib"/>
  <property name="src" location="src"/>
  <property name="html" location="html"/>
  <property name="build" location="build"/>
  <property name="tomcatConf" location="tomcatConf"/>
  <property name="tomcat_dist" location="tomcatDist"/>
  <property name="tomcat_conf" location="${tomcat_dist}/conf"/>
  <property name="tomcat_lib" location="${tomcat_dist}/lib"/>
  <property name="tomcat_log" location="${tomcat_dist}/log"/>
  <property name="tomcat_cow" location="${tomcat_dist}/cow"/>
  <property name="tomcat_cow_WEB-INF" 
	    location="${tomcat_cow}/WEB-INF"/>
    
  <path id="lib">
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>
    
  <target name="init">
    <tstamp/>
    <mkdir dir="${build}"/>
  </target>
  
  <target name="compile" depends="init"
	  description="Compile the code and make archives.">
    <!-- compile to /build -->
    <javac srcdir="${src}" destdir="${build}">
      <classpath refid="lib"/>
    </javac>
  </target>
        
  <target name="tomcat_dist" depends="compile"
	  description="generate distribution for use in tomcat">
    
    <!-- copy the .class files -->
    <copy todir="${tomcat_cow_WEB-INF}/classes">
      <fileset dir="${build}"/>
    </copy>
    
    <!-- copy welcome file -->
    <copy file="${html}/index.html" todir="${tomcat_cow}"/>
    
    <!-- copy web.xml -->
    <copy file="${tomcatConf}/web.xml" todir="${tomcat_cow_WEB-INF}"/>
    
    <!-- copy the .jar files -->
    <copy todir="${tomcat_cow_WEB-INF}/lib">
      <fileset dir="${lib}/jena2.1"/>
    </copy>
    <copy todir="${tomcat_cow_WEB-INF}/lib">
      <fileset dir="${lib}/tomcatServlet"/>
    </copy>
    
    <!-- copy the .xsl files -->
    <copy todir="${tomcat_cow_WEB-INF}/bin">
      <fileset dir="${bin}"/>
    </copy>
    
    <!-- copy additional resources -->
    <copy file="${conf}/logger.properties" 
	  todir="${tomcat_cow_WEB-INF}/conf"/>
  </target>
  
  <target name="clean"
	  description="clean up">
    <delete dir="${build}"/>
    <delete dir="${tomcat_dist}"/>
  </target>
        
</project>
