<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<project name="xjctest" default="test" basedir=".">

    <target name="test">
        <echoproperties/>
    </target>

    <target name="init">
        <property name="libs.folder" value="${bin.folder}/lib"/>
        <property name="xjctask.libs.folder" value="${bin.folder}/xjctask-cp"/>
        <property name="lib.dir" value="lib"/>
        <property name="build.dir" value="build"/>
        <property name="src.dir" value="src"/>
        <property name="schema" value="simple.xsd"/>
    </target>

    <target name="setup" depends="init">
        <mkdir dir="${lib.dir}"/>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${src.dir}"/>
        <copy todir="${lib.dir}">
            <fileset dir="${libs.folder}"/>
        </copy>
        <path id="task.cp">
            <pathelement location="${bin.folder}/classes"/>
            <fileset dir="${lib.dir}"/>
            <fileset dir="${xjctask.libs.folder}"/>
        </path>
    </target>

    <target name="xjc-init" depends="setup">
        <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
            <classpath refid="task.cp"/>
        </taskdef>
    </target>

    <target name="xjc-fork" depends="xjc-init">
        <echo message="Compiling the schema..."/>
        <xjc schema="${schema}" package="simple" destdir="${build.dir}" fork="true">
            <produces dir="${build.dir}/simple" includes="**/*.java"/>
            <!--<jvmarg line="- -add-modules jakarta.activation"/>-->
        </xjc>
    </target>

    <target name="xjc-no-fork" depends="xjc-init">
        <echo message="Compiling the schema..."/>
        <xjc schema="${schema}" package="simple" destdir="${build.dir}" fork="false">
            <produces dir="${build.dir}/simple" includes="**/*.java"/>
            <!--<jvmarg line="- -add-modules jakarta.activation"/>-->
        </xjc>
    </target>

    <target name="xjc-addmodules"/>

    <target name="clean">
        <delete dir="${src.dir}" verbose="true" failonerror="false"/>
        <delete dir="${build.dir}" verbose="true" failonerror="false"/>
        <delete dir="${lib.dir}" verbose="true" failonerror="false"/>
    </target>

</project>
