<project name="MailUtilities" default="all">

    <target name="setProps" unless="setProps">
        <property environment="env"/>
        <property name="next_root" value="${env.NEXT_ROOT}"/>
        <property name="local_fw_root" value="${next_root}/Local/Library/Frameworks"/>
        <property name="fw_root" value="${next_root}/Library/Frameworks"/>

        <property name="fw_install_dir" value="../../dist/Frameworks"/>

    </target>

    <target name="init" depends="setProps" description="initialize properties">
        <tstamp/>
        <property name="build_dir" value="classes"/>

    </target>

    <target name="clean" depends="init" description="remove derived files and directories">
        <delete dir="${build_dir}"/>
        <ant dir="${basedir}/../MailJava" target="clean">
            <property name="setProps" value="true"/>
        </ant>
        <delete dir="${fw_install_dir}/${ant.project.name}.framework"/>

    </target>

    <target name="prepare" depends="init" description="prepare the output directories">
        <mkdir dir="${build_dir}"/>
        <ant dir="${basedir}/../MailJava" target="package">
            <property name="setProps" value="true"/>
        </ant>

    </target>

    <target name="compile" depends="prepare" description="compile the java source">
        <path id="classpath">
            <pathelement location="${fw_root}/JavaFoundation.framework/Resources/Java/javafoundation.jar"/>
            <pathelement location="${fw_root}/JavaEOControl.framework/Resources/Java/javaeocontrol.jar"/>
            <pathelement location="${fw_root}/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar"/>
            <pathelement location="${fw_root}/JavaWebObjects.framework/Resources/Java/javawebobjects.jar"/>
            <pathelement location="${fw_install_dir}/MailJava.framework/Resources/Java/activation.jar"/>
            <pathelement location="${fw_install_dir}/MailJava.framework/Resources/Java/mail.jar"/>

        </path>
        <javac srcdir="./src" destdir="${build_dir}">
            <classpath refid="classpath"/>
        </javac>
    </target>

    <target name="package" depends="compile" description="create framework">
        <taskdef name="woframework" classname="org.objectstyle.woproject.ant.WOFramework"/>
        <woframework name="${ant.project.name}" destDir="${fw_install_dir}">
            <classes dir="${build_dir}"/>
        </woframework>

    </target>

    <target name="all" depends="clean,package">
    </target>
</project>