 <project name="ibertest" default="finish" basedir=".">
	<!-- global properties -->
	<property name="root" value="."/>
	<property name="src" value="src"/>
	<property name="build" value="build"/>
	<property name="files" value="files"/>
	<property name="dist" value="dist"/>
	<property name="lib" value="lib"/>
	<property name="iberagentsext" value="../iberagents/ext"/>
	<property name="log" value="ibertest_build.log"/>
	<property name="jarfile" value="ibertest.jar"/>
	<target name="init" description="Sets up the build system">
		<!-- initiate recording -->
		<record name="${log}" action="start"/>

		<!-- create time stamp -->
		<tstamp/>

		<!-- delete old library, if present -->
		<delete file="${dist}/lib/${jarfile}"/>

		<!-- create build directory -->
		<mkdir dir="${build}"/>

		<!-- create the dist directory for libraries and javadocs -->
		<mkdir dir="${dist}/lib"/>
		<mkdir dir="${dist}/javadoc"/>
	</target>
	<target name="compile" depends="init" description="Compiles the application">
		<!-- compile from src into build -->
		<javac srcdir="${src}" destdir="${build}">
			<classpath id="project.class.path">
				<pathElement path="${build}"/>
				<pathelement location="${lib}/iberagents.jar"/>
				<pathelement location="${lib}/iberxml.jar"/>
			</classpath>
		</javac>
	</target>
	<target name="jar" depends="compile" description="Jars class files and xsl's">
		<!-- put all classes and files into the jar -->
		<jar jarfile="${dist}/lib/${jarfile}" basedir="${build}">
			<fileset dir="${files}">
				<include name="*.xsl"/>
				<include name="configuration.xml"/>
			</fileset>
			<fileset dir="${root}">
				<include name="LICENSE"/>
			</fileset>
		</jar>
	</target>
	<target name="dist" depends="jar" description="Builds the distribution">
		<!-- copy the result to iberagents -->
		<copy file="${dist}/lib/${jarfile}" tofile="${iberagentsext}/${jarfile}"/>
	</target>
	<target name="finish" depends="dist" description="Closes pending tasks">
		<!-- stop recording -->
		<record name="${log}" action="stop"/>
	</target>
	<target name="clean" description="Clean up all directories">
		<!-- delete the build and dist directories -->
		<delete dir="${build}"/>
		<delete dir="${dist}"/>
	</target>
</project>
