<?xml version="1.0" encoding="UTF-8"?>

<project name="userconfig" default="dist" basedir=".">
    <property file="build.properties"/>

    <property name="src"      value="src"/>
    <property name="build"    value="build"/>
    <property name="dist"     value="dist"/>
    <property name="jar"      value="${dist}/${ant.project.name}.jar"/>

    <property name="catalina.home" value="/usr/share/tomcat"/>

    <property name="catalina.jar" value="${catalina.home}/lib/catalina.jar"/>
    <property name="tomcat-juli.jar" value="${catalina.home}/bin/tomcat-juli.jar"/>

    <path id="compile.classpath">
        <pathelement location="${catalina.jar}"/>
        <pathelement location="${tomcat-juli.jar}"/>
    </path>

    <target name="init">
        <tstamp/>
        <mkdir dir="${build}"/>
    </target>

    <target name="compile" depends="init">
        <javac srcdir="${src}" destdir="${build}"
               source="1.5" target="1.5"
               deprecation="on" optimize="on" debug="on">
            <compilerarg value="-Xlint:unchecked"/>
            <classpath refid="compile.classpath"/>
        </javac>
    </target>

    <target name="dist" depends="compile">
        <jar jarfile="${jar}">
            <fileset dir="${build}" includes="**/*.class"/>
        </jar>
    </target>

    <target name="package" depends="dist">
        <tar destfile="${ant.project.name}-${DSTAMP}.tar.gz"
             compression="gzip">
            <tarfileset dir="${basedir}"
                        prefix="${ant.project.name}-${DSTAMP}">
                <exclude name="${build}/**"/>
                <exclude name="build.properties"/>
                <exclude name="nbproject/**"/>
                <exclude name="*.tar.gz"/>
                <exclude name=".*/**"/>
                <exclude name=".*"/>
            </tarfileset>
        </tar>
    </target>

    <target name="clean">
        <delete>
            <fileset dir="${build}" includes="**/*.class"/>
        </delete>
        <delete file="${jar}"/>
    </target>
</project>