<project name="surveyor" default="dist" basedir=".">
    <property name="josm"                   location="../../core/dist/josm-custom.jar" />
    <property name="plugin.dist.dir"        value="../../dist"/>
    <property name="plugin.build.dir"       value="build"/>
    <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    <property name="livegpsplugin.jar"      value="${plugin.dist.dir}/livegps.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" destdir="${plugin.build.dir}" debug="true">
            <compilerarg value="-Xlint:deprecation"/>
            <compilerarg value="-Xlint:unchecked"/>
            <classpath>
                <pathelement location="${josm}"/>
                <pathelement location="${livegpsplugin.jar}"/>
            </classpath>
        </javac>
    </target>
    <target name="dist" depends="compile">
        <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"/>
        <copy todir="${plugin.build.dir}/">
            <fileset dir="resources">
                <include name="*.xml"/>
                <include name="audio/*"/>
            </fileset>
        </copy>
        <copy todir="${plugin.build.dir}/images" >
            <fileset dir="images" />
        </copy>
        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
            <manifest>
                <attribute name="Plugin-Class" value="at.dallermassl.josm.plugin.surveyor.SurveyorPlugin" />
                <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions." />
                <attribute name="Plugin-Stage" value="60" />
                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
                <attribute name="Plugin-Mainversion" value="1326" />
                <attribute name="Plugin-Requires" value="livegps" />
            </manifest>
        </jar>
    </target>
    <target name="clean">
        <delete dir="${plugin.build.dir}" />
        <delete file="${plugin.jar}" />
    </target>
</project>
