<project default="release" name="alphabet">

	<!-- axis2 -->

	<property name="axis2.home" location="C:/opt/axis2-1.1.1/axis2-1.1.1" />

	<path id="axis2.classpath">
		<fileset dir="${axis2.home}/lib">
			<include name="*.jar" />
		</fileset>
	</path>

	<taskdef name="axis2-wsdl2java" classname="org.apache.axis2.tool.ant.AntCodegenTask">
		<classpath refid="axis2.classpath" />
	</taskdef>

	<!-- log4j -->

	<property name="log4j.home" location="C:/opt/log4j-1.2.14/logging-log4j-1.2.14" />

	<path id="log4j.classpath">
		<fileset dir="${log4j.home}/dist/lib">
			<include name="**/*.jar" />
		</fileset>
	</path>

	<!-- junit -->

	<property name="junit.home" location="C:/opt/junit-4.1/junit4.1" />

	<path id="junit.classpath">
		<fileset dir="${junit.home}">
			<include name="junit-4.1.jar" />
		</fileset>
	</path>

	<!-- internal locations -->

	<property name="src.dir" location="src" />

	<property name="src-test.dir" location="test" />

	<property name="build.dir" location="build/classes" />

	<property name="build-test.dir" location="build/classes-test" />

	<property name="jar.file" location="alphabet.jar" />

	<!-- targets -->

	<target name="release" depends="archive">

		<echo message="success" />
	</target>

	<target name="archive" depends="test">

		<delete file="${jar.file}" />

		<jar destfile="${jar.file}">

			<fileset dir="${build.dir}">
				<include name="**/*.class" />
			</fileset>

			<fileset dir="${src.dir}">
				<include name="**/*.java" />
				<include name="**/*.properties" />
				<include name="**/*.xml" />
			</fileset>

		</jar>

	</target>

	<target name="test" depends="build">

		<delete dir="${build-test.dir}" />
		<mkdir dir="${build-test.dir}" />

		<javac destdir="${build.dir}" debug="true">

			<src>
				<pathelement path="${src-test.dir}" />
			</src>

			<classpath path="${build.dir}" />
			<classpath refid="log4j.classpath" />
			<classpath refid="junit.classpath" />

		</javac>

		<junit fork="yes" haltonfailure="yes">

			<test name="org.jjcarr.AllTests" />
			<formatter type="plain" usefile="false" />

			<classpath path="${build.dir}" />
			<classpath path="${build-test.dir}" />
			<classpath refid="log4j.classpath" />
			<classpath refid="junit.classpath" />

		</junit>

	</target>

	<target name="build">

		<delete dir="${build.dir}" />
		<mkdir dir="${build.dir}" />

		<javac debug="true" destdir="${build.dir}">

			<src>
				<pathelement path="${src.dir}" />
			</src>

			<classpath refid="log4j.classpath" />
			<classpath refid="junit.classpath" />

		</javac>

	</target>

</project>
