<?xml version="1.0" encoding="utf-8"?>
<project name="opendata" default="dist" basedir=".">
    <property name="plugin.main.version" value="10580"/>
    <property name="plugin.author" value="Don-vip"/>
    <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
    <property name="plugin.description" value="Convert data from Open Data portals to OSM layer"/>
    <property name="plugin.icon" value="images/dialogs/o24.png"/>
    <property name="plugin.canloadatruntime" value="true"/>
    <property name="plugin.link" value="https://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
    <property name="plugin.requires" value="apache-commons;jts;ejml;geotools;utilsplugin2"/>

    <!-- ** include targets that all plugins have in common ** -->
    <import file="../build-common.xml"/>
    
    <fileset id="plugin.requires.jars" dir="${plugin.dist.dir}">
        <include name="apache-commons.jar"/>
        <include name="jts.jar"/>
        <include name="ejml.jar"/>
        <include name="geotools.jar"/>
        <include name="opendata.jar"/>
    </fileset>

    <property name="apache-commons" location="${plugin.dist.dir}/apache-commons.jar"/>
    <property name="jts" location="${plugin.dist.dir}/jts.jar"/>
    <property name="ejml" location="${plugin.dist.dir}/ejml.jar"/>
    <property name="geotools" location="${plugin.dist.dir}/geotools.jar"/>
    
    <!--
    **********************************************************
    ** compile_poi - compiles Apache POI needed classes
    **********************************************************
    -->
    <target name="compile_poi" depends="init">
        <echo message="compiling Apache POI ... "/>
        <javac srcdir="includes/org/apache/poi" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
    </target>
    <!--
    **********************************************************
    ** compile_jopendoc - compiles JOpenDocument needed classes
    **********************************************************
    -->
    <target name="compile_jopendoc" depends="init">
        <echo message="compiling JOpenDocument ... "/>
        <javac srcdir="includes/org/jopendocument" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" >
            <classpath>
                <!-- JDOM is required and embedded in geotools jar -->
                <pathelement location="${geotools}"/>
                <pathelement location="${apache-commons}"/>
            </classpath>
        </javac>
    </target>
    <!--
    **********************************************************
    ** compile_j7zip - compiles J7zip classes
    **********************************************************
    -->
    <target name="compile_j7zip" depends="init">
        <echo message="compiling J7Zip ... "/>
        <javac srcdir="includes/org/j7zip" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
    </target>
    <!--
    **********************************************************
    ** compile_neptune - compiles Neptune classes
    **********************************************************
    -->
    <target name="compile_neptune" depends="init, xjc_neptune">
        <echo message="compiling Neptune ... "/>
        <javac srcdir="includes/neptune" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
    </target>
    <!--
    **********************************************************
    ** compile - compiles the source tree
    **********************************************************
    -->
    <target name="compile" depends="init, compile_poi, compile_jopendoc, compile_neptune, compile_j7zip">
        <echo message="compiling sources for ${plugin.jar} ... "/>
        <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8">
            <classpath>
                <pathelement path="${plugin.build.dir}"/>
                <pathelement location="${josm}"/>
                <pathelement location="${apache-commons}"/>
                <pathelement location="${jts}"/>
                <pathelement location="${ejml}"/>
                <pathelement location="${geotools}"/>
            </classpath>
            <compilerarg value="-Xlint:deprecation"/>
            <compilerarg value="-Xlint:unchecked"/>
        </javac>
    </target>
    
    <target name="xjc_neptune" depends="init, -jaxb_before9, -jaxb_after9" unless="jaxb.notRequired">
        <exec executable="${xjc}" failonerror="true">
            <arg value="-d"/>
            <arg value="includes"/>
            <arg value="-p"/>
            <arg value="neptune"/>
            <arg value="-encoding"/>
            <arg value="UTF-8"/>
            <arg value="resources/neptune/neptune.xsd"/>
        </exec>
    </target>
</project>
