<project name="Duplicate-Way" 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}"/>
    <mkdir dir="build"></mkdir>
    <mkdir dir="${plugin.build.dir}/images"></mkdir>
    <copy todir="build">
      <fileset dir="${plugin.build.dir}" casesensitive="yes">
    	<filename name="**/*.class"/>
      </fileset>
    </copy>
    <copy todir="${plugin.build.dir}/images">
      <fileset dir="images" casesensitive="yes">
    	<filename name="**/*.png"/>
      </fileset>
    </copy>
    <!-- the code still uses no longer existing Segments, disable compile!
	<javac srcdir="src" classpath="${josm}" debug="true" destdir="build">
      <include name="**/*.java" />
    </javac>-->
  </target>

  <target name="dist" depends="compile">
    <jar destfile="${plugin.jar}" basedir="build">
      <manifest>
        <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.duplicateway.DuplicateWayPlugin" />
        <attribute name="Plugin-Description" value="Duplicate Ways with an offset" />
        <attribute name="Plugin-Version" value="0.1"/>
        <attribute name="Author" value="Brent Easton &lt;b.easton@uws.edu.au>"/>
      </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>

</project>
