source: subversion/applications/editors/josm/plugins/opendata/build.xml @ 28152

Last change on this file since 28152 was 28152, checked in by donvip, 8 years ago

[josm_opendata] Improvements in Shapefile parsing, progress monitor, added Paris street lights and notable trees.

File size: 14.9 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** This is the build file for the opendata plugin.
4**
5** Usage
6** =====
7** To build it run
8**
9**    > ant  dist
10**
11** To install the generated plugin locally (in you default plugin directory) run
12**
13**    > ant  install
14**
15** The generated plugin jar is not automatically available in JOSMs plugin configuration
16** dialog. You have to check it in first.
17**
18** Use the ant target 'publish' to check in the plugin and make it available to other
19** JOSM users:
20**    set the properties commit.message and plugin.main.version
21** and run
22**    > ant  publish
23**
24**
25-->
26<project name="opendata" default="dist" basedir=".">
27    <!-- enter the SVN commit message -->
28    <property name="commit.message" value="Commit message"/>
29    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
30    <property name="plugin.main.version" value="5124"/>
31    <!-- should not be necessary to change the following properties -->
32    <property name="josm" location="../../core/dist/josm-custom.jar"/>
33    <property name="plugin.build.dir" value="build"/>
34    <property name="plugin.src.dir" value="src"/>
35    <!-- this is the directory where the plugin jar is copied to -->
36    <property name="plugin.dist.dir" value="../../dist"/>
37    <property name="ant.build.javac.source" value="1.6"/>
38    <property name="ant.build.javac.target" value="1.6"/>
39    <property name="plugin.dist.dir" value="../../dist"/>
40    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
41    <!--<property name="xerces" location="lib/xerces-2_11_0"/>-->
42    <!--
43    **********************************************************
44    ** init - initializes the build
45    **********************************************************
46    -->
47    <target name="init">
48        <mkdir dir="${plugin.build.dir}"/>
49        <mkdir dir="${plugin.build.dir}/META-INF"/>
50    </target>
51    <!--
52    **********************************************************
53    ** compile_lang3 - compiles Apache Commons Lang 3 needed classes
54    **********************************************************
55    -->
56    <target name="compile_lang3" depends="init">
57        <echo message="compiling Apache Commons Lang 3 ... "/>
58        <javac srcdir="includes/org/apache/commons/lang3" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
59    </target>
60    <!--
61    **********************************************************
62    ** compile_poi - compiles Apache POI needed classes
63    **********************************************************
64    -->
65    <target name="compile_poi" depends="init">
66        <echo message="compiling Apache POI ... "/>
67        <javac srcdir="includes/org/apache/poi" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
68    </target>
69    <!--
70    **********************************************************
71    ** compile_collections - compiles Apache Collections needed classes
72    **********************************************************
73    -->
74    <target name="compile_collections" depends="init">
75        <echo message="compiling Apache Collections ... "/>
76        <javac srcdir="includes/org/apache/commons/collections" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
77    </target>
78    <!--
79    **********************************************************
80    ** compile_jopendoc - compiles JOpenDocument needed classes
81    **********************************************************
82    -->
83    <target name="compile_jopendoc" depends="init, compile_collections">
84        <echo message="compiling JDOM ... "/>
85        <javac srcdir="includes/org/jdom" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
86        <echo message="compiling JOpenDocument ... "/>
87        <javac srcdir="includes/org/jopendocument" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
88    </target>
89    <!--
90    **********************************************************
91    ** compile_geotools - compiles GeoTools needed classes
92    **********************************************************
93    -->
94    <target name="compile_geotools" depends="init">
95        <echo message="compiling JTS ... "/>
96        <javac srcdir="includes/com/vividsolutions/jts" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
97        <echo message="compiling JSR-275 ... "/>
98        <javac srcdir="includes/javax/measure" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
99        <echo message="compiling Vecmath ... "/>
100        <javac srcdir="includes/javax/vecmath" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
101        <echo message="compiling GeoTools ... "/>
102        <javac debug="true" sourcepath="" srcdir="includes" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1">
103            <include name="org/geotools/**/*.java"/>
104                <include name="org/opengis/**/*.java"/>
105        </javac>
106    </target>
107    <!--
108    **********************************************************
109    ** compile_naptune - compiles Neptune classes
110    **********************************************************
111    -->
112    <target name="compile_neptune" depends="init">
113        <echo message="compiling Neptune ... "/>
114        <javac srcdir="includes/neptune" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
115    </target>
116    <!--
117    **********************************************************
118    ** compile - compiles the source tree
119    **********************************************************
120    -->
121    <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_geotools, compile_neptune">
122        <echo message="compiling sources for  ${plugin.jar} ... "/>
123        <javac srcdir="src/org/openstreetmap" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false">
124            <classpath>
125                    <pathelement path="${plugin.build.dir}"/>
126                <pathelement location="${josm}"/>
127            </classpath>
128            <compilerarg value="-Xlint:deprecation"/>
129            <compilerarg value="-Xlint:unchecked"/>
130        </javac>
131    </target>
132    <!--
133    **********************************************************
134    ** dist - creates the plugin jar
135    **********************************************************
136    -->
137    <target name="dist" depends="compile,revision">
138        <echo message="creating ${ant.project.name}.jar ... "/>
139        <copy todir="${plugin.build.dir}">
140            <fileset dir="resources">
141                <exclude name="org/geotools/referencing/**/*_original.properties"/>
142                <exclude name="org/geotools/referencing/factory/epsg/*.sql"/>
143                <exclude name="org/geotools/referencing/factory/epsg/PrepareForHSQL.xml"/>
144                <exclude name="org/geotools/referencing/factory/epsg/UpdateEPSGDatabase.txt"/>
145            </fileset>
146        </copy>
147        <copy todir="${plugin.build.dir}/images">
148            <fileset dir="images"/>
149        </copy>
150        <copy todir="${plugin.build.dir}/data">
151            <fileset dir="data"/>
152        </copy>
153        <copy todir="${plugin.build.dir}">
154            <fileset dir=".">
155                <include name="README"/>
156            </fileset>
157            <fileset dir="licenses">
158                <include name="*.txt"/>
159            </fileset>
160        </copy>
161        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
162            <!--
163            ************************************************
164            ** configure these properties. Most of them will be copied to the plugins
165            ** manifest file. Property values will also show up in the list available
166            ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
167            **
168            ************************************************
169            -->
170            <manifest>
171                <attribute name="Author" value="Don-vip"/>
172                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
173                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
174                <attribute name="Plugin-Description" value="Convert data from Open Data portals to OSM layer"/>
175                <attribute name="Plugin-Early" value="false"/>
176                <attribute name="Plugin-Icon" value="images/dialogs/o24.png"/>
177                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
178                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
179                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
180            </manifest>
181        </jar>
182    </target>
183    <!--
184    **********************************************************
185    ** revision - extracts the current revision number for the
186    **    file build.number and stores it in the XML property
187    **    version.*
188    **********************************************************
189    -->
190    <target name="revision">
191        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
192            <env key="LANG" value="C"/>
193            <arg value="info"/>
194            <arg value="--xml"/>
195            <arg value="."/>
196        </exec>
197        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
198        <delete file="REVISION"/>
199    </target>
200    <!--
201    **********************************************************
202    ** clean - clean up the build environment
203    **********************************************************
204    -->
205    <target name="clean">
206        <delete dir="${plugin.build.dir}"/>
207        <delete file="${plugin.jar}"/>
208    </target>
209    <!--
210    **********************************************************
211    ** install - install the plugin in your local JOSM installation
212    **********************************************************
213    -->
214    <target name="install" depends="dist">
215        <property environment="env"/>
216        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
217            <and>
218                <os family="windows"/>
219            </and>
220        </condition>
221        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
222    </target>
223    <!--
224    ************************** Publishing the plugin ***********************************
225    -->
226    <!--
227    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
228    ** property ${coreversion.info.entry.revision}
229    -->
230    <target name="core-info">
231        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
232            <env key="LANG" value="C"/>
233            <arg value="info"/>
234            <arg value="--xml"/>
235            <arg value="../../core"/>
236        </exec>
237        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
238        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
239        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
240        <delete file="core.info.xml"/>
241    </target>
242    <!-- commits the source tree for this plugin -->
243    <target name="commit-current">
244        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
245        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
246            <env key="LANG" value="C"/>
247            <arg value="commit"/>
248            <arg value="-m '${commit.message}'"/>
249            <arg value="."/>
250        </exec>
251    </target>
252    <!-- updates (svn up) the source tree for this plugin -->
253    <target name="update-current">
254        <echo>Updating plugin source ...</echo>
255        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
256            <env key="LANG" value="C"/>
257            <arg value="up"/>
258            <arg value="."/>
259        </exec>
260        <echo>Updating ${plugin.jar} ...</echo>
261        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
262            <env key="LANG" value="C"/>
263            <arg value="up"/>
264            <arg value="../dist/${plugin.jar}"/>
265        </exec>
266    </target>
267    <!-- commits the plugin.jar -->
268    <target name="commit-dist">
269        <echo>
270    ***** Properties of published ${plugin.jar} *****
271    Commit message    : '${commit.message}'                   
272    Plugin-Mainversion: ${plugin.main.version}
273    JOSM build version: ${coreversion.info.entry.revision}
274    Plugin-Version    : ${version.entry.commit.revision}
275    ***** / Properties of published ${plugin.jar} *****                   
276                       
277    Now commiting ${plugin.jar} ...
278    </echo>
279        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
280            <env key="LANG" value="C"/>
281            <arg value="-m '${commit.message}'"/>
282            <arg value="commit"/>
283            <arg value="${plugin.jar}"/>
284        </exec>
285    </target>
286    <!-- make sure svn is present as a command line tool -->
287    <target name="ensure-svn-present">
288        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
289            <env key="LANG" value="C"/>
290            <arg value="--version"/>
291        </exec>
292        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
293            <!-- return code not set at all? Most likely svn isn't installed -->
294            <condition>
295                <not>
296                    <isset property="svn.exit.code"/>
297                </not>
298            </condition>
299        </fail>
300        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
301            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
302            <condition>
303                <isfailure code="${svn.exit.code}"/>
304            </condition>
305        </fail>
306    </target>
307    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
308    </target>
309   
310    <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
311          <classpath>
312            <fileset dir="C:\Windows\SysWOW64\jaxb-ri-20120218\lib" includes="*.jar" />
313          </classpath>
314    </taskdef>
315    <target name="xjc_neptune">
316        <xjc schema="resources/neptune/neptune.xsd" destdir="includes" package="neptune" target="2.1" />
317    </target>
318</project>
Note: See TracBrowser for help on using the repository browser.