<project name="remotecontrol" default="dist" basedir=".">
<!-- compilation properties -->
    <property name="josm.build.dir"   value="../../core"/>
    <property name="josm.home.dir"    value="${user.home}/.josm"/>
    <property name="josm"         location="../../core/dist/josm-custom.jar" />
    <property name="plugin.build.dir" value="build"/>
    <property name="plugin.dist.dir"  value="../../dist"/>
    <property name="plugin.name"      value="${ant.project.name}"/>
    <property name="plugin.jar"       value="../../dist/${plugin.name}.jar"/>
    <property name="ant.build.javac.target" value="1.5"/>
    <target name="init">
        <mkdir dir="${plugin.build.dir}"/>
    </target>
    <target name="compile" depends="init">
        <echo message="creating ${plugin.jar}"/>
        <javac srcdir="src" classpath="${josm}" destdir="build" debug="true">
            <include name="**/*.java" />
        </javac>
    </target>
    <target name="dist" depends="compile">
        <copy todir="${plugin.build.dir}/images">
            <fileset dir="images"/>
        </copy>
        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
            <env key="LANG" value="C"/>
            <arg value="info"/>
            <arg value="--xml"/>
            <arg value="."/>
        </exec>
        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
        <delete file="REVISION"/>
        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
            <manifest>
                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.remotecontrol.RemoteControlPlugin"/>
                <attribute name="Plugin-Description" value="A plugin allowing other applications to send commands to JOSM." />
                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
                <attribute name="Plugin-Mainversion" value="1180"/>
                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
                <attribute name="Author" value="Frederik Ramm &lt;frederik@remote.org&gt;"/>
            </manifest>
        </jar>
    </target>
    <target name="clean">
        <delete dir="${plugin.build.dir}" />
        <delete file="${plugin.jar}" />
    </target>
    <target name="install" depends="dist">
        <copy file="${plugin.jar}" todir="${user.home}/.josm/plugins"/>
    </target>
    <target name="test" depends="install">
        <java jar="${josm}" fork="true"/>
    </target>
</project>
