<!--
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
-->
<project name="Geocoder Emulator" default="all" basedir=".">

    <property file="build.properties"/>
    <property name="src.dir" value="src"/>
    <property name="build.dir" value="build"/>
    <property name="build.web.dir" value="${build.dir}/web"/>
    <property name="build.classes.dir" value="${build.web.dir}/WEB-INF/classes"/>
    <property name="build.metainf.dir" value="${build.web.dir}/META-INF"/>
    <property name="dist.dir" value="dist"/>
    <property name="dist.war" value="${dist.dir}/${war.name}"/>
    <property name="web.docbase.dir" value="web"/>

    <path id="class.path">
        <fileset dir="${servlet.lib.path}" includes="*.jar"/>
    </path>

    <target name="init">
        <mkdir dir="${build.metainf.dir}"/>
        <mkdir dir="${build.classes.dir}"/>
        <mkdir dir="${build.web.dir}"/>
    </target>

    <target name="compile" depends="init" description="Compiling all source files">
        <javac srcdir="${src.dir}"
            deprecation="on" destdir="${build.classes.dir}">
            <classpath refid="class.path"/>
        </javac>
		<copy todir="${build.web.dir}">
		    <fileset dir="${web.docbase.dir}"/>
        </copy>
		<copy todir="${build.web.dir}/WEB-INF">
		    <fileset dir="${web.docbase.dir}/WEB-INF"/>
        </copy>
    </target>

    <target name="clean" description="cleanup module">
      <delete>
        <fileset dir="${build.dir}" includes="**/*"/>
      </delete>
	  <delete dir="{$dist.dir}"/>
	  <delete dir="{$build.web.dir}"/>
    </target>

    <target name="all" depends="compile"
        description="Creates web aplication war file">
		<mkdir dir="${dist.dir}"/>
        <jar jarfile="${dist.war}" manifest="${build.metainf.dir}/MANIFEST.MF">
            <fileset dir="${build.web.dir}"/>
        </jar>
    </target>

</project>
