<?xml  version="1.0" ?>
<project name="BJLIB" default="jar" basedir=".">
	<!-- Directory structure -->
	<property name="build.dir" location="../build/BJLIB"/>
        <property name="test.dir" location="../buildtest/BJLIB"/>
	<property name="dist.dir" location="../dist"/>
	<property name="src.dir" location="src/main/java"/>
        <property name="resources.dir" location="src/main/resources"/>
        <property name="test.src.dir" location="src/test/java"/>
        <property name="test.resources.dir" location="src/test/resources"/>
	<property name="lib.dir" location="/usr/share/java"/>
        <property name="docs.dir" location="../javadoc"/>
	<property name="docs.lib.dir" location="../doc/BJLIB"/>
	<property name="class.dir" location="${build.dir}/classes"/>
        <property name="test.class.dir" location="${test.dir}/classes"/>
	
	<property name="project.name" value="biojava"/>
	<property name="debug" value="true"/>
	<property name="optimized" value="true"/>
	<property name="project.version" value="1.8.2"/>
	<property environment="env"/>
	<property name="project.jarfile.name" value="BJLIB.jar"/>	
	
	<property name="class.path" value="${lib.dir}/commons-cli.jar ${lib.dir}/commons-collections.jar ${lib.dir}/commons-dbcp.jar ${lib.dir}/junit4.jar ${lib.dir}/commons-pool.jar ${lib.dir}/guava.jar ${lib.dir}/jgrapht0.8.jar ${lib.dir}/Jmol.jar /usr/share/icedtea-web/netx.jar ${lib.dir}/hamcrest.jar ${lib.dir}/json_simple.jar"/>
								
	<path id="compile.classpath">
                        <fileset dir="${lib.dir}">
				<include name="commons-cli.jar"/>
				<include name="commons-collections.jar"/>
				<include name="commons-dbcp.jar"/>
				<include name="commons-pool.jar"/>
				<include name="junit4.jar"/>
				<include name="guava.jar"/>
				<include name="jgrapht0.8.jar"/>
				<include name="Jmol.jar"/>
				<include name="hamcrest.jar"/>
				<include name="json_simple.jar"/>
			</fileset>
			<fileset dir="${dist.dir}">
				<include name="*.jar"/>
			</fileset>
                        <fileset dir="/usr/share/icedtea-web">
                                <include name="netx.jar"/>
                        </fileset>
	</path>
	
	
	<target name="clean">
		<echo level="info">Cleaning build directories</echo>
		<delete verbose="true" includeEmptyDirs="true">
			<fileset dir="${build.dir}" includes="**"/>
			<fileset dir="${dist.dir}" includes="${project.name}*.jar"/>
		</delete>
	</target>
	
	<target name="javadocs">
                <mkdir dir="${docs.dir}"/>
		<mkdir dir="${docs.lib.dir}"/>
		<javadoc destdir="${docs.lib.dir}" sourcepath="${src.dir}" packagenames="org.*">
			<link href="http://java.sun.com/j2se/1.6.0/docs/api/"/>
		</javadoc>
	</target>
	
	<target name="compile">
		<mkdir dir="${class.dir}"/>
		<mkdir dir="${dist.dir}"/>
		<javac srcdir="${src.dir}" destdir="${class.dir}" classpathref="compile.classpath" debug="${debug}" optimize="${optimized}" nowarn="true" source="1.6" target="1.6">
		</javac>
                <copy todir="${class.dir}" failonerror="false">
                  <fileset dir="${resources.dir}"/>
                </copy>
	</target>

        <target name="compile-test">
                <mkdir dir="${test.class.dir}"/>
                <javac srcdir="${test.src.dir}" destdir="${test.class.dir}" classpathref="compile.classpath" debug="${debug}" optimize="${optimized}" nowarn="true">
                </javac>
                <copy todir="${test.class.dir}" failonerror="false">
                  <fileset dir="${test.resources.dir}"/>
                </copy>
                <copy todir="${test.class.dir}" failonerror="false">
                  <fileset dir="${src.dir}"/>
                </copy>
        </target>

  <path id="test.classpath">
     <path refid="compile.classpath"/>
     <pathelement location="${test.class.dir}" />
  </path>

  <target name="test" depends="compile-test">
    <junit haltonfailure="yes" printsummary="yes">
      <classpath refid="test.classpath"/>
      <formatter type="plain" usefile="false" />
      <batchtest>
        <fileset dir="${test.class.dir}" includes="**/*Test.class" excludes="**/Abstract*.class" />
      </batchtest>
    </junit>
  </target>
	
	<target name="jar" depends="compile">
		<jar destfile="${dist.dir}/${project.jarfile.name}"  basedir="${class.dir}" >
		 <manifest>
		    <attribute name="Built-By" value="Debian-Med team"/>
	            <attribute name="Class-Path" value="${class.path}"/>
		      <attribute name="Specification-Title" value="BioJava"/>
		      <attribute name="Specification-Version" value="${project.version}"/>
		  </manifest>
		</jar>
	</target>
	
</project>

