<?xml version="1.0"?>
<project name="Struts" default="compile" basedir=".">

<!-- ===================================== -->
<!--     Global properties                 -->
<!-- ===================================== -->
	<taskdef name="crypto" classname="com.tom.ant.Crypto" />

	<property name="name" value="aag" />
	<property name="build" value="${basedir}/build" />
	<property name="dist" value="${basedir}/dist" />
	<property name="source" value="${basedir}/source" />
	<property name="docs" value="${basedir}/docs" />
	<property name="api" value="${docs}/api" />
	<property name="tomcat" value="/jakarta-tomcat-4.0.1/webapps/aag/WEB-INF/lib" />
	<property name="ftp" value="/jakarta-tomcat-4.0.1/webapps/aag/ftp" />

<!-- ===================================== -->
<!--     Init                              -->
<!-- ===================================== -->
	<target name="init" >
		<tstamp />
		<mkdir dir="${build}" />
		<mkdir dir="${api}" />
		<mkdir dir="${dist}" />
	</target>

<!-- ===================================== -->
<!--     Compile                           -->
<!-- ===================================== -->
	<target name="compile" depends="init" >
		<javac srcdir="${source}" destdir="${build}" />
	</target>

<!-- ===================================== -->
<!--     JavaDoc                           -->
<!-- ===================================== -->
	<target name="javadoc" depends="compile" >
		<javadoc sourcepath="${source}" destdir="${api}"
			packagenames="com.aag.*"/>
	</target>

<!-- ===================================== -->
<!--     Jar and Copy                      -->
<!-- ===================================== -->
	<target name="jar" depends="javadoc" >
		<jar jarfile="${dist}/${name}.jar" >
			<fileset dir="${build}" />
			<fileset dir="${docs}" />
		</jar>
		<copy todir="${tomcat}" file="${dist}/${name}.jar" />
	</target>

<!-- ===================================== -->
<!--     Encrypt                           -->
<!-- ===================================== -->
	<target name="encrypt" depends="jar">
		<crypto keyFile="key.ser"
				inputFile="${dist}/${name}.jar"
				outputFile="${dist}/${name}.secret.jar" />
		<copy todir="${ftp}" file="${dist}/${name}secret.jar" />
	</target>

<!-- ===================================== -->
<!--     Remove build directories          -->
<!-- ===================================== -->
	<target name="clean" >
		<delete dir="${build}" />
		<delete dir="${docs}" />
		<delete dir="${dist}" />
	</target>

</project>