<project name="input-sandbox" default="main" basedir=".">

  <target name="setup">
    <property name="main.ant" location="../../.." />
    <property name="classes.dir" value="build/classes" />
    <mkdir dir="${classes.dir}" />
    <ant dir="${main.ant}" inheritall="false" target="build" />
    <copy toDir="${classes.dir}" preservelastmodified="true" >
      <fileset dir="${main.ant}/${classes.dir}">
        <include name='**' />
	<exclude name='org/apache/tools/ant/Project.class' />
	<exclude name='org/apache/tools/ant/Main.class' />
	<exclude name='org/apache/tools/ant/taskdefs/Input.class' />
      </fileset>
    </copy>
  </target>

  <target name="main" depends="setup">
    <javac srcdir="src/main" destdir="${classes.dir}" />
    <jar destfile="build/ant.jar">
      <fileset dir="${classes.dir}">
        <exclude name="**/optional/*" />
      </fileset>
    </jar>
  </target>

  <target name="setup-tests" depends="setup">
    <property name="testcases.dir" value="build/testcases" />
    <mkdir dir="${testcases.dir}" />
    <ant dir="${main.ant}" inheritall="false" target="compile-tests" />
    <copy toDir="${testcases.dir}" preservelastmodified="true" >
      <fileset dir="${main.ant}/${testcases.dir}">
	<include name='org/apache/tools/ant/BuildFileTest*.class' />
      </fileset>
    </copy>
  </target>

  <target name="compile-tests" depends="setup-tests,main">
    <javac srcdir="src/testcases" destdir="${testcases.dir}"
           includeantruntime="false">
      <classpath>
        <pathelement location="build/ant.jar" />
        <pathelement location="${main.ant}/lib/optional/junit.jar" />
      </classpath>
    </javac>
  </target>

  <target name="run-test" depends="compile-tests">
    <junit fork="true" filtertrace="false" includeantruntime="false">
      <classpath>
        <pathelement location="${testcases.dir}" />
        <pathelement location="build/ant.jar" />
        <pathelement location="${main.ant}/lib/crimson.jar" />
        <pathelement location="${main.ant}/lib/optional/junit.jar" />
      </classpath>
      <formatter type="plain" usefile="false" />
      <test name="org.apache.tools.ant.taskdefs.InputTest" />
    </junit>
  </target>
</project>