<?xml version="1.0"?>

<!-- ===================================================================

Ant build file for JiBX Java data binding to XML

This is a build file for use with the Ant build tool.  See
http://jakarta.apache.org/ant/index.html for more info.  This build.xml
file has been tested with ant version 1.6.1.

===================================================================+ -->

<project name="jibx" default="distrib" basedir="..">

  <!-- The directories -->
  <property name="root" value="${basedir}"/>
  <property name="lib" value="${basedir}/lib"/>
  <property name="build" value="${basedir}/build"/>
  <property name="src" value="${build}/src"/>
  <property name="extrassrc" value="${build}/extras"/>
  <property name="binddest" value="${build}/classes/main"/>
  <property name="rundest" value="${build}/classes/main"/>
  <property name="testdest" value="${build}/classes/test"/>
  <property name="extrasdest" value="${build}/classes/main"/>
  <property name="toolsdest" value="${build}/classes/tools"/>
  <property name="testdata" value="${build}/test/data"/>
  <property name="testsrc" value="${build}/test"/>
  <property name="simpledata" value="${build}/test/simple"/>
  <property name="java5data" value="${build}/test/java5"/>
  <property name="extrasdata" value="${build}/test/extras"/>
  <property name="userdocs" value="${basedir}/docs/api"/>
  <property name="devdocs" value="${build}/docs/dev"/>
  <property name="binddocs" value="${basedir}/docs"/>
  <property name="tutorial" value="${basedir}/tutorial"/>
  <property name="target" value="1.3"/>
  <property name="source" value="1.3"/>

  <!-- Other definitions -->
  <property name="project" value="JiBX Java data binding to XML"/>
  <property name="projname" value="jibx"/>
  <property name="version" value="1.1.6a"/>
  <property name="distribname" value="jibx_1_1_6a"/>
  <property name="packages" value="org.jibx"/>
  <property environment="env"/>
  <condition property="skip21">
    <or>
      <equals arg1="${ant.java.version}" arg2="1.3"/>
      <equals arg1="${ant.java.version}" arg2="1.5"/>
    </or>
  </condition>
  <condition property="java5">
    <or>
      <equals arg1="${ant.java.version}" arg2="1.5"/>
      <equals arg1="${ant.java.version}" arg2="1.6"/>
    </or>
  </condition>

  <!-- Common classpath -->
  <path id="project-classpath">
    <pathelement location="${binddest}"/>
    <pathelement location="${rundest}"/>
    <fileset dir="${lib}" includes="*.jar" excludes="asm*.jar,org.eclipse.*.jar,qdox*.jar,jibx*.jar"/>
  </path>
  <path id="binding-classpath">
    <pathelement location="${binddest}"/>
    <pathelement location="${rundest}"/>
    <fileset dir="${lib}" includes="*.jar" excludes="asm*.jar,org.eclipse.*.jar,jibx*.jar"/>
  </path>
  <path id="javadoc-classpath">
    <fileset dir="${lib}" includes="*.jar"/>
  </path>
  
  <!-- Optional components -->
  <available property="dom4j" file="${lib}/dom4j.jar"/>
  <available property="jdom" file="${lib}/jdom.jar"/>

  <!-- Delete binding class files -->
  <target name="clean-bind">
    <delete quiet="true" file="${lib}/${bindname}.jar"/>
    <delete quiet="true" dir="${binddest}/org/jibx/binding"/>
    <delete quiet="true" dir="${binddest}/org/jibx/custom"/>
    <delete quiet="true" dir="${binddest}/org/jibx/schema"/>
    <delete quiet="true" dir="${binddest}/org/jibx/util"/>
    <delete quiet="true" dir="${binddest}/org/jibx/ws"/>
  </target>

  <!-- Delete runtime class files -->
  <target name="clean-run">
    <delete quiet="true" file="${lib}/${runname}.jar"/>
    <delete quiet="true" dir="${rundest}/org/jibx/runtime"/>
  </target>

  <!-- Delete extras class files -->
  <target name="clean-extras">
    <delete quiet="true" file="${lib}/${extrasname}.jar"/>
    <delete quiet="true" dir="${extrasdest}/org/jibx/extras"/>
  </target>

  <!-- Set options for release build -->
  <target name="setrelease">
    <property name="optimize" value="on"/>
    <property name="enable-debug" value="off"/>
  </target>
  
  <!-- Set options for debug build -->
  <target name="setdebug">
    <property name="optimize" value="off"/>
    <property name="enable-debug" value="on"/>
  </target>
  
  <!-- Set jar names for normal build -->
  <target name="basenames">
    <property name="bindname" value="jibx-bind"/>
    <property name="runname" value="jibx-run"/>
    <property name="extrasname" value="jibx-extras"/>
    <property name="jibx2wsdlname" value="jibx-javatools"/>
  </target>
  
  <!-- Set jar names for J2ME build -->
  <target name="j2menames">
    <property name="bindname" value="jibx-j2me-bind"/>
    <property name="runname" value="jibx-j2me-run"/>
    <property name="extrasname" value="jibx-j2me-extras"/>
    <property name="j2me-build" value=""/>
  </target>
  
  <!-- Modify code for J2ME build -->
  <target name="enablej2me" depends="j2menames">
    <java classname="JEnable" classpath="${build}/jenable">
      <arg value="-e"/>
      <arg value="j2me"/>
      <arg value="-p"/>
      <arg value="${build}/src/**/*"/>
      <arg value="${build}/extras/**/*"/>
      <arg value="${build}/test/**/*"/>
    </java>
  </target>
  
  <!-- Set tests classpath (need to be done after jars are built) -->
  <target name="set-tests-classpath">
    <path id="tests-classpath">
      <pathelement location="${testdest}"/>
      <fileset dir="${lib}" includes="*.jar" excludes="jibx*.jar"/>
      <fileset dir="${lib}"
          includes="${bindname}.jar,${runname}.jar,${extrasname}.jar"/>
    </path>
  </target>
  
  <!-- Modify code for standard build -->
  <target name="disablej2me" depends="basenames">
    <java classname="JEnable" classpath="${build}/jenable">
      <arg value="-d"/>
      <arg value="j2me"/>
      <arg value="-p"/>
      <arg value="${build}/src/**/*"/>
      <arg value="${build}/extras/**/*"/>
      <arg value="${build}/test/**/*"/>
    </java>
  </target>
  
  <!-- Compile the binding and generator code -->
  <target name="compile-bind" depends="compile-run,compile-extras">
    <mkdir dir="${binddest}"/>
    <tempfile property="temp.file"/>
    <copy file="${src}/org/jibx/binding/def/BindingDefinition.java"
      tofile="${temp.file}" preservelastmodified="true"/>
    <replace file="${src}/org/jibx/binding/def/BindingDefinition.java"
      token="@distrib@" value="${distribname}"/>
    <javac srcdir="${src}"
      destdir="${binddest}"
      target="${target}"
      includes="org/jibx/binding/**/*.java,org/jibx/schema/**/*.java,org/jibx/util/**/*.java,org/jibx/binding/generator/**/*.java,org/jibx/custom/**/*.java,org/jibx/ws/wsdl/**/*.java"
      excludes="org/jibx/binding/schema*/**/*.java,org/jibx/schema/codegen/**/*.java,org/jibx/binding/SchemaGenerator.java,org/jibx/binding/BindingGenerator.java"
      optimize="${optimize}"
      debug="${enable-debug}"
      source="${source}"
      deprecation="on">
      <classpath refid="binding-classpath"/>
    </javac>
    <java classname="org.jibx.binding.Compile" fork="yes"
        classpathref="binding-classpath" failonerror="true">
      <!-- This command line argument should only be used when binding JiBX.
        It skips the step of validating the binding using the binding definition
        model (because the model itself uses JiBX binding, which can create
        bootstrapping problems in development. -->
      <arg value="-s"/>
      <arg value="${src}/org/jibx/binding/model/binding.xml"/>
    </java> 
    <java classname="org.jibx.binding.Compile" fork="yes"
        classpathref="binding-classpath" failonerror="true">
      <arg value="${src}/org/jibx/ws/wsdl/binding.xml"/>
      <arg value="${src}/org/jibx/ws/wsdl/wsdl-binding.xml"/>
      <arg value="${src}/org/jibx/schema/binding.xml"/>
    </java>
    <move file="${temp.file}" preservelastmodified="true"
      tofile="${src}/org/jibx/binding/def/BindingDefinition.java"/>
  </target>

  <!-- Compile the runtime code -->
  <target name="compile-run">
    <mkdir dir="${rundest}"/>
    <tempfile property="temp.file"/>
    <copy file="${src}/org/jibx/runtime/IBindingFactory.java"
      tofile="${temp.file}" preservelastmodified="true"/>
    <replace file="${src}/org/jibx/runtime/IBindingFactory.java"
      token="@distrib@" value="${distribname}"/>
    <javac srcdir="${src}"
      destdir="${rundest}"
      target="${target}"
      includes="org/jibx/*.java,org/jibx/runtime/**/*.java"
      optimize="${optimize}"
      debug="${enable-debug}"
      source="${source}"
      deprecation="on">
      <classpath refid="project-classpath"/>
    </javac>
    <move file="${temp.file}" preservelastmodified="true"
      tofile="${src}/org/jibx/runtime/IBindingFactory.java"/>
  </target>

  <!-- Compile the extras code -->
  <target name="compile-extras">
    <mkdir dir="${extrasdest}"/>
    <javac srcdir="${extrassrc}"
      destdir="${extrasdest}"
      target="${target}"
      includes="org/jibx/extras/**/*.java"
      optimize="${optimize}"
      debug="${enable-debug}"
      source="${source}"
      deprecation="on">
      <classpath refid="project-classpath"/>
      <exclude name="**/org/jibx/extras/Dom4J*.java" unless="dom4j"/>
      <exclude name="**/org/jibx/extras/JDOM*.java" unless="jdom"/>
    </javac>
  </target>

  <!-- Clean files generated by the tests. -->
  <target name="clean-tests">
    <delete quiet="true" dir="${testdest}"/>
    <mkdir dir="${testdest}"/>
  </target>

  <!-- Compile and prepare the test code. -->
  <target name="prepare-tests">
    
    <!-- Compile the test code and copy resources. -->
    <echo message="Compiling the test code"/>
    <javac srcdir="${testsrc}"
      destdir="${testdest}"
      target="${target}"
      includes="org/jibx/match/**/*.java,multiple/*.java,simple/*.java,extras/*.java"
      excludes="extras/Dom4J*.java,extras/JDOM*.java"
      optimize="off"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath refid="tests-classpath"/>
    </javac>
    <copy todir="${testdest}">
      <fileset dir="${testsrc}" includes="**/*.xml,**/*.txt"/>
    </copy>
  </target>

  <!-- Test multiple bindings to same classes (flight timetable tests). -->
  <target name="run-multiple-tests">
    
    <!-- Add all the bindings used in multiple binding tests (twice on some, to
      check double-bind handling). -->
    <echo message="Beginning multiple binding compiler run"/>
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
    </taskdef>
    <bind>
      <classpathset dir="${testdest}"/>
      <bindingfileset dir="${testdata}">
        <include name="binding0.xml"/>
        <include name="binding1.xml"/>
        <include name="binding2.xml"/>
      </bindingfileset>
    </bind>
    <bind load="true">
      <classpathset dir="${testdest}"/>
      <bindingfileset dir="${testdata}">
        <include name="binding0.xml"/>
        <include name="binding1.xml"/>
        <include name="binding2.xml"/>
        <include name="binding2a.xml"/>
        <include name="binding3.xml"/>
<!--        <include name="binding3a.xml"/> -->
        <include name="binding4.xml"/>
        <include name="binding-5.xml"/>
        <include name="binding5a.xml"/>
        <include name="binding5b.xml"/>
        <include name="binding5c.xml"/>
        <include name="binding5d.xml"/>
        <include name="binding-6.xml"/>
      </bindingfileset>
    </bind>
    
    <!-- Run the actual multiple binding tests. -->
    <echo message="Beginning multiple binding test run"/>
    <java classname="org.jibx.match.TestMultiple" fork="yes" dir="${testdata}"
        failonerror="true">
      <classpath>
        <pathelement path="${testdest}"/>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
      
      <!-- This is the full set of crossbar tests with most combinations included -->
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding0"/>
      <arg value="timetable0.xml"/>
      <arg value="binding0"/>
      <arg value="timetable0.xml"/>
      
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding0"/>
      <arg value="timetable0.xml"/>
      <arg value="binding1"/>
      <arg value="timetable1.xml"/>
      
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding0"/>
      <arg value="timetable0.xml"/>
      <arg value="binding2"/>
      <arg value="timetable2.xml"/>
      
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding1"/>
      <arg value="timetable1.xml"/>
      <arg value="binding0"/>
      <arg value="timetable0.xml"/>
      
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding1"/>
      <arg value="timetable1.xml"/>
      <arg value="binding2"/>
      <arg value="timetable2.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="timetable2.xml"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      
<!--      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      <arg value="binding3a"/>
      <arg value="splittable3a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3a"/>
      <arg value="splittable3a.xml"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>  -->
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      <arg value="binding5a"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding_5"/>
      <arg value="splittable5.xml"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding5a"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding5a"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding4"/>
      <arg value="splittable4.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding_5"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding3"/>
      <arg value="splittable3.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding5a"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding5a"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding5b"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding5b"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding5c"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding5c"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="binding5d"/>
      <arg value="splittable5a.xml"/>
      <arg value="binding5d"/>
      <arg value="splittable5a.xml"/>
      
      <arg value="multiple.SplitTableBean"/>
      <arg value="6"/>
      <arg value="splittable4.xml"/>
      <arg value="6"/>
      <arg value="splittable4.xml"/>
      
      <!-- Handle simple tests for variations of standard run -->
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding2"/>
      <arg value="timetable2.xml"/>
      <arg value="binding2a"/>
      <arg value="timetable2a.xml"/>
      
      <arg value="multiple.TimeTableBean"/>
      <arg value="binding2a"/>
      <arg value="timetable2a.xml"/>
      <arg value="binding2"/>
      <arg value="timetable2.xml"/>
    </java>
  </target>

  <!-- Test full set of conditions in single-binding test library. -->
  <target name="run-single-tests">
    
    <!-- Run single binding tests directly. -->
    <echo message="Checking asymmetric bindings --"/>
    <echo message="Will generate warnings for no way to load prior value"/>
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
    </taskdef>
    <bind load="true">
      <classpath>
        <pathelement path="${testdest}"/>
        <pathelement location="${lib}/${runname}.jar"/>
      </classpath>
      <bindingfileset dir="${simpledata}">
        <include name="binding3d.xml"/>
        <include name="binding0.xml"/>
        <include name="binding0a.xml"/>
        <include name="binding6b.xml"/>
        <include name="mybinding2.xml"/>
        <include name="mybinding2a.xml"/>
      </bindingfileset>
    </bind>
    <java classname="org.jibx.match.TestMultiple" fork="yes" dir="${simpledata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg value="simple.Customer0"/>
      <arg value="binding0a"/>
      <arg value="simple0a.xml"/>
      <arg value="binding0"/>
      <arg value="simple.xml"/>
    </java>
    <java classname="org.jibx.match.TestMultipleStAX" fork="yes" dir="${simpledata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg value="simple.Customer0"/>
      <arg value="binding0a"/>
      <arg value="simple0a.xml"/>
      <arg value="binding0"/>
      <arg value="simple.xml"/>
    </java>
    <echo message="Beginning single bind on load test run --"/>
    <echo message="Will generate warnings for deprecated label/using and no object"/>
    <java classname="org.jibx.match.TestLoader" fork="yes" dir="${simpledata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="simple/binding0.xml simple.Customer0 simple.xml"/>
      <arg line="simple/binding0b.xml simple.Customer0 simple.xml"/>
      <arg line="simple/binding0b.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding0c.xml simple.Customer0 simple0b.xml"/>
      <arg line="simple/binding0d.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding0d.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding1.xml simple.Customer1 simple.xml"/>
      <arg line="simple/binding1a.xml simple.Customer1 simple.xml"/>
      <arg line="simple/binding1a.xml simple.Customer1 simple1a.xml"/>
      <arg line="simple/binding1a.xml simple.Customer1 simple1b.xml"/>
      <arg line="simple/binding1b.xml simple.Customer1 simple1c.xml"/>
      <arg line="simple/binding2.xml simple.Customer2 simple2.xml"/>
      <arg line="simple/binding2.xml simple.Customer2 simple2a.xml"/>
      <arg line="simple/binding2.xml simple.Customer2 simple2b.xml"/>
      <arg line="simple/binding2a.xml simple.Customer2 simple2b.xml"/>
      <arg line="simple/binding2a.xml simple.Customer2 simple2c.xml"/>
      <arg line="simple/binding2c.xml simple.Customer2 simple2b.xml"/>
      <arg line="simple/binding0.xml simple.Customer0 simple1.xml"/>
      <arg line="simple/binding0.xml simple.Customer0 simple2.xml"/>
      <arg line="simple/binding3.xml simple.Customer3 simple3.xml"/>
      <arg line="simple/binding3a.xml simple.Customer3 simple3.xml"/>
      <arg line="simple/binding3b.xml simple.Customer3 simple3b.xml"/>
      <arg line="simple/binding3d.xml simple.Customer3 simple3d.xml"/>
      <arg line="simple/binding3e.xml simple.Customer3 simple3c.xml"/>
      <arg line="simple/binding4.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4a.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4b.xml simple.Customer4 simple4b.xml"/>
      <arg line="simple/binding4c.xml simple.Customer4 simple4b.xml"/>
      <arg line="simple/binding4c.xml simple.Customer4 simple4c.xml"/>
      <arg line="simple/binding4e.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4e.xml simple.Customer4 simple4e.xml"/>
      <arg line="simple/binding5.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5a.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5b.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5c.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5c.xml simple.Customer5 simple5d.xml"/>
      <arg line="simple/binding5d.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5d.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5e.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5e.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5f.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5g.xml simple.Customer5 simple5c.xml"/>
      <arg line="simple/binding6.xml simple.Customers6 simple6.xml"/>
      <arg line="simple/binding6a.xml simple.Customers6 simple6a.xml"/>
      <arg line="simple/binding6b.xml simple.Customers6 simple6a.xml"/>
      <arg line="simple/binding6c.xml simple.Customers6 simple6b.xml"/>
      <arg line="simple/binding7.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding7a.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7a.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding7b.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7b.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding8.xml simple.Customer8a simple8a.xml"/>
      <arg line="simple/binding8.xml simple.Customer8b simple8b.xml"/>
      <arg line="simple/binding8.xml simple.Customers8 simple8.xml"/>
      <arg line="simple/binding8a.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8b.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8c.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8d.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9.xml"/>
      <arg line="simple/binding9.xml simple.Subscriber9 simple9a.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9b.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9c.xml"/>
      <arg line="simple/binding9d.xml simple.Customer9 simple9d.xml"/>
      <arg line="simple/binding9d.xml simple.Customer9 simple9e.xml"/>
      <arg line="simple/binding10.xml simple.Customer10 simple10.xml"/>
      <arg line="simple/binding10.xml simple.Customer10 simple10a.xml"/>
      <arg line="simple/mybinding1.xml simple.MyClass1 mytest1.xml"/>
      <arg line="simple/mybinding2.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2a.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2a.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2b.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2b.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2c.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2c.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding3.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3a.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3a.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3c.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3c.xml simple.MyClass3 mytest3d.xml"/>
      <arg line="simple/mybinding3d.xml simple.MyClass3 mytest3d.xml"/>
      <arg line="simple/mybinding3d.xml simple.MyClass3 mytest3e.xml"/>
<!--      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3c.xml"/> -->
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3g.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3h.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding5.xml simple.MyClass5 mytest5.xml"/>
      <arg line="simple/mybinding5.xml simple.MyClass5 mytest5a.xml"/>
      <arg line="simple/mybinding5a.xml simple.MyClass5 mytest5a.xml"/>
      <arg line="simple/mybinding5a.xml simple.MyClass5 mytest5b.xml"/>
      <arg line="simple/mybinding5b.xml simple.MyClass5 mytest5a.xml"/>
      <arg line="simple/mybinding5b.xml simple.MyClass5 mytest5b.xml"/>
      <arg line="simple/mybinding6.xml simple.MyClass6 mytest6.xml"/>
      <arg line="simple/mybinding6.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding6a.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding6a.xml simple.MyClass6 mytest6b.xml"/>
      <arg line="simple/mybinding6b.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding7.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7a.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7b.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7d.xml simple.MyClass7 mytest7b.xml"/>
      <arg line="simple/mybinding7d.xml simple.MyClass7 mytest7c.xml"/>
    </java>
    <java classname="org.jibx.match.TestLoaderStAX" fork="yes" dir="${simpledata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="simple/binding0.xml simple.Customer0 simple.xml"/>
      <arg line="simple/binding0b.xml simple.Customer0 simple.xml"/>
      <arg line="simple/binding0b.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding0c.xml simple.Customer0 simple0b.xml"/>
      <arg line="simple/binding0d.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding0d.xml simple.Customer0 simple0c.xml"/>
      <arg line="simple/binding2.xml simple.Customer2 simple2.xml"/>
      <arg line="simple/binding3.xml simple.Customer3 simple3.xml"/>
      <arg line="simple/binding3a.xml simple.Customer3 simple3.xml"/>
      <arg line="simple/binding3b.xml simple.Customer3 simple3b.xml"/>
      <arg line="simple/binding3d.xml simple.Customer3 simple3d.xml"/>
      <arg line="simple/binding3e.xml simple.Customer3 simple3c.xml"/>
      <arg line="simple/binding4.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4a.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4b.xml simple.Customer4 simple4b.xml"/>
      <arg line="simple/binding4c.xml simple.Customer4 simple4b.xml"/>
      <arg line="simple/binding4c.xml simple.Customer4 simple4c.xml"/>
      <arg line="simple/binding4e.xml simple.Customer4 simple4.xml"/>
      <arg line="simple/binding4e.xml simple.Customer4 simple4e.xml"/>
      <arg line="simple/binding5.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5a.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5b.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5c.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5c.xml simple.Customer5 simple5d.xml"/>
      <arg line="simple/binding5d.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5d.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5e.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding5e.xml simple.Customer5 simple5b.xml"/>
      <arg line="simple/binding5f.xml simple.Customer5 simple5.xml"/>
      <arg line="simple/binding6.xml simple.Customers6 simple6.xml"/>
      <arg line="simple/binding6a.xml simple.Customers6 simple6a.xml"/>
      <arg line="simple/binding6b.xml simple.Customers6 simple6a.xml"/>
      <arg line="simple/binding6c.xml simple.Customers6 simple6b.xml"/>
      <arg line="simple/binding7.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding7a.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7a.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding7b.xml simple.Customers7 simple7.xml"/>
      <arg line="simple/binding7b.xml simple.Customers7 simple7a.xml"/>
      <arg line="simple/binding8.xml simple.Customer8a simple8a.xml"/>
      <arg line="simple/binding8.xml simple.Customer8b simple8b.xml"/>
      <arg line="simple/binding8.xml simple.Customers8 simple8.xml"/>
      <arg line="simple/binding8a.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8b.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8c.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding8d.xml simple.Customers8 simple8d.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9.xml"/>
      <arg line="simple/binding9.xml simple.Subscriber9 simple9a.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9b.xml"/>
      <arg line="simple/binding9.xml simple.Customer9 simple9c.xml"/>
      <arg line="simple/binding10.xml simple.Customer10 simple10.xml"/>
      <arg line="simple/binding10.xml simple.Customer10 simple10a.xml"/>
      <arg line="simple/mybinding1.xml simple.MyClass1 mytest1.xml"/>
      <arg line="simple/mybinding2.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2a.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2a.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2b.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2b.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding2c.xml simple.MyClass2 mytest2.xml"/>
      <arg line="simple/mybinding2c.xml simple.MyClass2 mytest2a.xml"/>
      <arg line="simple/mybinding3.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3a.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3a.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3b.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3c.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3c.xml simple.MyClass3 mytest3d.xml"/>
      <arg line="simple/mybinding3d.xml simple.MyClass3 mytest3d.xml"/>
      <arg line="simple/mybinding3d.xml simple.MyClass3 mytest3e.xml"/>
<!--      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3e.xml simple.MyClass3 mytest3c.xml"/> -->
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3a.xml"/>
      <arg line="simple/mybinding3f.xml simple.MyClass3 mytest3c.xml"/>
      <arg line="simple/mybinding3g.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding3h.xml simple.MyClass3 mytest3.xml"/>
      <arg line="simple/mybinding5.xml simple.MyClass5 mytest5.xml"/>
      <arg line="simple/mybinding5.xml simple.MyClass5 mytest5a.xml"/>
      <arg line="simple/mybinding5a.xml simple.MyClass5 mytest5a.xml"/>
      <arg line="simple/mybinding5a.xml simple.MyClass5 mytest5b.xml"/>
      <arg line="simple/mybinding6.xml simple.MyClass6 mytest6.xml"/>
      <arg line="simple/mybinding6.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding6a.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding6a.xml simple.MyClass6 mytest6b.xml"/>
      <arg line="simple/mybinding6b.xml simple.MyClass6 mytest6a.xml"/>
      <arg line="simple/mybinding7.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7a.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7b.xml simple.MyClass7 mytest7.xml"/>
      <arg line="simple/mybinding7d.xml simple.MyClass7 mytest7c.xml"/>
    </java>
    <java classname="org.jibx.match.TestLoaderDiff" fork="yes"
        dir="${simpledata}" failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="simple/binding2b.xml simple.Customer2 simple2d.xml simple2c.xml"/>
      <arg line="simple/binding4a.xml simple.Customer4 simple4a.xml simple4.xml"/>
      <arg line="simple/binding4d.xml simple.Customer4 simple4d.xml simple4.xml"/>
      <arg line="simple/binding5.xml simple.Customer5 simple5a.xml simple5.xml"/>
      <arg line="simple/binding5a.xml simple.Customer5 simple5a.xml simple5.xml"/>
      <arg line="simple/binding5b.xml simple.Customer5 simple5a.xml simple5.xml"/>
      <arg line="simple/mybinding3.xml simple.MyClass3 mytest3b.xml mytest3a.xml"/>
      <arg line="simple/mybinding3a.xml simple.MyClass3 mytest3b.xml mytest3a.xml"/>
      <arg line="simple/mybinding3g.xml simple.MyClass3 mytest3f.xml mytest3.xml"/>
      <arg line="simple/mybinding3h.xml simple.MyClass3 mytest3f.xml mytest3.xml"/>
      <arg line="simple/mybinding3h.xml simple.MyClass3 mytest3g.xml mytest3.xml"/>
      <arg line="simple/mybinding6a.xml simple.MyClass6 mytest6c.xml mytest6b.xml"/>
      <arg line="simple/mybinding7c.xml simple.MyClass7 mytest7a.xml mytest7.xml"/>
    </java>
  </target>

  <!-- Run tests which use non-J2ME features. -->
  <target name="run-nonj2me-tests" unless="j2me-build">
    <echo message="Beginning non-J2ME specific tests"/>
    <java classname="org.jibx.match.TestLoader" fork="yes" dir="${simpledata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="simple/mybinding4.xml simple.MyClass4 mytest4.xml"/>
      <arg line="simple/mybinding4.xml simple.MyClass4 mytest4a.xml"/>
      <arg line="simple/mybinding4.xml simple.MyClass4 mytest4b.xml"/>
      <arg line="simple/mybinding4a.xml simple.MyClass4 mytest4.xml"/>
      <arg line="simple/mybinding4a.xml simple.MyClass4 mytest4a.xml"/>
      <arg line="simple/mybinding4a.xml simple.MyClass4 mytest4b.xml"/>
      <arg line="simple/mybinding4a.xml simple.MyClass4 mytest4c.xml"/>
      <arg line="simple/mybinding4b.xml simple.MyClass4 mytest4.xml"/>
      <arg line="simple/mybinding4b.xml simple.MyClass4 mytest4a.xml"/>
      <arg line="simple/mybinding4b.xml simple.MyClass4 mytest4b.xml"/>
      <arg line="simple/mybinding4b.xml simple.MyClass4 mytest4c.xml"/>
      <arg line="simple/mybinding4c.xml simple.MyClass4 mytest4.xml"/>
      <arg line="simple/mybinding4c.xml simple.MyClass4 mytest4d.xml"/>
    </java>
  </target>

  <!-- Run tests which use Java 5 features. -->
  <target name="run-java5-tests" if="java5">
    
    <!-- Compile the test code and copy resources. -->
    <echo message="Compiling the Java 5 specific code"/>
    <javac srcdir="${testsrc}"
      destdir="${testdest}"
      target="1.5"
      includes="org/jibx/match/**/*.java,java5/**/*.java"
      optimize="off"
      debug="on"
      source="1.5"
      deprecation="on">
      <classpath refid="tests-classpath"/>
    </javac>
    <copy todir="${testdest}">
      <fileset dir="${testsrc}" includes="**/*.xml,**/*.txt"/>
    </copy>
    
    <echo message="Beginning Java 5 specific tests"/>
    <java classname="org.jibx.match.TestLoader" fork="yes" dir="${java5data}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="java5/binding1.xml java5.Customer1 simple1.xml"/>
      <arg line="java5/binding2.xml java5.Customer2 simple2.xml"/>
    </java>
  </target>

  <!-- Test code from extras (except dom4j and jdom). -->
  <target name="run-extras-tests" depends="run-dom4j-tests,run-jdom-tests">
    
    <!-- Run extras binding tests directly. -->
    <echo message="Beginning extras bind on load test run"/>
    <java classname="org.jibx.match.TestLoader" fork="yes" dir="${extrasdata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="extras/binding0.xml extras.NameArray names0.xml"/>
      <arg line="extras/binding0.xml extras.NameArray names1.xml"/>
      <arg line="extras/binding1.xml extras.NameArray names0.xml"/>
      <arg line="extras/binding1.xml extras.NameArray names1.xml"/>
      <arg line="extras/binding2.xml extras.NameArray names0.xml"/>
      <arg line="extras/binding2.xml extras.NameArray names2.xml"/>
      <arg line="extras/binding3.xml extras.NameArray names0.xml"/>
      <arg line="extras/binding3.xml extras.NameArray names2.xml"/>
      <arg line="extras/binding3a.xml extras.NameArray names3.xml"/>
      <arg line="extras/binding3b.xml extras.NameArray names3b.xml"/>
      <arg line="extras/binding4.xml extras.TypedArray names1.xml"/>
      <arg line="extras/binding5.xml extras.TypedArray names1.xml"/>
      <arg line="extras/binding8.xml extras.ValueMap values0.xml"/>
      <arg line="extras/binding9.xml extras.ValueMap values1.xml"/>
      <arg line="extras/binding10.xml extras.QNameReference qnames1.xml"/>
      <arg line="extras/binding10.xml extras.QNameReference qnames2.xml"/>
      <arg line="extras/bindingdom0.xml extras.DomContact0 contact0.xml"/>
      <arg line="extras/bindingdom0.xml extras.DomContact0 contact1.xml"/>
      <arg line="extras/bindingdom0.xml extras.DomContact0 contact2.xml"/>
      <arg line="extras/bindingdom1.xml extras.DomContact1 contact0.xml"/>
      <arg line="extras/bindingdom1.xml extras.DomContact1 contact1.xml"/>
      <arg line="extras/bindingdom1.xml extras.DomContact1 contact2.xml"/>
      <arg line="extras/bindingdom2.xml extras.DomContact2 contact0.xml"/>
      <arg line="extras/bindingdom2.xml extras.DomContact2 contact1.xml"/>
      <arg line="extras/bindingdom2.xml extras.DomContact2 contact2.xml"/>
      <arg line="extras/bindingdom2.xml extras.DomContact2 contact3.xml"/>
      <arg line="extras/bindingdom3.xml extras.DomContact3 contact0.xml"/>
      <arg line="extras/bindingdom3.xml extras.DomContact3 contact1.xml"/>
      <arg line="extras/bindingdom3.xml extras.DomContact3 contact2.xml"/>
      <arg line="extras/bindingdom3.xml extras.DomContact3 contact3.xml"/>
    </java>
    <java classname="org.jibx.match.TestLoaderDiff" fork="yes"
        dir="${extrasdata}" failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="extras/binding6.xml extras.Contact0 contact0.xml contact0.xml"/>
      <arg line="extras/binding6.xml extras.Contact0 contact1.xml contact0.xml"/>
      <arg line="extras/binding6.xml extras.Contact0 contact2.xml contact0.xml"/>
      <arg line="extras/binding7.xml extras.Contact0 contact0.xml contact0.xml"/>
      <arg line="extras/binding7.xml extras.Contact0 contact1.xml contact0.xml"/>
      <arg line="extras/binding7.xml extras.Contact0 contact2.xml contact0.xml"/>
      <arg line="extras/binding7.xml extras.Contact0 contact3.xml contact0.xml"/>
    </java>
  </target>

  <!-- Run dom4j blackbox tests. -->
  <target name="run-dom4j-tests" if="dom4j">
    
    <!-- Now compile the test code and copy resources. -->
    <echo message="Compiling the test code"/>
    <javac srcdir="${testsrc}"
      destdir="${testdest}"
      target="${target}"
      includes="org/jibx/match/**/*.java,extras/Dom4J*.java"
      optimize="off"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath refid="tests-classpath"/>
    </javac>
    <copy todir="${testdest}">
      <fileset dir="${testsrc}" includes="**/*.xml,**/*.txt"/>
    </copy>
    
    <!-- Run the actual tests. -->
    <echo message="Beginning dom4j load test run"/>
    <java classname="org.jibx.match.TestLoader" fork="yes" dir="${extrasdata}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="extras/bindingdom4j0.xml extras.Dom4JContact0 contact0.xml"/>
      <arg line="extras/bindingdom4j0.xml extras.Dom4JContact0 contact1.xml"/>
      <arg line="extras/bindingdom4j0.xml extras.Dom4JContact0 contact2.xml"/>
      <arg line="extras/bindingdom4j1.xml extras.Dom4JContact1 contact0.xml"/>
      <arg line="extras/bindingdom4j1.xml extras.Dom4JContact1 contact1.xml"/>
      <arg line="extras/bindingdom4j1.xml extras.Dom4JContact1 contact2.xml"/>
      <arg line="extras/bindingdom4j2.xml extras.Dom4JContact2 contact0.xml"/>
      <arg line="extras/bindingdom4j2.xml extras.Dom4JContact2 contact1.xml"/>
      <arg line="extras/bindingdom4j2.xml extras.Dom4JContact2 contact2.xml"/>
      <arg line="extras/bindingdom4j2.xml extras.Dom4JContact2 contact3.xml"/>
    </java>
  </target>

  <!-- Run jdom blackbox tests. -->
  <target name="run-jdom-tests" if="jdom">
    
    <!-- Now compile the test code and copy resources. -->
    <echo message="Compiling the test code"/>
    <javac srcdir="${testsrc}"
      destdir="${testdest}"
      includes="org/jibx/match/**/*.java,extras/JDOM*.java"
      optimize="off"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath refid="tests-classpath"/>
    </javac>
    <copy todir="${testdest}">
      <fileset dir="${testsrc}" includes="**/*.xml,**/*.txt"/>
    </copy>
    
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
    </taskdef>
    <bind>
      <classpathset dir="${testdest}"/>
      <bindingfileset dir="${extrasdata}">
        <include name="bindingjdom*.xml"/>
      </bindingfileset>
    </bind>
  	
    <!-- Run the actual tests. -->
    <echo message="Beginning jdom junit test run"/>
    <junit haltonfailure="true">
      <classpath refid="tests-classpath"/>
      <formatter type="brief" usefile="false"/>
      <batchtest fork="yes" todir="${testdest}">
        <fileset dir="${testsrc}">
          <include name="**/JDOM*Test.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <!-- Compile tutorial code samples. -->
  <target name="compile-tutorial">
    <echo message="Compiling the tutorial examples"/>
    <javac srcdir="${tutorial}"
      destdir="${testdest}"
      target="${target}"
      includes="**/*.java"
      optimize="off"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath refid="tests-classpath"/>
    </javac>
  </target>

  <!-- Test tutorial code (except example21, which may not work on all JVMs). -->
  <target name="run-tutorial-tests" depends="run-tutorial-example21">
    
    <!-- Add the bindings for tutorial examples. -->
    <echo message="Beginning tutorial binding compiler run"/>
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
    </taskdef>
    <bind>
      <classpathset dir="${testdest}"/>
      <bindingfileset dir="${tutorial}">
        <include name="example1/binding.xml"/>
        <include name="example2/binding.xml"/>
        <include name="example3/binding.xml"/>
        <include name="example5/binding.xml"/>
        <include name="example6/binding.xml"/>
        <include name="example7/binding.xml"/>
        <include name="example8/binding.xml"/>
        <include name="example9/binding.xml"/>
        <include name="example10/binding.xml"/>
        <include name="example11/binding.xml"/>
        <include name="example12/binding.xml"/>
        <include name="example13/binding.xml"/>
        <include name="example14/binding.xml"/>
        <include name="example15/binding.xml"/>
        <include name="example16/binding.xml"/>
        <include name="example17/binding.xml"/>
        <include name="example18/binding.xml"/>
        <include name="example19/binding.xml"/>
        <include name="example20/binding.xml"/>
        <include name="example22/binding0.xml"/>
        <include name="example22/binding1.xml"/>
        <include name="example22/binding2.xml"/>
      </bindingfileset>
    </bind>
    
    <!-- Run the tutorial example tests. -->
    <echo message="Beginning tutorial examples test run"/>
    <java classname="org.jibx.extras.TestRoundtrip" fork="yes" dir="${tutorial}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="example1.Customer example1/data.xml example1/data.xml"/>
      <arg line="example2.Customer example2/data.xml example2/data.xml"/>
      <arg line="example3.Customer example3/data.xml example3/out.xml"/>
      <arg line="example5.Customer example5/data.xml example5/data.xml"/>
      <arg line="example6.Customer example6/data.xml example6/data.xml"/>
      <arg line="example7.Customer example7/data.xml example7/out.xml"/>
      <arg line="example8.TimeTable example8/data.xml example8/data.xml"/>
      <arg line="example9.TimeTable example9/data.xml example9/data.xml"/>
      <arg line="example10.TimeTable example10/data.xml example10/data.xml"/>
      <arg line="example11.TimeTable example11/data.xml example11/data.xml"/>
      <arg line="example12.Customer example12/data.xml example12/data.xml"/>
      <arg line="example13.Customer example13/data.xml example13/data.xml"/>
      <arg line="example14.Customer example14/data1.xml example14/data1.xml"/>
      <arg line="example14.Subscriber example14/data2.xml example14/data2.xml"/>
      <arg line="example14.Customer example14/data3.xml example14/data3.xml"/>
      <arg line="example15.Customer example15/data1.xml example15/data1.xml"/>
      <arg line="example15.Subscriber example15/data2.xml example15/data2.xml"/>
      <arg line="example15.Customer example15/data3.xml example15/data3.xml"/>
      <arg line="example16.Customer example16/data1.xml example16/data1.xml"/>
      <arg line="example16.Customer example16/data2.xml example16/data2.xml"/>
      <arg line="example17.Customer example17/data1.xml example17/data1.xml"/>
      <arg line="example17.Customer example17/data2.xml example17/data2.xml"/>
      <arg line="example17.Customer example17/data3.xml example17/data3.xml"/>
      <arg line="example18.Customer example18/data.xml example18/data.xml"/>
      <arg line="example19.Order example19/data.xml example19/data.xml"/>
      <arg line="example20.Customer example20/data.xml example20/data.xml"/>
    </java>
    <java classname="example22.Test" fork="yes" dir="${tutorial}/example22"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg value="data0.xml"/>
    </java>
    <java classname="example22.Test" fork="yes" dir="${tutorial}/example22"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg value="data1.xml"/>
    </java>
    <java classname="example22.Test" fork="yes" dir="${tutorial}/example22"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg value="data2.xml"/>
    </java>
  </target>

  <!-- Test example21, which may not work on all JVMs. -->
  <target name="run-tutorial-example21" depends="compile-tutorial" unless="skip21">
    
    <!-- Add the bindings for example21. -->
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
      <classpath>
        <fileset dir="${lib}" includes="*.jar"/>
      </classpath>
    </taskdef>
    <bind>
      <classpathset dir="${testdest}"/>
      <bindingfileset dir="${tutorial}">
        <include name="example21/binding1.xml"/>
      </bindingfileset>
    </bind>
    
    <!-- Run the example21 tests. -->
    <java classname="org.jibx.extras.TestRoundtrip" fork="yes" dir="${tutorial}"
        failonerror="true">
      <classpath refid="tests-classpath"/>
      <arg line="example21.Directory example21/data1.xml example21/data1.xml"/>
    </java>
  </target>

  <!-- Build the user javadocs -->
  <target name="javadoc">
    <delete quiet="true">
      <fileset dir="${userdocs}" includes="*"/>
    </delete>
    <mkdir dir="${userdocs}"/>
    <javadoc packagenames="org.jibx.runtime,org.jibx.runtime.impl,org.jibx.extras"
       sourcepath="${src}:${extrassrc}"
       destdir="${userdocs}"
       author="true"
       version="true"
       noindex="true"
       nohelp="true"
       notree="true"
       access="public"
       windowtitle="${project} - Version ${version}"
       doctitle="${project} - Version ${version}"
       >
       <bottom>&lt;table width='80%%'&gt;&lt;tr&gt;&lt;td width='50%%'&gt;&lt;p align='center'&gt;&lt;a href='http://www.jibx.org/' target='_top'&gt;&lt;font size='3'&gt;&lt;b&gt;Project Web Site&lt;/b&gt;&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;&lt;td width='50%%'&gt;&lt;p align='center'&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</bottom>
      <classpath refid="javadoc-classpath"/>
    </javadoc>
  </target>

  <!-- Build the internal javadocs -->
  <target name="devdoc">
    <delete quiet="true">
      <fileset dir="${devdocs}" includes="*"/>
    </delete>
    <mkdir dir="${devdocs}"/>
    <javadoc packagenames="org.jibx.runtime,org.jibx.runtime.impl,org.jibx.binding,org.jibx.binding.def,org.jibx.binding.classes,org.jibx.extras"
       sourcepath="${src}:${extrassrc}"
       destdir="${devdocs}"
       author="true"
       version="true"
       noindex="true"
       nohelp="true"
       notree="true"
       access="private"
       windowtitle="${project} - Version ${version}"
       doctitle="${project} - Version ${version}"
       >
       <bottom>&lt;table width='80%%'&gt;&lt;tr&gt;&lt;td width='50%%'&gt;&lt;p align='center'&gt;&lt;a href='http://www.jibx.org/' target='_top'&gt;&lt;font size='3'&gt;&lt;b&gt;Project Web Site&lt;/b&gt;&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;&lt;td width='50%%'&gt;&lt;p align='center'&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</bottom>
      <classpath refid="javadoc-classpath"/>
    </javadoc>
  </target>

  <!-- Build only the binding class file jar -->
  <target name="jar-bind" depends="clean-bind,compile-bind">
    <delete file="${lib}/${bindname}.jar" quiet="true"/>
    <jar jarfile="${lib}/${bindname}.jar" basedir="${binddest}"
      includes="org/jibx/binding/*.class,org/jibx/binding/ant/*.class,org/jibx/binding/classes/*.class,org/jibx/binding/def/*.class,org/jibx/binding/model/*.class,org/jibx/binding/util/*.class,org/jibx/util/**/*.class">
      <manifest>
        <attribute name="Main-Class" value="org/jibx/binding/Compile"/>
        <attribute name="Class-Path" value="bcel.jar ${runname}.jar xpp3.jar stax-api.jar wstx-asl.jar"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
  </target>

  <!-- Build only the Jibx2Wsdl jar -->
  <target name="jar-jibx2wsdl" depends="clean-bind,compile-bind" unless="j2me-build">
    <delete file="${lib}/${jibx2wsdlname}.jar" quiet="true"/>
    <copy file="${build}/default-log4j.properties"
        tofile="${binddest}/log4j.properties"/>
    <jar jarfile="${lib}/${jibx2wsdlname}.jar" basedir="${binddest}"
      includes="org/jibx/binding/generator/*.class,org/jibx/schema/**/*.class,org/jibx/custom/**/*.class,org/jibx/ws/**/*.class,log4j.properties">
      <manifest>
        <attribute name="Main-Class" value="org/jibx/ws/wsdl/Jibx2Wsdl"/>
        <attribute name="Class-Path" value="bcel.jar ${runname}.jar ${bindname}.jar xpp3.jar stax-api.jar wstx-asl.jar qdox-1.6.1.jar"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
  </target>

  <!-- Build only the runtime class file jar -->
  <target name="jar-run" depends="clean-run,compile-run">
    <delete file="${lib}/${runname}.jar" quiet="true"/>
    <jar jarfile="${lib}/${runname}.jar" basedir="${rundest}"
      includes="org/jibx/runtime/**/*.class">
      <manifest>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
  </target>

  <!-- Build only the extras class file jar -->
  <target name="jar-extras" depends="clean-extras,compile-extras">
    <delete file="${lib}/${extrasname}.jar" quiet="true"/>
    <jar jarfile="${lib}/${extrasname}.jar" basedir="${extrasdest}"
      includes="org/jibx/extras/**/*.class">
      <manifest>
        <attribute name="Main-Class" value="org/jibx/extras/TestRoundtrip"/>
        <attribute name="Class-Path" value="${runname}.jar xpp3.jar stax-api.jar wstx-asl.jar"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
  </target>

  <!-- Build the zip file for distribution -->
  <target name="zip-distrib">
    <delete file="${root}/${distribname}.zip" quiet="true"/>
    <zip zipfile="${root}/${distribname}.zip">
      <zipfileset prefix="jibx" dir="${root}" includes="**/*"
          excludes="*.zip,**/CVS,**/.*,lib/asm*.jar,lib/jibx-javatools.jar,lib/dom4j*.jar,lib/xercesImpl.jar,lib/xml-apis.jar,lib/jdom*.jar,lib/jibx-gen*.jar,lib/org.eclipse*.jar,build/classes/**/*,build/docs/**/*,build/temp.xml,**/.*,**/*.launch,build/**/*.txt,build/src/org/jibx/schema/typeinfo/**/*,build/src/org/jibx/schema/codegen/classes/**/*,build/src/org/jibx/schema/codegen/datamodel/**/*,org/jibx/binding/schema*/**/*.java,build/src/org/jibx/binding/bindgen/**/*,**/*.log"/>
    </zip>
  </target>
  
  <!-- Build the jar files for the generator tools -->
  <target name="jar-tools" depends="disablej2me,setdebug">
    <delete file="${lib}/jibx-genbinding.jar" quiet="true"/>
    <delete file="${lib}/jibx-genschema.jar" quiet="true"/>
    <delete quiet="true" dir="${toolsdest}"/>
    <mkdir dir="${toolsdest}"/>
    <javac srcdir="${src}"
      sourcepath=""
      destdir="${toolsdest}"
      target="${target}"
      includes="org/jibx/binding/BindingGenerator.java"
      optimize="${optimize}"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath>
        <fileset dir="${lib}" includes="*.jar" excludes="asm*.jar,${extrasname}.jar,org.eclipse.*.jar,jibx-genbinding.jar,jibx-genschema.jar"/>
      </classpath>
    </javac>
    <jar jarfile="${lib}/jibx-genbinding.jar" basedir="${toolsdest}">
      <manifest>
        <attribute name="Main-Class" value="org/jibx/binding/BindingGenerator"/>
        <attribute name="Class-Path" value="${bindname}.jar ${runname}.jar ${extrasname}.jar bcel.jar xpp3.jar stax-api.jar wstx-asl.jar qdox-1.6.1.jar"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
    <delete quiet="true" dir="${toolsdest}"/>
    <mkdir dir="${toolsdest}"/>
    <javac srcdir="${src}"
      sourcepath=""
      destdir="${toolsdest}"
      target="${target}"
      includes="org/jibx/binding/SchemaGenerator.java"
      optimize="${optimize}"
      debug="on"
      source="${source}"
      deprecation="on">
      <classpath>
        <fileset dir="${lib}" includes="*.jar" excludes="asm*.jar,${extrasname}.jar,org.eclipse.*.jar,jibx-genbinding.jar,jibx-genschema.jar"/>
      </classpath>
    </javac>
    <jar jarfile="${lib}/jibx-genschema.jar" basedir="${toolsdest}">
      <manifest>
        <attribute name="Main-Class" value="org/jibx/binding/SchemaGenerator"/>
        <attribute name="Class-Path" value="${bindname}.jar ${runname}.jar ${extrasname}.jar bcel.jar xpp3.jar stax-api.jar wstx-asl.jar qdox-1.6.1.jar"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
    </jar>
  </target>
  
  <!-- Copy jar files to maven1 repository (only usable by developers - with
    sourceforge user name substitution), and requires jsch.jar in Ant lib
    directory) -->
  <target name="maven1" depends="basenames">
    <scp keyfile="${user.home}/.ssh/id_dsa" passphrase="" localFile="${lib}/${bindname}.jar" remoteToFile="dsosnoski@jibx.sourceforge.net:/home/groups/j/ji/jibx/htdocs/maven/jibx/jars/${bindname}-${version}.jar"/>
    <scp keyfile="${user.home}/.ssh/id_dsa" passphrase="" localFile="${lib}/${runname}.jar" remoteToFile="dsosnoski@jibx.sourceforge.net:/home/groups/j/ji/jibx/htdocs/maven/jibx/jars/${runname}-${version}.jar"/>
    <scp keyfile="${user.home}/.ssh/id_dsa" passphrase="" localFile="${lib}/${extrasname}.jar" remoteToFile="dsosnoski@jibx.sourceforge.net:/home/groups/j/ji/jibx/htdocs/maven/jibx/jars/${extrasname}-${version}.jar"/>
<!--    <scp keyfile="${user.home}/.ssh/id_dsa" passphrase="" localFile="${lib}/${jibx2wsdlname}.jar" remoteToFile="dsosnoski@jibx.sourceforge.net:/home/groups/j/ji/jibx/htdocs/maven/jibx/jars/${jibx2wsdlname}-${version}.jar"/>  -->
  </target>
  
  <!-- Test run targets, used during normal build steps -->
  <target name="run-basic-blackbox" depends="set-tests-classpath,clean-tests,prepare-tests,run-multiple-tests,run-single-tests,run-nonj2me-tests,run-java5-tests,run-extras-tests,clean-tests"/>
  <target name="run-blackbox" depends="set-tests-classpath,clean-tests,prepare-tests,run-multiple-tests,run-single-tests,run-nonj2me-tests,run-java5-tests,run-extras-tests,compile-tutorial,run-tutorial-tests,clean-tests"/>
  
  <!-- Targets for running blackbox tests on framework - these should be run
    only after building the code using the "current" target, but are not
    dependent on it to allow selective testing (modify test code or documents
    between test runs, etc.). -->
  <target name="test-tutorial" depends="basenames,set-tests-classpath,clean-tests,compile-tutorial,run-tutorial-tests,clean-tests"/>
  <target name="test-multiples" depends="basenames,set-tests-classpath,clean-tests,prepare-tests,run-multiple-tests,clean-tests"/>
  <target name="test-singles" depends="basenames,set-tests-classpath,clean-tests,prepare-tests,run-single-tests,run-nonj2me-tests,run-java5-tests,clean-tests"/>
  <target name="test-extras" depends="basenames,set-tests-classpath,clean-tests,prepare-tests,run-extras-tests,clean-tests"/>
  <target name="basic-blackbox" depends="basenames,run-basic-blackbox"/>
  <target name="blackbox" depends="basenames,run-blackbox"/>

  <!-- Targets for building the framework. -->
  <target name="clean" depends="clean-run,clean-bind,clean-extras"/>
  <target name="build-jibx" depends="clean,compile-run,compile-bind,compile-extras"/>
  <target name="debug" depends="setdebug,build-jibx"/>
  <target name="develop" depends="debug,devdoc"/>
  <target name="tojars" depends="build-jibx,jar-run,jar-bind,jar-extras"/>
  <target name="current" depends="disablej2me,setdebug,tojars"/>
  <target name="testing" depends="current,blackbox"/>
  <target name="small-jars" depends="disablej2me,setrelease,tojars"/>
  <target name="distrib" depends="current,run-blackbox,javadoc,zip-distrib"/>
  <target name="j2me" depends="enablej2me,setrelease,tojars,run-blackbox,disablej2me"/>
  
</project>
