<?xml version="1.0" encoding="utf-8"?>
<project name="mapdust" default="dist" basedir=".">
    <!-- properties -->
    <property name="commit.message" value="MapDust bug reporter plugin"/>
    <property name="plugin.main.version" value="7001"/>

    <property name="apidoc.dir" value="doc"/>

    <!--
    **********************************************************
    ** include targets that all plugins have in common
    **********************************************************
    -->
    <import file="../build-common.xml"/>
  
    <!-- classpath -->
    <path id="classpath">
        <fileset dir="${plugin.lib.dir}" includes="**/*.jar"/>
        <pathelement path="${josm}"/>
    </path>

    <!--
    **********************************************************
    ** compile - complies the source tree
    **********************************************************
    -->
    <target name="compile" depends="init">
        <echo message="compiling sources for ${plugin.jar} ..."/>
        <javac srcdir="src" classpathref="classpath" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
            <compilerarg value="-Xlint:deprecation"/>
            <compilerarg value="-Xlint:unchecked"/>
        </javac>
    </target>

    <target name="clean">
        <delete dir="${plugin.build.dir}"/>
        <delete dir="${apidoc.dir}"/>
        <delete file="${plugin.jar}"/>
    </target>

    <!-- creates the javadocs -->
    <target name="javadoc">
        <mkdir dir="${apidoc.dir}"/>
        <javadoc destdir="${apidoc.dir}" source="1.7" classpathref="classpath" windowtitle="MapDust plugin API">
            <link href="http://java.sun.com/javase/7/docs/api/"/>
            <link href="http://docs.jboss.org/hibernate/stable/core/api/"/>
            <packageset dir="${plugin.src.dir}">
            </packageset>
        </javadoc>
    </target>

    <!-- creates the .jar file of the plugin -->
    <target name="dist" depends="compile,revision">
        <echo message="creating ${ant.project.name}.jar ... "/>
        <copy todir="${plugin.build.dir}">
            <fileset dir="conf"/>
        </copy>
        <copy todir="${plugin.build.dir}/images">
            <fileset dir="images"/>
        </copy>
        <copy todir="${plugin.build.dir}/data">
            <fileset dir="data"/>
        </copy>
        <copy todir="${plugin.build.dir}">
            <fileset dir=".">
                <include name="README"/>
                <include name="LICENSE"/>
            </fileset>
        </copy>
        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
        	<zipfileset src="lib/gson-2.2.4.jar"/>
            <manifest>
                <attribute name="Author" value="Beata Jancso"/>
                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.mapdust.MapdustPlugin"/>
                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
                <attribute name="Plugin-Description" value="The MapDust Plug-In shows the MapDust bug reports on the map. You can create, close,invalidate, re-open and comment bug reports by using this plugin."/>
                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust"/>
                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
                <attribute name="Plugin-Icon" value="images/dialogs/mapdust_icon25.png"/>
            </manifest>
        </jar>
    </target>
</project>
