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

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

opendata: allow to download Paris and Toulouse data

File size: 14.8 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="5068"/>
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}">
151 <fileset dir=".">
152 <include name="README"/>
153 </fileset>
154 <fileset dir="licenses">
155 <include name="*.txt"/>
156 </fileset>
157 </copy>
158 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
159 <!--
160 ************************************************
161 ** configure these properties. Most of them will be copied to the plugins
162 ** manifest file. Property values will also show up in the list available
163 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
164 **
165 ************************************************
166 -->
167 <manifest>
168 <attribute name="Author" value="Don-vip"/>
169 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
170 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
171 <attribute name="Plugin-Description" value="Convert data from Open Data portals to OSM layer"/>
172 <attribute name="Plugin-Early" value="false"/>
173 <attribute name="Plugin-Icon" value="images/dialogs/o24.png"/>
174 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
175 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
176 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
177 </manifest>
178 </jar>
179 </target>
180 <!--
181 **********************************************************
182 ** revision - extracts the current revision number for the
183 ** file build.number and stores it in the XML property
184 ** version.*
185 **********************************************************
186 -->
187 <target name="revision">
188 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
189 <env key="LANG" value="C"/>
190 <arg value="info"/>
191 <arg value="--xml"/>
192 <arg value="."/>
193 </exec>
194 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
195 <delete file="REVISION"/>
196 </target>
197 <!--
198 **********************************************************
199 ** clean - clean up the build environment
200 **********************************************************
201 -->
202 <target name="clean">
203 <delete dir="${plugin.build.dir}"/>
204 <delete file="${plugin.jar}"/>
205 </target>
206 <!--
207 **********************************************************
208 ** install - install the plugin in your local JOSM installation
209 **********************************************************
210 -->
211 <target name="install" depends="dist">
212 <property environment="env"/>
213 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
214 <and>
215 <os family="windows"/>
216 </and>
217 </condition>
218 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
219 </target>
220 <!--
221 ************************** Publishing the plugin ***********************************
222 -->
223 <!--
224 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
225 ** property ${coreversion.info.entry.revision}
226 -->
227 <target name="core-info">
228 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
229 <env key="LANG" value="C"/>
230 <arg value="info"/>
231 <arg value="--xml"/>
232 <arg value="../../core"/>
233 </exec>
234 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
235 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
236 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
237 <delete file="core.info.xml"/>
238 </target>
239 <!-- commits the source tree for this plugin -->
240 <target name="commit-current">
241 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
242 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
243 <env key="LANG" value="C"/>
244 <arg value="commit"/>
245 <arg value="-m '${commit.message}'"/>
246 <arg value="."/>
247 </exec>
248 </target>
249 <!-- updates (svn up) the source tree for this plugin -->
250 <target name="update-current">
251 <echo>Updating plugin source ...</echo>
252 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
253 <env key="LANG" value="C"/>
254 <arg value="up"/>
255 <arg value="."/>
256 </exec>
257 <echo>Updating ${plugin.jar} ...</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="../dist/${plugin.jar}"/>
262 </exec>
263 </target>
264 <!-- commits the plugin.jar -->
265 <target name="commit-dist">
266 <echo>
267 ***** Properties of published ${plugin.jar} *****
268 Commit message : '${commit.message}'
269 Plugin-Mainversion: ${plugin.main.version}
270 JOSM build version: ${coreversion.info.entry.revision}
271 Plugin-Version : ${version.entry.commit.revision}
272 ***** / Properties of published ${plugin.jar} *****
273
274 Now commiting ${plugin.jar} ...
275 </echo>
276 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
277 <env key="LANG" value="C"/>
278 <arg value="-m '${commit.message}'"/>
279 <arg value="commit"/>
280 <arg value="${plugin.jar}"/>
281 </exec>
282 </target>
283 <!-- make sure svn is present as a command line tool -->
284 <target name="ensure-svn-present">
285 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
286 <env key="LANG" value="C"/>
287 <arg value="--version"/>
288 </exec>
289 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
290 <!-- return code not set at all? Most likely svn isn't installed -->
291 <condition>
292 <not>
293 <isset property="svn.exit.code"/>
294 </not>
295 </condition>
296 </fail>
297 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
298 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
299 <condition>
300 <isfailure code="${svn.exit.code}"/>
301 </condition>
302 </fail>
303 </target>
304 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
305 </target>
306
307 <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
308 <classpath>
309 <fileset dir="C:\Windows\SysWOW64\jaxb-ri-20120218\lib" includes="*.jar" />
310 </classpath>
311 </taskdef>
312 <target name="xjc_neptune">
313 <xjc schema="resources/neptune/neptune.xsd" destdir="includes" package="neptune" target="2.1" />
314 </target>
315</project>
Note: See TracBrowser for help on using the repository browser.