<?xml version="1.0" encoding="UTF-8"?>
<project name="AntShell" default="instrument">
    <property file="jsp-compile.props"/>
    <available file="${install.root}" property="install.root.exists"/>
    <echo message="Picked up install root - ${install.root}"/>
    <target name="verify.setup" unless="install.root.exists">
        <fail message="No Dekoh installation at: ${install.root}. 
        Provide path to Dekoh installation by editing file: ${basedir}/compile.props 
        "/>
    </target>
    <taskdef classname="com.pramati.tools.ant.AntTaskHandlerJSPCompiler" name="jspc" onerror="report">
        <classpath id="jspc.classpath">
            <pathelement path="${dekoh.classes}"/>
        </classpath>
    </taskdef>
    <taskdef classname="com.pramati.tools.ant.AntTaskHandlerInstrument" name="instrument" onerror="report">
        <classpath id="instrument.classpath">
            <pathelement path="${dekoh.classes}"/>
        </classpath>
    </taskdef>
   <target name="translate" depends="verify.setup">
        <jspc appRoot="${SERVLET_ROOT}" validateXML="true"
              targetWebXmlPath="${web.xml.file}" includes="${includes.jsp.list}" excludes="${exclude.jsp.list}" actualWebXmlPath="${web.xml.file}"
              outputDir="${SERVLET_ROOT}/WEB-INF/jsp_src">
            <classpath>
                <pathelement path="${project.class.path}"/>
            </classpath>
        </jspc>
    </target>
    <target name="compile" depends="translate">
        <mkdir dir="${SERVLET_ROOT}/WEB-INF/classes"/>
        <mkdir dir="${SERVLET_ROOT}/WEB-INF/lib"/>
        <javac destdir="${SERVLET_ROOT}/WEB-INF/classes" optimize="off" debug="on" failonerror="false"
               srcdir="${SERVLET_ROOT}/WEB-INF/jsp_src" memoryinitialsize="256m" memorymaximumsize="512m" fork="yes">
            <classpath>
                <pathelement path="${project.class.path}"/>
            </classpath>
        </javac>
    </target>
    <target name="instrument" depends="compile">
        <instrument srcDir="${SERVLET_ROOT}/WEB-INF/jsp_src" classDir="${SERVLET_ROOT}/WEB-INF/classes"/>
    </target>
</project>

