source: osm/applications/editors/josm/plugins/smed/plugs/oseam/build.xml@ 23400

Last change on this file since 23400 was 23400, checked in by postfix, 14 years ago

reviewed ant files back

  • Property svn:executable set to *
File size: 9.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3** This is a template build file for a JOSM plugin.
4**
5** Maintaining versions
6** ====================
7** see README.template
8**
9** Usage
10** =====
11** To build it run
12**
13** > ant dist
14**
15** To install the generated plugin locally (in you default plugin directory) run
16**
17** > ant install
18**
19** The generated plugin jar is not automatically available in JOSMs plugin configuration
20** dialog. You have to check it in first.
21**
22** Use the ant target 'publish' to check in the plugin and make it available to other
23** JOSM users:
24** set the properties commit.message and plugin.main.version
25** and run
26** > ant publish
27**
28**
29-->
30<project name="oseam" default="dist" basedir=".">
31
32 <!-- enter the SVN commit message -->
33 <property name="commit.message" value="New release" />
34 <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
35 <property name="plugin.main.version" value="3329" />
36
37 <!-- Declaring time-stamps-->
38 <tstamp/>
39
40 <!--
41 ************************************************
42 ** should not be necessary to change the following properties
43 -->
44 <property name="josm" location="../../../../core/dist/josm-custom.jar"/>
45 <property name="smed" location="../../core/dist/smed.jar"/>
46 <property name="plugin.build.dir" value="build"/>
47 <property name="plugin.src.dir" value="src"/>
48 <property name="smed.build.dir" value="../../../smed/build"/>
49 <property name="delete_string" value="*${ant.project.name}.jar"/>
50 <!-- this is the directory where the plugin jar is copied to -->
51 <property name="plugin.dist.dir" value="../../dist"/>
52 <property name="ant.build.javac.target" value="1.5"/>
53 <property name="plugin.jar" value="${plugin.dist.dir}/00_${DSTAMP}_${TSTAMP}_${ant.project.name}.jar"/>
54
55 <!--
56 **********************************************************
57 ** init - initializes the build
58 **********************************************************
59 -->
60 <target name="init">
61 <mkdir dir="${plugin.build.dir}"/>
62 <mkdir dir="${plugin.dist.dir}"/>
63 </target>
64
65 <!--
66 **********************************************************
67 ** compile - complies the source tree
68 **********************************************************
69 -->
70 <target name="compile" depends="init">
71 <echo message="compiling sources for ${plugin.jar} ... "/>
72 <javac srcdir="src" classpath="${josm}:${smed}" debug="true" destdir="${plugin.build.dir}">
73 <compilerarg value="-Xlint:deprecation"/>
74 <compilerarg value="-Xlint:unchecked"/>
75 </javac>
76 </target>
77
78
79 <!--
80 **********************************************************
81 ** dist - creates the plugin jar
82 **********************************************************
83 -->
84 <target name="dist" depends="compile,revision">
85 <echo message="creating ${ant.project.name}.jar ... "/>
86
87 <copy todir="${plugin.build.dir}/images">
88 <fileset dir="${plugin.src.dir}/images"/>
89 </copy>
90
91 <copy todir="${plugin.build.dir}/images">
92 <fileset dir="images"/>
93 </copy>
94 <copy todir="${plugin.build.dir}/${ant.project.name}/msg">
95 <fileset dir="${plugin.src.dir}/${ant.project.name}/msg"/>
96 </copy>
97 <copy todir="${plugin.build.dir}">
98 <fileset dir=".">
99 <include name="copyright.txt" />
100 <include name="LICENSE.txt" />
101 </fileset>
102 </copy>
103
104 <delete>
105 <fileset dir="${plugin.dist.dir}">
106 <include name="${delete_string}"/>
107 </fileset>
108 </delete>
109
110
111 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
112 <!--
113 ************************************************
114 ** configure these properties. Most of them will be copied to the plugins
115 ** manifest file. Property values will also show up in the list available
116 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
117 **
118 ************************************************
119 -->
120 <manifest>
121 <attribute name="Author" value="Werner, Malcolm"/>
122 <attribute name="Plugin-Class" value="toms.Toms"/>
123 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
124 <attribute name="Plugin-Description" value="Create and edit seamarks for OpenSeaMap"/>
125 <attribute name="Plugin-Icon" value="images/Smp.png"/>
126 <attribute name="Plugin-Link" value="http://openseamap.org/"/>
127 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
128 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
129 </manifest>
130 </jar>
131 </target>
132
133 <!--
134 **********************************************************
135 ** revision - extracts the current revision number for the
136 ** file build.number and stores it in the XML property
137 ** version.*
138 **********************************************************
139 -->
140 <target name="revision">
141
142 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
143 <env key="LANG" value="C"/>
144 <arg value="info"/>
145 <arg value="--xml"/>
146 <arg value="."/>
147 </exec>
148 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
149 <delete file="REVISION"/>
150 </target>
151
152 <!--
153 **********************************************************
154 ** clean - clean up the build environment
155 **********************************************************
156 -->
157 <target name="clean">
158 <delete dir="${plugin.build.dir}"/>
159 <delete>
160 <fileset dir="${plugin.dist.dir}">
161 <include name="${delete_string}"/>
162 </fileset>
163 </delete>
164 </target>
165
166 <!--
167 **********************************************************
168 ** install - install the plugin in your local JOSM installation
169 ** for developing
170 **********************************************************
171 -->
172 <target name="install-develop" depends="dist">
173 <property environment="env"/>
174 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins/splug" else="${user.home}/.josm/plugins/splug">
175 <and>
176 <os family="windows"/>
177 </and>
178 </condition>
179
180 <delete>
181 <fileset dir="${josm.plugins.dir}">
182 <include name="${delete_string}"/>
183 </fileset>
184 </delete>
185
186 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
187
188 <delete file="${plugin.jar}"/>
189
190 </target>
191
192 <!--
193 ************************** Publishing the plugin ***********************************
194 -->
195 <!--
196 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
197 ** property ${coreversion.info.entry.revision}
198 **
199 -->
200
201 <target name="core-info">
202 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
203 <env key="LANG" value="C"/>
204 <arg value="info"/>
205 <arg value="--xml"/>
206 <arg value="../../core"/>
207 </exec>
208 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
209 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
210 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
211 <delete file="core.info.xml" />
212 </target>
213
214 <!--
215 ** commits the source tree for this plugin
216 -->
217 <target name="commit-current">
218 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
219 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
220 <env key="LANG" value="C"/>
221 <arg value="commit"/>
222 <arg value="-m '${commit.message}'"/>
223 <arg value="."/>
224 </exec>
225 </target>
226
227 <!--
228 ** updates (svn up) the source tree for this plugin
229 -->
230 <target name="update-current">
231 <echo>Updating plugin source ...</echo>
232 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
233 <env key="LANG" value="C"/>
234 <arg value="up"/>
235 <arg value="."/>
236 </exec>
237 <echo>Updating ${plugin.jar} ...</echo>
238 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
239 <env key="LANG" value="C"/>
240 <arg value="up"/>
241 <arg value="../dist/${plugin.jar}"/>
242 </exec>
243 </target>
244
245 <!--
246 ** commits the plugin.jar
247 -->
248 <target name="commit-dist">
249 <echo>
250 ***** Properties of published ${plugin.jar} *****
251 Commit message : '${commit.message}'
252 Plugin-Mainversion: ${plugin.main.version}
253 JOSM build version: ${coreversion.info.entry.revision}
254 Plugin-Version : ${version.entry.commit.revision}
255 ***** / Properties of published ${plugin.jar} *****
256
257 Now commiting ${plugin.jar} ...
258 </echo>
259 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
260 <env key="LANG" value="C"/>
261 <arg value="-m '${commit.message}'"/>
262 <arg value="commit"/>
263 <arg value="${plugin.jar}"/>
264 </exec>
265 </target>
266
267 <!-- ** make sure svn is present as a command line tool ** -->
268 <target name="ensure-svn-present">
269 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
270 <env key="LANG" value="C" />
271 <arg value="--version" />
272 </exec>
273 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
274 <!-- return code not set at all? Most likely svn isn't installed -->
275 <condition>
276 <not>
277 <isset property="svn.exit.code" />
278 </not>
279 </condition>
280 </fail>
281 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
282 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
283 <condition>
284 <isfailure code="${svn.exit.code}" />
285 </condition>
286 </fail>
287 </target>
288
289 <target name="publish"> <!-- depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist" -->
290 <echo>No normal josm-plugin, publishing over smed !!!
291 1. ant - dist to each subplugin
292 2. ant publish to smed
293 </echo>
294 </target>
295</project>
296
Note: See TracBrowser for help on using the repository browser.