<!--
	Ant build file for BeanShell
	http://www.beanshell.org/

	Uses Ant 1.6
	http://www.apache.org/

	Ant issues - 

		- Why can't I nest filesets?  This seems like it would be so easy and
		useful...
-->
<project name="beanshell" default="compile-all" basedir=".">

<!-- Project Configuration -->

<property name="file" value=""/>

	<property name="ant.build.javac.target" value="1.6" />
	<property name="ant.build.javac.source" value="1.6" />
	<property name="version" value="2.1.1"/>
	<property name="deprecation" value="on"/>
	<property name="Specification-Title" value="BeanShell" />
	<property name="Specification-Version" value="${version}" />
	<property name="Specification-Vendor" value="http://www.beanshell.org/" />
	<property name="Implementation-Vendor" value="https://github.com/beanshell/beanshell" />

	<!-- choose an alternate compiler -->
	<!-- 
		<property name="build-compiler" value="jikes"/> 
		<property name="build-compiler" value="modern"/> 
	-->

	<property name="src-dir" value="src" />
	<property name="build-dir" value="classes" />
	<property name="test-build-dir" value="${build-dir}/tests" />
	<property name="lib-dir" value="lib" />
	<property name="dist-dir" value="dist" />
	<property name="test-src-dir" value="tests/src" />
	<property name="javadoc-dir" value="javadoc" />
	<property name="bsf-src-dir" value="bsf/src" />
	<property name="engine-src-dir" value="engine/src" />
	<property name="engine-config"
		value="engine/config/javax.script.ScriptEngineFactory" />
	<property name="classgen-src-dir" value="src/bsh/org/objectweb/asm" />

	<property name="javacc-lib" 
		value="${lib-dir}/javacc.jar"/>

	<!-- 
		Optional things you can't build under older versions of Java
		or which require optional packages.
		I think we can automate this in ant... deal with it later.
	-->

	<!-- Uncomment to build under JDK1.2 without warnings 
	<property name="exclude-1.2" 
		value="bsh/XThis.java,bsh/util/ClassBrowser.java"/>
	-->

	<!-- Uncomment to build under JDK1.1 without warnings 
	<property name="exclude-1.1" 
		value="bsh/JThis.java,bsh/classpath/*,bsh/util/*,bsh/reflect/*,bsh/ExternalNameSpace.java"/>
	-->

	<!-- Uncomment to build without making the BSF adapter 
	<property name="exclude-bsf" 
		value="bsh/util/BeanShellBSFEngine.java,TestBshBSF.java"/>
	-->

	<!-- Uncomment to build without making the javax.script (JSR223) adapter
	<property name="exclude-engine" value="bsh/engine/**"/>
	-->

	<!-- Uncomment to build without the ASM class generator code.
	<property name="exclude-classgen" 
		value="bsh/org/objectweb/asm/**,bsh/ClassGeneratorImpl.java,bsh/ClassGeneratorUtil.java,bsh/DelayedEvalBshMethod.java"/>
	-->

	<!-- Uncomment to build without making the servlet package 
	<property name="exclude-servlet" 
		value="bsh/servlet/*"/>
	-->

	<!-- Legacy excludes.  Comment this *out* to build these legacy items -->
	<property name="excludes-legacy" 
		value="bsh/JThis.java"/>

	<!-- Arbitrary excludes.  Comment this out to build these experimental or
		other items which we've decided not to build right now. 
	<property name="excludes-arbitrary" 
		value="bsh/ExternalNameSpace.java"/>
	-->

	<!--  Add up all of the excludes -->
	<!-- how do I add strings to break this long line? -->
	<property name="excludes" 
		value="${exclude-1.2},${exclude-1.1},${exclude-bsf},${exclude-engine},${exclude-servlet},${excludes-legacy},${exclude-classgen},${excludes-arbitrary}"/>

	<!-- JARs -->
	<property name="javadoc-zip" value="${dist-dir}/bsh-${version}-javadoc.zip"/>
	<property name="core-jar" value="${dist-dir}/bsh-core-${version}.jar"/>
	<property name="src-zip" value="${dist-dir}/bsh-${version}-src.zip"/>
	<property name="src-jar" value="${dist-dir}/bsh-${version}-sources.jar"/>
	<property name="pom" value="${dist-dir}/bsh-${version}.pom"/>
	<property name="all-jar-name" value="bsh-${version}.jar"/>
	<property name="all-jar" value="${dist-dir}/${all-jar-name}"/>
	<property name="commands-jar" 
		value="${dist-dir}/bsh-commands-${version}.jar"/>
	<property name="classpath-jar" 
		value="${dist-dir}/bsh-classpath-${version}.jar"/>
	<property name="reflect-jar" 
		value="${dist-dir}/bsh-reflect-${version}.jar"/>
	<property name="util-jar" value="${dist-dir}/bsh-util-${version}.jar"/>
	<property name="bsf-jar" value="${dist-dir}/bsh-bsf-${version}.jar"/>
	<property name="engine-jar" value="${dist-dir}/bsh-engine-${version}.jar"/>
	<property name="classgen-jar" value="${dist-dir}/bsh-classgen-${version}.jar"/>
	<property name="bshservlet-wbsh-war" 
		value="${dist-dir}/bshservlet-wbsh.war"/>
	<property name="bshservlet-war" value="${dist-dir}/bshservlet.war"/>

	<!-- Put the auto-generated command doc in the manual dir -->
	<property name="commands-bshdoc" 
		value="docs/manual/bshcommands-bshdoc.xml"/>

<!-- Begin Targets -->

	<!-- The javacc targets could be smarter... -->
	<target name="checkjjt">
		<uptodate property="jjtree.notRequired" 
				targetfile="${src-dir}/bsh/bsh.jj"
		>
			<srcfiles dir="${src-dir}/bsh" includes="bsh.jjt"/>
		</uptodate>
	</target>
	<target name="checkjj">
		<uptodate property="javacc.notRequired" 
				targetfile="${src-dir}/bsh/Parser.java"
		>
			<srcfiles dir="${src-dir}/bsh" includes="bsh.jj"/>
		</uptodate>
	</target>

	<!-- Create bsh.jj when bsh.jjt changes. -->
	<target name="jjtree" unless="jjtree.notRequired" depends="checkjjt">
		<java classname="jjtree"
			fork="yes"
			failonerror="yes" >
			<arg 
				line="-OUTPUT_DIRECTORY=${src-dir}/bsh ${src-dir}/bsh/bsh.jjt"/>
			<classpath>
				<fileset refid="lib-fileset"/>
			</classpath>
		</java>
	</target>

	<!-- Create Parser.java when bsh.jj changes. -->
	<target name="javacc" unless="javacc.notRequired" depends="checkjj">
		<java classname="javacc"
			fork="yes"
			failonerror="yes"
			classpath="${javacc-lib}">
			<arg line="-OUTPUT_DIRECTORY=${src-dir}/bsh ${src-dir}/bsh/bsh.jj"/>
			<classpath>
				<fileset refid="lib-fileset"/>
			</classpath>
		</java>
	</target>

	<target name="compile-all" depends="compile, compile-tests"/>

	<target name="compile-tests" depends="compile">
	  <mkdir dir="${test-build-dir}"/>
	  <javac srcdir="${test-src-dir}"
			destdir="${test-build-dir}"
			deprecation="${deprecation}"
			optimize="on"
			debug="on"
			includes="**/*.java"
			excludes="${excludes},**/bak/**"
			source="1.6"
			target="1.6"
		>
			<classpath>
				<fileset refid="lib-fileset"/>
				<pathelement path="${build-dir}"/>
			</classpath>
		</javac>

		<copy todir="${test-build-dir}">

			<!-- install bsh commands used in tests -->
			<fileset dir="${test-src-dir}">
				<patternset>
					<include name="**/*.bsh"/>
				</patternset>
			</fileset>
		</copy>
		<tstamp>
			<format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
		</tstamp>
	</target>

	<target name="compile" depends="jjtree,javacc,builddir">
		<!-- exclude the ${excludes} as well as anything under a "bak" dir -->
		<!--compiler="${build-compiler}"-->
		
		<javac
		srcdir="${src-dir}:${test-src-dir}:${bsf-src-dir}:${engine-src-dir}:${classgen-src-dir}"
			destdir="${build-dir}"
			deprecation="${deprecation}"
			optimize="on"
			debug="on"
			includes="**/*.java"
			excludes="${excludes},**/bak/**"
			source="1.6"
			target="1.6"
		>
			<classpath>
				<fileset refid="lib-fileset"/>
			</classpath>
		</javac>

		<copy todir="${build-dir}">
			<fileset dir="${src-dir}">
				<!-- install the bsh commands -->
				<patternset refid="commands-bsh-patternset"/>
				<!-- install the util/lib stuff -->
				<patternset refid="util-lib-patternset"/>
<!-- need to break this into a separate target to use exclude -->
				<!-- install the servlet stuff -->
				<patternset refid="bshservlet-patternset"/>
			</fileset>

			<!-- install bsh commands used in tests -->
			<fileset dir="${test-src-dir}">
				<patternset>
					<include name="**/*.bsh"/>
				</patternset>
			</fileset>
		</copy>

		<!-- Install the javax.script engine factory config -->
		<copy file="${engine-config}" todir="${build-dir}/META-INF/services" />

		<tstamp>
			<format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
		</tstamp>
	</target>

	<target name="javadoc" depends="compile">
		<mkdir dir="${javadoc-dir}" />
		<javadoc packagenames="bsh,bsh.util,bsh.classpath,bsh.reflect"
			 sourcepath="${src-dir}:${classgen-src-dir}"
			 destdir="${javadoc-dir}"
			 author="true"
			 version="true"
			 source="1.6"
			 use="true"
			 windowtitle="BeanShell ${version}"
			 doctitle="&lt;h1&gt;BeanShell ${version}&lt;h1&gt;"
			 bottom="&lt;em&gt;&#169; 2000-2005 pat@pat.net :-)&lt;/em&gt;"
		/>
	</target>

	<!-- Jar target setup -->

	<!--
	<target name="superclean" description="Remove any generated files.">
	</target>
	-->

	<target name="clean">
		<delete quiet="true" dir="${build-dir}"/>
		<delete quiet="true" dir="${javadoc-dir}"/>
		<!--
		<delete quiet="true" dir="${dist-dir}"/>
		-->
		
		<!-- clear the junit reports: -->
		<delete quiet="true" dir="${junit-reports}" />

		<!-- Moved to dist dir
		<delete quiet="true" file="${javadoc-jar}"/>
		<delete quiet="true" file="${src-jar}"/>
		<delete quiet="true" file="${core-jar}"/>
		<delete quiet="true" file="${all-jar}"/>
		<delete quiet="true" file="${util-jar}"/>
		<delete quiet="true" file="${classpath-jar}"/>
		<delete quiet="true" file="${commands-jar}"/>
		<delete quiet="true" file="${reflect-jar}"/>
		<delete quiet="true" file="${bsf-jar}"/>
		<delete quiet="true" file="${engine-jar}"/>
		<delete quiet="true" file="${classgen-jar}"/>
		<delete quiet="true" file="${bshservlet-wbsh-war}"/>
		<delete quiet="true" file="${bshservlet-war}"/>
		-->

		<delete quiet="true" file="${commands-bshdoc}"/>
		<!-- hack -->
		<delete quiet="true" file="bshcommands.html"/>
	</target>

	<target name="builddir">
		<mkdir dir="${build-dir}" />
	</target>

	<!-- Begin: Filesets -->

	<fileset id="lib-fileset" dir="${lib-dir}">
		<patternset>
			<include name="*.jar"/>
		</patternset>
	</fileset>

	<fileset id="core-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/*.class"/>
<!-- something funny here...  Console ends up in jarall, but not Remote -->
			<exclude name="bsh/Console.class"/>
			<exclude name="bsh/Remote*"/>
			<exclude name="bsh/ClassGeneratorImpl*"/>
			<exclude name="bsh/ClassGeneratorUtil*"/>
			<exclude name="bsh/DelayedEvalBshMethod*"/>
		</patternset>
	</fileset>

	<fileset id="classpath-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/classpath/*.class"/>
		</patternset>
	</fileset>

	<fileset id="reflect-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/reflect/*.class"/>
		</patternset>
	</fileset>

	<fileset id="collection-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/collection/*.class"/>
		</patternset>
	</fileset>

	<fileset id="bsf-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/util/BeanShellBSFEngine.class"/>
		</patternset>
	</fileset>

	<fileset id="engine-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/engine/**.class"/>
			<include name="META-INF/services/javax.script*"/>
		</patternset>
	</fileset>

	<fileset id="classgen-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/ClassGeneratorImpl*.class"/>
			<include name="bsh/ClassGeneratorUtil*.class"/>
			<include name="bsh/DelayedEvalBshMethod*.class"/>
			<include name="bsh/org/objectweb/asm/**/*.class"/>
		</patternset>
	</fileset>

	<fileset id="bshservlet-fileset" dir="${build-dir}">
		<patternset id="bshservlet-patternset">
			<include name="bsh/servlet/*.class"/>
			<include name="bsh/servlet/*.bsh"/>
			<include name="bsh/servlet/*.template"/>
		</patternset>
	</fileset>

	<fileset id="commands-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/commands/*.class"/>
		</patternset>
		<patternset id="commands-bsh-patternset">
			<include name="bsh/commands/*.bsh"/>
			<exclude name="CVS"/>
			<exclude name=".svn"/>
		</patternset>
	</fileset>

	<fileset id="util-fileset" dir="${build-dir}">
		<patternset>
			<include name="bsh/util/*.class"/>
			<exclude name="bsh/util/BeanShellBSFEngine.class"/>
		</patternset>
		<patternset id="util-lib-patternset">
			<include name="bsh/util/lib/*"/>
			<exclude name="CVS"/>
			<exclude name=".svn"/>
		</patternset>
	</fileset>

	<!-- End: Filesets -->

	<!-- Jar targets -->

	<target name="jarcore" depends="compile,_distdir">
	<!--
		<fail message="Please use ant 1.6">
			<condition>
				<not>
					<contains string="${ant.version}" substring="1.6"/>
				</not>
			</condition>
		</fail>
	-->
	<delete file="${core-jar}"/>
		<jar jarfile="${core-jar}">
			<manifest>
				<attribute name="Main-Class" value="bsh.Interpreter" />
				<attribute name="Specification-Title" value="BeanShell core" />
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Specification-Vendor" value="${Specification-Vendor}" />
				<attribute name="Implementation-Version" value="${version} ${DATE}" />
				<attribute name="Implementation-Vendor" value="${Implementation-Vendor}" />
			</manifest>
			<!--
			<service type="javax.script.ScriptEngineFactory" provider="bsh.BshScriptEngineFactory"/>
			-->
			<fileset refid="core-fileset"/>
		</jar>
	</target>

	<target name="jarall" depends="compile,_distdir">
		<delete file="${all-jar}"/>
		<jar jarfile="${all-jar}">
			<manifest>
				<attribute name="Main-Class" value="bsh.Console" />
				<attribute name="Specification-Title" value="${Specification-Title}" />
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Specification-Vendor" value="${Specification-Vendor}" />
				<attribute name="Implementation-Version" value="${version} ${DATE}" />
				<attribute name="Implementation-Vendor" value="${Implementation-Vendor}" />
			</manifest>
			<!--
			<service type="javax.script.ScriptEngineFactory" provider="bsh.BshScriptEngineFactory"/>
			-->
			<fileset refid="core-fileset"/>
			<fileset refid="classpath-fileset"/>
			<fileset refid="reflect-fileset"/>
			<fileset refid="collection-fileset"/>
			<fileset refid="util-fileset"/>
			<fileset refid="commands-fileset"/>
			<fileset refid="bsf-fileset"/>
			<fileset refid="engine-fileset"/>
			<fileset refid="classgen-fileset"/>
			<fileset refid="bshservlet-fileset"/>
<!-- hack, see core-fileset -->
			<fileset dir="${build-dir}">
				<patternset>
					<include name="bsh/Remote.class"/>
					<include name="bsh/Console.class"/>
				</patternset>
			</fileset>
		</jar>
	</target>

	<target name="zipsrc" depends="_distdir">
		<delete file="${src-zip}"/>
		<zip zipfile="${src-zip}">
			<zipfileset dir="." prefix="BeanShell-${version}">
				<exclude name="classes*"/>
				<exclude name="classes/**/*"/>
				<exclude name="dist*"/>
				<exclude name="dist/**/*"/>
				<exclude name="*javadoc*"/>
				<exclude name="javadoc/**/*"/>
				<exclude name="tests/junit-reports"/>
				<exclude name="local"/>
				<!--exclude name="docs/**/*"/-->
				<exclude name="**/CVS"/>
				<exclude name="**/.svn"/>
			</zipfileset>
		</zip>
	</target>
	<target name="jarsrc" depends="_distdir">
		<delete file="${src-jar}"/>
		<zip zipfile="${src-jar}">
			<zipfileset dir="src" prefix="">
				<include name="**/*.java"/>
				<exclude name="**/CVS"/>
				<exclude name="**/.svn"/>
			</zipfileset>
		</zip>
	</target>
	<target name="pom" depends="_distdir">
		<delete file="${pom}"/>
		<copy file="pom.xml" tofile="${pom}" />
	</target>

	<target name="_distdir">
		<mkdir dir="${dist-dir}" />
	</target>

	<target name="jarfileset">
		<delete file="${target-jar}"/>
		<jar jarfile="${target-jar}">
			<manifest>
				<attribute name="Specification-Title" value="${specification-title}" />
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Specification-Vendor" value="${Specification-Vendor}" />
				<attribute name="Implementation-Version" value="${version} ${DATE}" />
				<attribute name="Implementation-Vendor" value="${Implementation-Vendor}" />
			</manifest>
			<fileset refid="${fileset}"/>
		</jar>
	</target>
	
	<!-- Make all of the dist jars -->
	<target name="dist" depends="_distdir,compile-all,jarcore,jarall,javadoc,zipsrc,jarsrc,pom,bshservlet-war,bshservlet-wbsh-war,bshdoc">

		<antcall target="jarfileset">
			<param name="target-jar" value="${commands-jar}"/>
			<param name="specification-title" value="BeanShell commands"/>
			<param name="fileset" value="commands-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${classpath-jar}"/>
			<param name="specification-title" value="BeanShell classpath"/>
			<param name="fileset" value="classpath-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${reflect-jar}"/>
			<param name="specification-title" value="BeanShell reflect"/>
			<param name="fileset" value="reflect-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${util-jar}"/>
			<param name="specification-title" value="BeanShell util"/>
			<param name="fileset" value="util-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${bsf-jar}"/>
			<param name="specification-title" value="BeanShell bsf"/>
			<param name="fileset" value="bsf-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${engine-jar}"/>
			<param name="specification-title" value="BeanShell JSR223 Engine"/>
			<param name="fileset" value="engine-fileset"/>
		</antcall>

		<antcall target="jarfileset">
			<param name="target-jar" value="${classgen-jar}"/>
			<param name="specification-title" value="BeanShell classgen"/>
			<param name="fileset" value="classgen-fileset"/>
		</antcall>

		<delete file="${javadoc-zip}"/>
		<zip zipfile="${javadoc-zip}" basedir="${javadoc-dir}"/>
				<checksum fileext=".sha1" algorithm="SHA" forceoverwrite="true">
				   <fileset dir="${dist-dir}">
					 <include name="*.zip" />
					 <include name="*.jar" />
					 <include name="*.pom" />
				   </fileset>
				</checksum>

		<!-- Build the documentation -->
		<!-- Don't build the documentation right now.
			It's breaking the jakarta GUMP build for some reason.
		<ant dir="docs/manual"/>
		-->
	</target>

	<target name="bshservlet-war" depends="compile" unless="exclude-servlet">
		<war warfile="${bshservlet-war}" 
			webxml="${src-dir}/bsh/servlet/example-web.xml">
			<manifest>
				<attribute name="Specification-Title" value="BeanShell webapp" />
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Specification-Vendor" value="http://www.beanshell.org/" />
				<attribute name="Implementation-Version" value="${version} ${DATE}" />
				<attribute name="Implementation-Vendor" value="Pat Niemeyer (pat@pat.net)" />
			</manifest>
			<!--classes dir="${build-dir}" includes="bsh/servlet/**/*"/-->
			<fileset dir="${src-dir}/bsh/servlet/" includes="index.html"/>
		</war>
	</target>
	<target name="bshservlet-wbsh-war" 
					depends="compile,jarall" unless="exclude-servlet">
		<war warfile="${bshservlet-wbsh-war}" 
			webxml="${src-dir}/bsh/servlet/example-web.xml">
			<manifest>
				<attribute name="Specification-Title" value="BeanShell webapp" />
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Specification-Vendor" value="http://www.beanshell.org/" />
				<attribute name="Implementation-Version" value="${version} ${DATE}" />
				<attribute name="Implementation-Vendor" value="Pat Niemeyer (pat@pat.net)" />
			</manifest>
			<!--classes dir="${build-dir}" includes="bsh/servlet/**/*"/-->
			<fileset dir="${src-dir}/bsh/servlet/" includes="index.html"/>
			<lib dir="${dist-dir}" includes="${all-jar-name}"/>
		</war>
	</target>

	<!-- 
		This target produces XML source for beanshell documentation of the 
		bsh command set.
		
		The bshdoc script requires Java 1.4 for regular expressions.
	
		Notes:
			- I am concerned that the fileset argument could be too large for
			parallel if ant is using full path names.  But the bshdoc script 
			wants all of the files simultaneously to produce one XML file
			amenable to indexing, etc.
			- Needs some file timestamp checking... mapper tag might help.

		The output goes in the docs area, which has its own build file.
	-->
	<target name="bshdoc" depends="jarall">	 
		<!-- 
			I'd like to use the java target, but there seems to be no way
			to supply a fileset in an arg argument.
		-->
		<apply executable="java" output="${commands-bshdoc}" parallel="true">
			<arg value="-cp"/>
			<arg value="${all-jar}"/>
			<arg value="bsh.Interpreter"/>
			<arg file="scripts/bshdoc.bsh"/>
			<!--fileset refid="commands-fileset"/-->
			<fileset dir="src/bsh/commands" includes="*.bsh"/>
		</apply>
	</target>   

	<!-- 
		Run a script specified in the file property using the build 
		classpath (e.g. latest compiled version)
			
			ant -Dfile=foo.bsh bsh
	-->
	<target name="bsh" depends="compile">
		<java classname="bsh.Interpreter" fork="true">
 			<classpath>
				<pathelement location="${build-dir}"/>
				<fileset refid="lib-fileset"/>
			</classpath>
			<arg value="${file}"/>
		</java>
	</target>



	<!-- 
		  Set up some properties for use with the testing framework
	-->

	<property name="junit.jar" value="${lib-dir}/junit-4.13.1.jar"/>
	<property name="hamcrest.jar" value="${lib-dir}/hamcrest-core-1.3.jar"/>
	
	<!-- JUnit source files. -->
	<property name="junit-test-src-dir" value="tests/junitTests/src" />
	
	<!-- Directory to store the junit reports in.  Deleted on a clean. -->
	<property name="junit-reports" value="tests/junit-reports" />
	
	<!-- Set up a classpath for use when testing the project: -->
	<path id="test-classpath">
	  <pathelement location="${build-dir}"/>
	  <pathelement location="${junit.jar}"/>
	  <fileset refid="lib-fileset"/>
	</path>
	
	<target name="build-junit-tests"
			  depends="compile" >
	  <!-- description="Builds the JUnit Test suite."> -->
	  <javac srcdir="${junit-test-src-dir}"
				destdir="${build-dir}"
				debug="on"
				debuglevel="lines,vars,source"
				source="1.6"
				target="1.6"
			  >
		 <classpath>
			<path refid="test-classpath"/>
		 </classpath>
	  </javac>
	</target>
	
	<target name="junit-tests" depends="build-junit-tests">
	  <!-- description="Runs the JUnit test suite."> -->
	  
	  <mkdir dir="${junit-reports}" />
	  
	  <junit printsummary="yes" haltonfailure="no" fork="yes">
		 <sysproperty key="skip_known_issues" value=""/>
		 <classpath>
			<path refid="test-classpath"/>
		 </classpath>
		 
		 <assertions enableSystemAssertions="true"/>

		 <formatter type="brief" usefile="true"/>

		 <batchtest todir="${junit-reports}">
			<fileset dir="${junit-test-src-dir}">
			  <include name="**/*Test.java"/>
			</fileset>
		 </batchtest>
	  </junit>
	</target>


	<target name="junit-tests-all" depends="build-junit-tests">
	  <!-- description="Runs the JUnit test suite."> -->

	  <mkdir dir="${junit-reports}" />

	  <junit printsummary="yes" haltonfailure="no" fork="yes">
		 <classpath>
			<path refid="test-classpath"/>
		 </classpath>

		 <assertions enableSystemAssertions="true"/>

		 <formatter type="brief" usefile="true"/>

		 <batchtest todir="${junit-reports}">
			<fileset dir="${junit-test-src-dir}">
			  <include name="**/*Test.java"/>
			</fileset>
		 </batchtest>
	  </junit>
	</target>


	<!-- 
		Run the bsh test suite.
	-->
	<target name="test" depends="compile-tests">
		<antcall target="bsh">
			<param name="file" value="tests/test-scripts/RunAllTests.bsh"/>
		</antcall>
	</target>

</project>
