source: osm/applications/editors/josm/plugins/opendata/modules/fr.toulouse/build.xml@ 28893

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

[josm_opendata] Allow to split Toulouse data by sector/neighbourhood (admin level 10 and 11)

File size: 9.9 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** This is a template build file for a module of the JOSM opendata plugin.
4**
5** Usage
6** =====
7** To build it run
8**
9** > ant dist
10**
11** To install the generated module locally (in you default opendata modules directory) run
12**
13** > ant install
14**
15** The generated module jar is not automatically available in JOSMs opendata plugin configuration
16** dialog. You have to check it in first.
17**
18** Use the ant target 'publish' to check in the module and make it available to other
19** JOSM users:
20** set the property commit.message
21** and run
22** > ant publish
23**
24-->
25<project name="fr.toulouse" default="dist" basedir=".">
26 <!-- enter the SVN commit message -->
27 <property name="commit.message" value="Commit message"/>
28 <!-- should not be necessary to change the following properties -->
29 <property name="josm" location="../../../../core/dist/josm-custom.jar"/>
30 <property name="plugin.dist.dir" value="../../../../dist"/>
31 <property name="opendata" location="${plugin.dist.dir}/opendata.jar"/>
32 <property name="utilsplugin2" location="${plugin.dist.dir}/utilsplugin2.jar"/>
33 <property name="module.build.dir" value="build"/>
34 <property name="module.src.dir" value="src"/>
35 <property name="ant.build.javac.source" value="1.6"/>
36 <property name="ant.build.javac.target" value="1.6"/>
37 <!-- this is the directory where the module jar is copied to -->
38 <property name="module.dist.dir" value="../../dist"/>
39 <property name="module.jar" value="${module.dist.dir}/${ant.project.name}.jar"/>
40 <!-- conditions -->
41 <condition property="resources.exist">
42 <available file="resources" type="dir" />
43 </condition>
44 <condition property="images.exist">
45 <available file="images" type="dir" />
46 </condition>
47 <!--
48 **********************************************************
49 ** init - initializes the build
50 **********************************************************
51 -->
52 <target name="init">
53 <mkdir dir="${module.build.dir}"/>
54 <mkdir dir="${module.build.dir}/META-INF"/>
55 </target>
56 <!--
57 **********************************************************
58 ** compile - compiles the source tree
59 **********************************************************
60 -->
61 <target name="compile" depends="init">
62 <echo message="compiling sources for ${module.jar} ... "/>
63 <javac srcdir="${module.src.dir}" debug="true" destdir="${module.build.dir}" includeAntRuntime="false">
64 <classpath>
65 <pathelement location="${josm}"/>
66 <pathelement location="${opendata}"/>
67 <pathelement location="${utilsplugin2}"/>
68 </classpath>
69 <compilerarg value="-Xlint:deprecation"/>
70 <compilerarg value="-Xlint:unchecked"/>
71 </javac>
72 </target>
73 <!--
74 **********************************************************
75 ** copy-resources - copies resources dir to build dir
76 **********************************************************
77 -->
78 <target name="copy-resources" if="resources.exist">
79 <copy todir="${module.build.dir}">
80 <fileset dir="resources" />
81 </copy>
82 </target>
83 <!--
84 **********************************************************
85 ** copy-images - copies images dir to build dir
86 **********************************************************
87 -->
88 <target name="copy-images" if="images.exist">
89 <copy todir="${module.build.dir}/images">
90 <fileset dir="images" />
91 </copy>
92 </target>
93 <!--
94 **********************************************************
95 ** dist - creates the module jar
96 **********************************************************
97 -->
98 <target name="dist" depends="compile,revision,copy-resources, copy-images">
99 <echo message="creating ${ant.project.name}.jar ... "/>
100 <copy todir="${module.build.dir}">
101 <fileset dir=".">
102 <include name="README"/>
103 <include name="gpl-3.0.txt"/>
104 </fileset>
105 </copy>
106 <jar destfile="${module.jar}" basedir="${module.build.dir}">
107 <!--
108 ************************************************
109 ** configure these properties. Most of them will
110 ** be copied to the module manifest file.
111 **
112 ************************************************
113 -->
114 <manifest>
115 <attribute name="Author" value="Don-vip"/>
116 <attribute name="Module-Class" value="org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.ToulouseModule"/>
117 <attribute name="Module-Date" value="${version.entry.commit.date}"/>
118 <attribute name="Module-Description" value="Toulouse"/>
119 <attribute name="Module-Icon" value="images/data.fr.toulouse_24.png"/>
120 <attribute name="Module-Link" value="http://wiki.openstreetmap.org/wiki/Toulouse/GrandToulouseData"/>
121 <attribute name="Module-Version" value="${version.entry.commit.revision}"/>
122 </manifest>
123 </jar>
124 </target>
125 <!--
126 **********************************************************
127 ** revision - extracts the current revision number for the
128 ** file build.number and stores it in the XML property
129 ** version.*
130 **********************************************************
131 -->
132 <target name="revision">
133 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
134 <env key="LANG" value="C"/>
135 <arg value="info"/>
136 <arg value="--xml"/>
137 <arg value="."/>
138 </exec>
139 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
140 <delete file="REVISION"/>
141 </target>
142 <!--
143 **********************************************************
144 ** clean - clean up the build environment
145 **********************************************************
146 -->
147 <target name="clean">
148 <delete dir="${module.build.dir}"/>
149 <delete file="${module.jar}"/>
150 </target>
151 <!--
152 **********************************************************
153 ** install - install the module in your local JOSM installation
154 **********************************************************
155 -->
156 <target name="install" depends="dist">
157 <property environment="env"/>
158 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
159 <and>
160 <os family="windows"/>
161 </and>
162 </condition>
163 <copy file="${module.jar}" todir="${josm.plugins.dir}/opendata/modules" overwrite="yes"/>
164 </target>
165 <!--
166 ************************** Publishing the module ***********************************
167 -->
168 <!-- commits the source tree for this module -->
169 <target name="commit-current">
170 <echo>Commiting the module source with message '${commit.message}' ...</echo>
171 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
172 <env key="LANG" value="C"/>
173 <arg value="commit"/>
174 <arg value="-m '${commit.message}'"/>
175 <arg value="."/>
176 </exec>
177 </target>
178 <!-- updates (svn up) the source tree for this module -->
179 <target name="update-current">
180 <echo>Updating module source ...</echo>
181 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
182 <env key="LANG" value="C"/>
183 <arg value="up"/>
184 <arg value="."/>
185 </exec>
186 <echo>Updating ${module.jar} ...</echo>
187 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
188 <env key="LANG" value="C"/>
189 <arg value="up"/>
190 <arg value="../dist/${module.jar}"/>
191 </exec>
192 </target>
193 <!-- commits the module.jar -->
194 <target name="commit-dist">
195 <echo>
196 ***** Properties of published ${module.jar} *****
197 Commit message : '${commit.message}'
198 Module-Version : ${version.entry.commit.revision}
199 ***** / Properties of published ${module.jar} *****
200
201 Now commiting ${module.jar} ...
202 </echo>
203 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
204 <env key="LANG" value="C"/>
205 <arg value="-m '${commit.message}'"/>
206 <arg value="commit"/>
207 <arg value="${module.jar}"/>
208 </exec>
209 </target>
210 <!-- make sure svn is present as a command line tool -->
211 <target name="ensure-svn-present">
212 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
213 <env key="LANG" value="C"/>
214 <arg value="--version"/>
215 </exec>
216 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
217 <!-- return code not set at all? Most likely svn isn't installed -->
218 <condition>
219 <not>
220 <isset property="svn.exit.code"/>
221 </not>
222 </condition>
223 </fail>
224 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
225 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
226 <condition>
227 <isfailure code="${svn.exit.code}"/>
228 </condition>
229 </fail>
230 </target>
231 <target name="publish" depends="ensure-svn-present,commit-current,update-current,clean,dist,commit-dist">
232 </target>
233</project>
Note: See TracBrowser for help on using the repository browser.