<?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"/>
  
	<fileset id="plugin.requires.jars" dir="${plugin.dist.dir}">
        <include name="gson.jar"/>
    </fileset>

    <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}" manifestencoding="UTF-8">
            <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-Requires" value="gson"/>
                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
                <attribute name="Plugin-Icon" value="images/dialogs/mapdust_icon25.png"/>
            </manifest>
        </jar>
    </target>
</project>
