<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
 * 
 * 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="jpropex" default="main" basedir=".">

    <!-- ================================================================= -->
    <!-- settings                                                          -->
    <!-- ================================================================= -->

    <!-- name of this sub target used in recursive builds -->
    <property name="target" value="jpropex"/>

    <!-- name of jar file created, without .jar extension -->
    <property name="jarname" value="jpropex"/>

    <!-- relative path to project directory -->
    <property name="prj" value="."/>

    <!-- build output directory -->
    <property name="out" value="build"/>

    <!-- build directories -->
    <property name="build.dir" value="${out}"/>
    <property name="build.class" value="${build.dir}/class/jpropex"/>
    <property name="build.misc"  value="${build.dir}/misc/jpropex"/>

    <!-- start of java source code package structure -->
    <property name="java.dir" value="java"/>

    <!-- define how to handle CLASSPATH environment -->
    <property name="build.sysclasspath" value="ignore"/>

    <!-- classpath settings for compile and javadoc tasks -->
    <path id="classpath">
        <pathelement location="."/>
        <pathelement location="${build.class}"/>
    </path>

    <!-- name to display in documentation -->
    <!--    <property name="docname" value="l10n converter"/> -->

    <!-- set "modern" java compiler -->
    <property name="build.compiler" value="modern"/>

    <!-- set wether we want to compile with debug information -->
    <property name="debug" value="on"/>

    <!-- set wether we want to compile with optimisation -->
    <property name="optimize" value="off"/>

    <!-- set wether we want to compile with or without deprecation -->
    <property name="deprecation" value="on"/>

    <target name="info">
        <echo message="--------------------"/>
        <echo message="${target}"/>
        <echo message="--------------------"/>
    </target>

    <!-- ================================================================= -->
    <!-- custom targets                                                    -->
    <!-- ================================================================= -->

    <!-- the main target, called in recursive builds -->
    <target name="main" depends="info,prepare,compile,jar"/>

    <!-- prepare output directories -->
    <target name="prepare">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.class}"/>
        <mkdir dir="${build.misc}"/>
    </target>


    <target name="res" depends="prepare">
        <copy todir="${build.class}">
             <fileset dir="${java.dir}">
                 <include name="**/*.properties"/>
                 <include name="**/*.css"/>
                 <include name="**/*.dtd"/>
                 <include name="**/*.form"/>
                 <include name="**/*.gif "/>
                 <include name="**/*.htm"/>
                 <include name="**/*.html"/>
                 <include name="**/*.js"/>
                 <include name="**/*.mod"/>
                 <include name="**/*.sql"/>
                 <include name="**/*.xml"/>
                 <include name="**/*.xsl"/>
                 <include name="**/*.map"/>

             </fileset>
	    </copy>
    </target>


    <target name="compile" depends="prepare,res">
	<javac destdir="${build.class}"
	       debug="${debug}"
               deprecation="${deprication}"
	       optimize="${optimize}"
	       classpathref="classpath">
            <src path="${java.dir}"/>
	    <include name="**/*.java"/>
	</javac>
    </target>

    <!-- clean up -->
    <target name="clean" depends="prepare">
        <delete includeEmptyDirs="true">
            <fileset dir="${build.class}">
                <patternset>
                    <include name="${package}/**/*.class"/>
                </patternset>
            </fileset>
        </delete>
    </target>

    <!-- create jar file -->
    <target name="jar" depends="prepare,compile" if="build.class">
        <jar jarfile="${build.class}/${jarname}.jar"
             basedir="${build.class}"
             manifest="${jarname}.MF">
                 <include name="**/*.class"/>
                 <include name="**/*.properties"/>
                 <include name="**/*.css"/>
                 <include name="**/*.dtd"/>
                 <include name="**/*.form"/>
                 <include name="**/*.gif "/>
                 <include name="**/*.htm"/>
                 <include name="**/*.html"/>
                 <include name="**/*.js"/>
                 <include name="**/*.mod"/>
                 <include name="**/*.sql"/>
                 <include name="**/*.xml"/>
                 <include name="**/*.xsl"/>
                 <include name="**/*.map"/>
        </jar>
    </target>

    <target name="test" depends="prepare">
    </target>

</project>

