<project name="livegps" default="dist" basedir=".">
<!-- josm "user home" directory depends on the platform used (windows has a different place than unix/linux) -->
    <property environment="env"/>
    <condition property="josm.home.dir" value="${env.APPDATA}/JOSM" else="${user.home}/.josm">
        <and>
            <os family="windows"/>
        </and>
    </condition>
<!-- compilation properties -->
<!--<property name="josm.build.dir"   value="../../JOSM/"/> -->
    <property name="josm.build.dir"   value="../../core/"/>
    <property name="josm.plugins.dir" value="${josm.home.dir}/plugins"/>
    <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="plugin.jar" value="../../dist/${plugin.name}.jar"/>
    <property name="livegpsplugin.jar" value="${josm.home.dir}/plugins/livegps.jar"/>
<!-- plugin meta data (enter new version number if anything changed!) -->
    <property name="plugin.description" value="Allow live GPS feed from a gpsd server (V${plugin.version})."/>
    <property name="plugin.stage" value="50"/>
    <property name="plugin.class" value="livegps.LiveGpsPlugin"/>
<!-- update site meta data -->
    <property name="plugin.site.file" value="josm-site.xml"/>
    <property name="plugin.site.description" value="Josm's LiveGps Update Site"/>
    <property name="plugin.site.url" value="http://www.tegmento.org/~cdaller/josm/livegps/"/>
    <property name="plugin.site.upload.target" value="cdaller@www.tegmento.org:public_html/josm/livegps/"/>
    <property name="ant.build.javac.target" value="1.5"/>
    <target name="init">
        <mkdir dir="${plugin.build.dir}"/>
    </target>
    <target name="dist" depends="compile">
<!-- images -->
        <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"/>
<!-- create jar file -->
        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
            <manifest>
                <attribute name="Plugin-Class" value="${plugin.class}" />
                <attribute name="Plugin-Description" value="${plugin.description}" />
                <attribute name="Plugin-Mainversion" value="1180" />
                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
<!--attribute name="Plugin-Dependencies" value="org.eigenheimstrasse.josm" /-->
                <attribute name="Plugin-Stage" value="${plugin.stage}" />
            </manifest>
        </jar>
    </target>
    <target name="compile" depends="init">
        <javac srcdir="livegps" destdir="${plugin.build.dir}" debug="true" source="1.5" target="1.5">
            <compilerarg value="-Xlint:deprecation"/>
            <classpath>
                <pathelement path="${josm.build.dir}/build"/>
                <fileset dir="${josm.build.dir}/lib">
                    <include name="../core/build/josm.jar"/>
                    <include name="**/*.jar"/>
                </fileset>
                <pathelement location="${plugin.jar}"/>
            </classpath>
        </javac>
    </target>
    <target name="install" depends="dist">
        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
        <copy file="liveGPS.conf" todir="${josm.plugins.dir}/livegps/" />
    </target>
    <target name="clean">
        <delete dir="${plugin.build.dir}" />
        <delete file="${plugin.jar}" />
    </target>
</project>
