<?xml version="1.0"?>
<project name="spring-oxm-maven2-targets" default="generate-test-sources">

    <condition property="skip">
        <equals arg1="${maven.test.skip}" arg2="true"/>
    </condition>

    <property name="schema" value="${basedir}/src/test/resources/org/springframework/oxm/flight.xsd"/>
    <property name="generate.target.directory" value="${basedir}/target/generated-sources/test/java"/>

    <target name="generate-test-sources" depends="generate-test-jaxb">
        <copy todir="${basedir}/target/test-classes">
            <fileset dir="${generate.target.directory}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <target name="generate-test-init">
        <mkdir dir="${generate.target.directory}"/>
    </target>

    <target name="generate-test-jaxb" depends="generate-test-init" unless="skip">
        <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"
                 classpathref="maven.test.classpath"/>
        <xjc destdir="${generate.target.directory}"
             package="org.springframework.oxm.jaxb2"
             schema="${schema}">
            <produces dir="${generate.target.directory}" includes="**/*.java"/>
        </xjc>
    </target>

</project>
