<project name="AppBuilder" default="war" basedir="..">
	<property file="ant/build.properties"/>
<!--
Tasks to be done
1. clean
2. init
3. compile
4. copy
5. war
 -->
	<path id="classpath">
		<fileset dir="${lib.dir}" includes="servlet-api.jar"/>
	</path>
	<target name="clean">
		<echo>Cleaning the ${build.dir} and ${dist.dir}</echo>
		<delete dir="${build.dir}"/>
		<delete dir="${dist.dir}"/>
	</target>
	<target name="init" depends="clean">
		<echo>Creating the required directories</echo>
		<mkdir dir="${dist.dir}"/>
		<mkdir dir="${build.dir}\WEB-INF\classes"/>		
		<mkdir dir="${build.dir}\WEB-INF\lib"/>
	</target>

	<target name="compile" depends="init">
		<echo>Compile the source files</echo>
		<javac srcdir="${src.dir}" destdir="${build.dir}\WEB-INF\classes">
			<classpath refid="classpath"/>
		</javac>
	</target>	
	
	<target name="copy" depends="compile">
		<copy todir="${build.dir}\WEB-INF">
			<fileset dir="${conf.dir}"/>			
		</copy>		
		<copy todir="${build.dir}">
			<fileset dir="${web.content}"/>
		</copy>
		<copy todir="${build.dir}\WEB-INF\lib">
			<fileset dir="${lib.dir}"/>
		</copy>

	</target>		

	<target name="war" depends="copy">
		<echo>Building the war file</echo>
		<war destfile="${dist.dir}\${project.name}.war" webxml="${build.dir}\WEB-INF\web.xml">
			<fileset dir="${build.dir}"/>
		</war>
	</target>

</project>