<project name="neustore" xmlns:ivy="antlib:org.apache.ivy.ant" default="jar">
  <description>
    Ant build file for the neustore project.
    Created by Joshua Serrin for CSG130 Fall2008 Northeastern University
  </description>

	<!-- set default properties -->
	<dirname property="this_basedir" file="${ant.file.base}"/>
	<property name="src" location="neustore"/>
	<property name="test_src" location="test"/>
	<!-- tells ivy where to put lib files !-->
  <property name="javadoc_dir" location="doc"/>
	<property name="build" location="target/classes"/>
	<property name="test" location="target/test_classes"/>
	
	<target name="init">
		<tstamp/>
		<mkdir dir="${build}"/>
		<mkdir dir="${test}"/>
		<mkdir dir="${javadoc_dir}"/>
	</target>
	
	<macrodef name="do-javac">
		<attribute name="srcdir" />
		<attribute name="targetdir" />
		<sequential>    
      <mkdir dir="@{targetdir}" />
	    <javac debug="true"
	           debuglevel="lines,vars,source"
	           deprecation="true"
	           destdir="@{targetdir}"
	           source="1.5" target="1.5" fork="true">
	      <src path="@{srcdir}"/>
	    </javac>
		</sequential>
	</macrodef>

	<target name="test_compile" depends="compile">
		<do-javac srcdir="${test_src}" targetdir="${test}"/>
	</target>
	
	<target name="compile" depends="init" description="compile the source">
    <do-javac srcdir="${src}" targetdir="${build}"/>
	</target>
	
	<target name="javadoc" depends="init" description="Generate JavaDoc HTML pages">
		<javadoc sourcepath="${src}" classpathref="base.path" packagenames="*"
			destdir="${javadoc_dir}" author="true" use="true" verbose="false"
			package="true">
		</javadoc>
	</target>
	
	<target name="jar" depends="init,compile" description="Generate binary and source archives for distribution">		
		<!-- Put compiled classes and resources in ${build} into the [projectname]-[datestamp].jar file -->
		<jar basedir="${build}" jarfile="target/${ant.project.name}-${DSTAMP}.jar"/>
	</target>
	
	<target name="clean" description="clean up">
		<delete dir="target" verbose="true" failonerror="false"/>
	</target>
	
</project>
