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

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

[josm_opendata] Update to JOSM 5132

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="5132"/>
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-Requires" value="jts"/>
180                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
181            </manifest>
182        </jar>
183    </target>
184    <!--
185    **********************************************************
186    ** revision - extracts the current revision number for the
187    **    file build.number and stores it in the XML property
188    **    version.*
189    **********************************************************
190    -->
191    <target name="revision">
192        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
193            <env key="LANG" value="C"/>
194            <arg value="info"/>
195            <arg value="--xml"/>
196            <arg value="."/>
197        </exec>
198        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
199        <delete file="REVISION"/>
200    </target>
201    <!--
202    **********************************************************
203    ** clean - clean up the build environment
204    **********************************************************
205    -->
206    <target name="clean">
207        <delete dir="${plugin.build.dir}"/>
208        <delete file="${plugin.jar}"/>
209    </target>
210    <!--
211    **********************************************************
212    ** install - install the plugin in your local JOSM installation
213    **********************************************************
214    -->
215    <target name="install" depends="dist">
216        <property environment="env"/>
217        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
218            <and>
219                <os family="windows"/>
220            </and>
221        </condition>
222        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
223    </target>
224    <!--
225    ************************** Publishing the plugin ***********************************
226    -->
227    <!--
228    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
229    ** property ${coreversion.info.entry.revision}
230    -->
231    <target name="core-info">
232        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
233            <env key="LANG" value="C"/>
234            <arg value="info"/>
235            <arg value="--xml"/>
236            <arg value="../../core"/>
237        </exec>
238        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
239        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
240        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
241        <delete file="core.info.xml"/>
242    </target>
243    <!-- commits the source tree for this plugin -->
244    <target name="commit-current">
245        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
246        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
247            <env key="LANG" value="C"/>
248            <arg value="commit"/>
249            <arg value="-m '${commit.message}'"/>
250            <arg value="."/>
251        </exec>
252    </target>
253    <!-- updates (svn up) the source tree for this plugin -->
254    <target name="update-current">
255        <echo>Updating plugin source ...</echo>
256        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
257            <env key="LANG" value="C"/>
258            <arg value="up"/>
259            <arg value="."/>
260        </exec>
261        <echo>Updating ${plugin.jar} ...</echo>
262        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
263            <env key="LANG" value="C"/>
264            <arg value="up"/>
265            <arg value="../dist/${plugin.jar}"/>
266        </exec>
267    </target>
268    <!-- commits the plugin.jar -->
269    <target name="commit-dist">
270        <echo>
271    ***** Properties of published ${plugin.jar} *****
272    Commit message    : '${commit.message}'                   
273    Plugin-Mainversion: ${plugin.main.version}
274    JOSM build version: ${coreversion.info.entry.revision}
275    Plugin-Version    : ${version.entry.commit.revision}
276    ***** / Properties of published ${plugin.jar} *****                   
277                       
278    Now commiting ${plugin.jar} ...
279    </echo>
280        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
281            <env key="LANG" value="C"/>
282            <arg value="-m '${commit.message}'"/>
283            <arg value="commit"/>
284            <arg value="${plugin.jar}"/>
285        </exec>
286    </target>
287    <!-- make sure svn is present as a command line tool -->
288    <target name="ensure-svn-present">
289        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
290            <env key="LANG" value="C"/>
291            <arg value="--version"/>
292        </exec>
293        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
294            <!-- return code not set at all? Most likely svn isn't installed -->
295            <condition>
296                <not>
297                    <isset property="svn.exit.code"/>
298                </not>
299            </condition>
300        </fail>
301        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
302            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
303            <condition>
304                <isfailure code="${svn.exit.code}"/>
305            </condition>
306        </fail>
307    </target>
308    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
309    </target>
310   
311    <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
312          <classpath>
313            <fileset dir="C:\Windows\SysWOW64\jaxb-ri-20120218\lib" includes="*.jar" />
314          </classpath>
315    </taskdef>
316    <target name="xjc_neptune">
317        <xjc schema="resources/neptune/neptune.xsd" destdir="includes" package="neptune" target="2.1" />
318    </target>
319</project>
Note: See TracBrowser for help on using the repository browser.