<project name="FigTreeApplet" default="dist" basedir=".">
	<description>
		Build file for FigTreeApplet
		$Id:$
	</description>

	<!-- set global properties for this build -->
	<property name="src" location="src"/>
	<property name="build" location="build"/>

	<property name="lib" location="lib"/>
	<property name="dist" location="dist"/>

	<property environment="env"/>

	<target name="clean">
		<mkdir dir="${build}"/>
		<delete includeEmptyDirs="true">
			<fileset dir="${build}" includes="**/*"/>
		</delete>

	</target>

	<target name="init">
		<!-- Create the time stamp -->
		<tstamp/>
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${build}"/>
		<mkdir dir="${dist}"/>
		<mkdir dir="${lib}"/>
	</target>


	<target name="compile" depends="init">
		<!-- Compile the java code from ${src} into ${build} -->
		<javac source="1.5" target="1.5" srcdir="${src}/figtree" destdir="${build}"
		       classpath="${lib}/jebl.jar:${lib}/jam.jar:${lib}/freehep.jar:${lib}/iText.jar:${lib}/quaqua.jar:${lib}/jdom.jar"/>
		<copy todir="${build}" verbose="true">
			<fileset dir="${src}" includes="figtree/**/*.png,figtree/**/*.gif"/>
		</copy>
	</target>

	<target name="dist" depends="compile" description="generate the distribution">
		<!-- Create the distribution directory -->
		<mkdir dir="${dist}"/>

		<jar jarfile="${dist}/figtreeapplet.jar">
			<fileset dir="${build}"
			         includes="figtree/**/*.class,**/*.properties,**/*.png,**/*.gif"
				/>
			<fileset dir="../JEBL/build"
			         includes="**/*.class,**/*.properties,**/*.png,**/*.gif"
				excludes="jebl/gui/**,
				jebl/evolution/align/**,
				jebl/evolution/aligners/**,
				jebl/evolution/alignments/**,
				jebl/evolution/characterReconstruction/**,
				jebl/evolution/characters/**,
				jebl/evolution/coalescent/**,
				jebl/evolution/parsimony/**,
				jebl/evolution/sequences/**,
				jebl/evolution/substmodel/**,
				jebl/evolution/treesimulation/**"/>

			<manifest>
				<attribute name="Built-By" value="${user.name}"/>
			</manifest>
		</jar>

	</target>

    <target name="dist_panel" depends="compile" description="generate the distribution">
        <!-- Create the distribution directory -->
        <mkdir dir="${dist}"/>

        <jar jarfile="${dist}/figtreepanel.jar">
            <fileset dir="${build}"
                     includes="figtree/panel/**/*.class,figtree/treeviewer/**/*.class,**/*.properties,**/*.png,**/*.gif"
                />

            <manifest>
                <attribute name="Built-By" value="${user.name}"/>
            </manifest>
        </jar>

    </target>
</project>
