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

<!-- Mmmm Ok... so this is the Vermilion Ant script. Ant seems like a great idea
but editing this file seems a pretty crap way to set up my build process. -->

<project name="Vermilion" default="default" basedir=".">
    <description>Builds, tests, and runs the project Vermilion plus plugins and copies the builds to the Vermilion plugins directory.</description>
    <import file="nbproject/build-impl.xml"/>
    <import file="nbproject/profiler-build-impl.xml"/>

    <!--
    TODO: Get this working and use this instead of manually running tasks.
    <target name="-post-compile">
        <ant dir="${basedir}/../VermilionDesktop/nbproject" antfile="build-impl.xml"></ant>
    </target>
    -->

    <target name="-post-compile">

        <!-- Vermilion.SampleBank -->
        <echo message="Cleaning Vermilion.SampleBank..."/>
        <delete quiet="true">
            <fileset dir="${basedir}/../Vermilion.SampleBank/build/classes/vermilion" includes="**/*.class"/>
            <fileset dir="${basedir}/../Vermilion.SampleBank/dist" includes="**/*.jar"/>
        </delete>

        <echo message="Building Vermilion.SampleBank..."/>
        <mkdir dir="${basedir}/../Vermilion.SampleBank/build/classes"/>
        <javac  srcdir="${basedir}/../Vermilion.SampleBank/src"
                destdir="${basedir}/../Vermilion.SampleBank/build/classes"
                classpath="${basedir}/build/classes;${basedir}/libraries/RelativeLayout.jar;${basedir}/libraries/JSSPF.jar"
                debug="on"
                source="1.6">
        </javac>

        <echo message="JARing Vermilion.SampleBank..."/>
        <mkdir dir="${basedir}/../Vermilion.SampleBank/dist"/>
        <jar    destfile="${basedir}/../Vermilion.SampleBank/dist/Vermilion.SampleBank.jar"
                basedir="${basedir}/../Vermilion.SampleBank/build/classes">
        </jar>



        <!-- VermilionDesktop -->
        <echo message="Cleaning VermilionDesktop..."/>
        <delete quiet="true">
            <fileset dir="${basedir}/../VermilionDesktop/build/classes/vermilion" includes="**/*.class"/>
            <fileset dir="${basedir}/../VermilionDesktop/dist" includes="**/*.jar"/>
        </delete>

        <echo message="Building VermilionDesktop..."/>
        <mkdir dir="${basedir}/../VermilionDesktop/build/classes"/>
        <javac  srcdir="${basedir}/../VermilionDesktop/src"
                destdir="${basedir}/../VermilionDesktop/build/classes"
                classpath="${basedir}/build/classes;${basedir}/../Vermilion.SampleBank/dist/Vermilion.SampleBank.jar;${basedir}/libraries/RelativeLayout.jar;${basedir}/libraries/JSSPF.jar"
                debug="on"
                source="1.6">
        </javac>

        <echo message="JARing VermilionDesktop..."/>
        <mkdir dir="${basedir}/../VermilionDesktop/dist"/>
        <jar    destfile="${basedir}/../VermilionDesktop/dist/VermilionDesktop.jar"
                basedir="${basedir}/../VermilionDesktop/build/classes">
        </jar>



        <!-- VermilionDesktop.Machines -->
        <echo message="Cleaning VermilionDesktop.Machines..."/>
        <delete quiet="true">
            <fileset dir="${basedir}/../VermilionDesktop.Machines/build/classes/vermilion" includes="**/*.class"/>
        </delete>

        <echo message="Building VermilionDesktop.Machines..."/>
        <mkdir dir="${basedir}/../VermilionDesktop.Machines/build/classes"/>
        <javac  srcdir="${basedir}/../VermilionDesktop.Machines/src"
                destdir="${basedir}/../VermilionDesktop.Machines/build/classes"
                classpath="${basedir}/build/classes;${basedir}/../Vermilion.SampleBank/dist/Vermilion.SampleBank.jar;${basedir}/../VermilionDesktop/dist/VermilionDesktop.jar;${basedir}/libraries/RelativeLayout.jar;${basedir}/libraries/JSSPF.jar"
                debug="on"
                source="1.6">
      	</javac>



        <!-- VermilionDesktopComposer -->
        <echo message="Cleaning VermilionDesktopComposer..."/>
        <delete quiet="true">
            <fileset dir="${basedir}/../VermilionDesktopComposer/build/classes/vermilion" includes="**/*.class"/>
            <fileset dir="${basedir}/../VermilionDesktopComposer/dist" includes="**/*.jar"/>
        </delete>

        <echo message="Building VermilionDesktopComposer..."/>
        <mkdir dir="${basedir}/../VermilionDesktopComposer/build/classes"/>
        <javac  srcdir="${basedir}/../VermilionDesktopComposer/src"
                destdir="${basedir}/../VermilionDesktopComposer/build/classes"
                classpath="${basedir}/build/classes;${basedir}/../VermilionDesktop/dist/VermilionDesktop.jar;${basedir}/libraries/RelativeLayout.jar;${basedir}/libraries/JSSPF.jar"
                debug="on"
                source="1.6">
      	</javac>

        <echo message="JARing VermilionDesktopComposer..."/>
        <mkdir dir="${basedir}/../VermilionDesktopComposer/dist"/>
        <jar    destfile="${basedir}/../VermilionDesktopComposer/dist/VermilionDesktopComposer.jar"
                basedir="${basedir}/../VermilionDesktopComposer/build/classes">
      	</jar>



        <!-- Collecting Plugins -->
        <echo message="Collecting Plugins..."/>
        <copy   file="${basedir}/../VermilionDesktop/dist/VermilionDesktop.jar"
                tofile="${basedir}/plugins/VermilionDesktop.jar">
        </copy>

        <copy   file="${basedir}/../VermilionDesktopComposer/dist/VermilionDesktopComposer.jar"
                tofile="${basedir}/plugins/VermilionDesktopComposer.jar">
        </copy>

        <copy   file="${basedir}/../Vermilion.SampleBank/dist/Vermilion.SampleBank.jar"
                tofile="${basedir}/plugins/Vermilion.SampleBank.jar">
        </copy>

        <copy   todir="${basedir}/plugins">
            <fileset dir="${basedir}/../VermilionDesktop.Machines/build/classes"/>
        </copy>
    </target>
</project>
