source: osm/applications/editors/josm/plugins/opendata/build.xml@ 28591

Last change on this file since 28591 was 28591, checked in by donvip, 12 years ago

[josm_opendata] Update JAXB to 2.2.6

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="5236"/>
31 <!-- should not be necessary to change the following properties -->
32 <property name="josm" location="../../core/dist/josm-custom.jar"/>
33 <property name="jts" location="../../dist/jts.jar"/>
34 <property name="plugin.build.dir" value="build"/>
35 <property name="plugin.src.dir" value="src"/>
36 <!-- this is the directory where the plugin jar is copied to -->
37 <property name="plugin.dist.dir" value="../../dist"/>
38 <property name="ant.build.javac.source" value="1.6"/>
39 <property name="ant.build.javac.target" value="1.6"/>
40 <property name="plugin.dist.dir" value="../../dist"/>
41 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
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 JSR-275 ... "/>
96 <javac srcdir="includes/javax/measure" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
97 <echo message="compiling Vecmath ... "/>
98 <javac srcdir="includes/javax/vecmath" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
99 <echo message="compiling GeoTools ... "/>
100 <javac debug="false" sourcepath="" srcdir="includes" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1">
101 <include name="org/geotools/**/*.java"/>
102 <include name="org/opengis/**/*.java"/>
103 <classpath>
104 <pathelement location="${jts}"/>
105 </classpath>
106 </javac>
107 </target>
108 <!--
109 **********************************************************
110 ** compile_neptune - compiles Neptune classes
111 **********************************************************
112 -->
113 <target name="compile_neptune" depends="init">
114 <echo message="compiling Neptune ... "/>
115 <javac srcdir="includes/neptune" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
116 </target>
117 <!--
118 **********************************************************
119 ** compile - compiles the source tree
120 **********************************************************
121 -->
122 <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_geotools, compile_neptune">
123 <echo message="compiling sources for ${plugin.jar} ... "/>
124 <javac srcdir="src/org/openstreetmap" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false">
125 <classpath>
126 <pathelement path="${plugin.build.dir}"/>
127 <pathelement location="${josm}"/>
128 <pathelement location="${jts}"/>
129 </classpath>
130 <compilerarg value="-Xlint:deprecation"/>
131 <compilerarg value="-Xlint:unchecked"/>
132 </javac>
133 </target>
134 <!--
135 **********************************************************
136 ** dist - creates the plugin jar
137 **********************************************************
138 -->
139 <target name="dist" depends="compile,revision">
140 <echo message="creating ${ant.project.name}.jar ... "/>
141 <copy todir="${plugin.build.dir}">
142 <fileset dir="resources">
143 <exclude name="org/geotools/referencing/**/*_original.properties"/>
144 <exclude name="org/geotools/referencing/factory/epsg/*.sql"/>
145 <exclude name="org/geotools/referencing/factory/epsg/PrepareForHSQL.xml"/>
146 <exclude name="org/geotools/referencing/factory/epsg/UpdateEPSGDatabase.txt"/>
147 </fileset>
148 </copy>
149 <copy todir="${plugin.build.dir}/images">
150 <fileset dir="images"/>
151 </copy>
152 <copy todir="${plugin.build.dir}/data">
153 <fileset dir="data"/>
154 </copy>
155 <copy todir="${plugin.build.dir}">
156 <fileset dir=".">
157 <include name="README"/>
158 </fileset>
159 <fileset dir="licenses">
160 <include name="*.txt"/>
161 </fileset>
162 </copy>
163 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
164 <!--
165 ************************************************
166 ** configure these properties. Most of them will be copied to the plugins
167 ** manifest file. Property values will also show up in the list available
168 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
169 **
170 ************************************************
171 -->
172 <manifest>
173 <attribute name="Author" value="Don-vip"/>
174 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
175 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
176 <attribute name="Plugin-Description" value="Convert data from Open Data portals to OSM layer"/>
177 <attribute name="Plugin-Early" value="false"/>
178 <attribute name="Plugin-Icon" value="images/dialogs/o24.png"/>
179 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
180 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
181 <attribute name="Plugin-Requires" value="jts"/>
182 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
183 </manifest>
184 </jar>
185 </target>
186 <!--
187 **********************************************************
188 ** revision - extracts the current revision number for the
189 ** file build.number and stores it in the XML property
190 ** version.*
191 **********************************************************
192 -->
193 <target name="revision">
194 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
195 <env key="LANG" value="C"/>
196 <arg value="info"/>
197 <arg value="--xml"/>
198 <arg value="."/>
199 </exec>
200 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
201 <delete file="REVISION"/>
202 </target>
203 <!--
204 **********************************************************
205 ** clean - clean up the build environment
206 **********************************************************
207 -->
208 <target name="clean">
209 <delete dir="${plugin.build.dir}"/>
210 <delete file="${plugin.jar}"/>
211 </target>
212 <!--
213 **********************************************************
214 ** install - install the plugin in your local JOSM installation
215 **********************************************************
216 -->
217 <target name="install" depends="dist">
218 <property environment="env"/>
219 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
220 <and>
221 <os family="windows"/>
222 </and>
223 </condition>
224 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
225 </target>
226 <!--
227 ************************** Publishing the plugin ***********************************
228 -->
229 <!--
230 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
231 ** property ${coreversion.info.entry.revision}
232 -->
233 <target name="core-info">
234 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
235 <env key="LANG" value="C"/>
236 <arg value="info"/>
237 <arg value="--xml"/>
238 <arg value="../../core"/>
239 </exec>
240 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
241 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
242 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
243 <delete file="core.info.xml"/>
244 </target>
245 <!-- commits the source tree for this plugin -->
246 <target name="commit-current">
247 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
248 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
249 <env key="LANG" value="C"/>
250 <arg value="commit"/>
251 <arg value="-m '${commit.message}'"/>
252 <arg value="."/>
253 </exec>
254 </target>
255 <!-- updates (svn up) the source tree for this plugin -->
256 <target name="update-current">
257 <echo>Updating plugin source ...</echo>
258 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
259 <env key="LANG" value="C"/>
260 <arg value="up"/>
261 <arg value="."/>
262 </exec>
263 <echo>Updating ${plugin.jar} ...</echo>
264 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
265 <env key="LANG" value="C"/>
266 <arg value="up"/>
267 <arg value="../dist/${plugin.jar}"/>
268 </exec>
269 </target>
270 <!-- commits the plugin.jar -->
271 <target name="commit-dist">
272 <echo>
273 ***** Properties of published ${plugin.jar} *****
274 Commit message : '${commit.message}'
275 Plugin-Mainversion: ${plugin.main.version}
276 JOSM build version: ${coreversion.info.entry.revision}
277 Plugin-Version : ${version.entry.commit.revision}
278 ***** / Properties of published ${plugin.jar} *****
279
280 Now commiting ${plugin.jar} ...
281 </echo>
282 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
283 <env key="LANG" value="C"/>
284 <arg value="-m '${commit.message}'"/>
285 <arg value="commit"/>
286 <arg value="${plugin.jar}"/>
287 </exec>
288 </target>
289 <!-- make sure svn is present as a command line tool -->
290 <target name="ensure-svn-present">
291 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
292 <env key="LANG" value="C"/>
293 <arg value="--version"/>
294 </exec>
295 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
296 <!-- return code not set at all? Most likely svn isn't installed -->
297 <condition>
298 <not>
299 <isset property="svn.exit.code"/>
300 </not>
301 </condition>
302 </fail>
303 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
304 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
305 <condition>
306 <isfailure code="${svn.exit.code}"/>
307 </condition>
308 </fail>
309 </target>
310 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
311 </target>
312
313 <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
314 <classpath>
315 <fileset dir="lib/jaxb" includes="*.jar" />
316 </classpath>
317 </taskdef>
318 <target name="xjc_neptune">
319 <xjc schema="resources/neptune/neptune.xsd" destdir="includes" package="neptune" target="2.1" />
320 </target>
321</project>
Note: See TracBrowser for help on using the repository browser.