source: osm/applications/editors/josm/plugins/alignways/build.xml@ 21614

Last change on this file since 21614 was 21614, checked in by tilusnet, 14 years ago

Missed "project name" in build.xml

File size: 9.2 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="alignways" default="dist" basedir=".">
31
32 <!-- enter the SVN commit message -->
33 <property name="commit.message" value="Initial release" />
34 <!--
35 enter the *lowest* JOSM version this plugin is currently compatible
36 with
37 -->
38 <property name="plugin.main.version" value="3208" />
39
40
41 <!--
42 ************************************************ ** should not be
43 necessary to change the following properties
44 -->
45 <property name="josm" location="../../core/dist/josm-custom.jar" />
46 <property name="plugin.build.dir" value="build" />
47 <property name="plugin.src.dir" value="src" />
48 <property name="plugin.lib.dir" value="lib" />
49 <!-- this is the directory where the plugin jar is copied to -->
50 <property name="plugin.dist.dir" value="../../dist" />
51 <property name="ant.build.javac.target" value="1.5" />
52 <property name="plugin.dist.dir" value="../../dist" />
53 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
54
55 <!--
56 ********************************************************** ** init -
57 initializes the build
58 **********************************************************
59 -->
60 <target name="init">
61 <mkdir dir="${plugin.build.dir}" />
62 </target>
63
64 <!--
65 ********************************************************** ** compile
66 - complies the source tree
67 **********************************************************
68 -->
69 <target name="compile" depends="init">
70 <echo message="compiling sources for ${plugin.jar} ... " />
71 <javac srcdir="src" classpath="${josm};${plugin.lib.dir}" debug="true"
72 destdir="${plugin.build.dir}">
73 <compilerarg value="-Xlint:deprecation" />
74 <compilerarg value="-Xlint:unchecked" />
75 </javac>
76 <copy todir="${plugin.build.dir}">
77 <fileset dir="lib" />
78 </copy>
79 </target>
80
81 <!--
82 ********************************************************** ** dist -
83 creates the plugin jar
84 **********************************************************
85 -->
86 <target name="dist" depends="compile,revision">
87 <echo message="creating ${ant.project.name}.jar ... " />
88 <copy todir="${plugin.build.dir}/resources">
89 <fileset dir="resources" />
90 </copy>
91 <copy todir="${plugin.build.dir}/images">
92 <fileset dir="images" />
93 </copy>
94 <copy todir="${plugin.build.dir}">
95 <fileset dir=".">
96 <include name="README" />
97 <include name="LICENSE" />
98 </fileset>
99 </copy>
100 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
101 <!--
102 ************************************************ ** configure these
103 properties. Most of them will be copied to the plugins ** manifest
104 file. Property values will also show up in the list available **
105 plugins: http://josm.openstreetmap.de/wiki/Plugins. **
106 ************************************************
107 -->
108 <manifest>
109 <attribute name="Author" value="Attila Szász" />
110 <attribute name="Plugin-Class"
111 value="org.openstreetmap.josm.plugins.alignways.AlignWaysPlugin" />
112 <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
113 <attribute name="Plugin-Description"
114 value="Makes a pair of selected way segments parallel by rotating one of them around a chosen pivot." />
115 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
116 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
117 <attribute name="Plugin-Link"
118 value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AlignWayS" />
119 </manifest>
120 </jar>
121 </target>
122
123 <!--
124 ********************************************************** ** revision
125 - extracts the current revision number for the ** file build.number
126 and stores it in the XML property ** version.*
127 **********************************************************
128 -->
129 <target name="revision">
130
131 <exec append="false" output="REVISION" executable="svn"
132 failifexecutionfails="false">
133 <env key="LANG" value="C" />
134 <arg value="info" />
135 <arg value="--xml" />
136 <arg value="." />
137 </exec>
138 <xmlproperty file="REVISION" prefix="version" keepRoot="false"
139 collapseAttributes="true" />
140 <delete file="REVISION" />
141 </target>
142
143 <!--
144 ********************************************************** ** clean -
145 clean up the build environment
146 **********************************************************
147 -->
148 <target name="clean">
149 <delete dir="${plugin.build.dir}" />
150 <delete file="${plugin.jar}" />
151 </target>
152
153 <!--
154 ********************************************************** ** install
155 - install the plugin in your local JOSM installation
156 **********************************************************
157 -->
158 <target name="install" depends="dist">
159 <property environment="env" />
160 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins"
161 else="${user.home}/.josm/plugins">
162 <and>
163 <os family="windows" />
164 </and>
165 </condition>
166 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
167 </target>
168
169
170 <!--
171 ************************** Publishing the plugin
172 ***********************************
173 -->
174 <!--
175 ** extracts the JOSM release for the JOSM version in ../core and saves
176 it in the ** property ${coreversion.info.entry.revision} **
177 -->
178 <target name="core-info">
179 <exec append="false" output="core.info.xml" executable="svn"
180 failifexecutionfails="false">
181 <env key="LANG" value="C" />
182 <arg value="info" />
183 <arg value="--xml" />
184 <arg value="../../core" />
185 </exec>
186 <xmlproperty file="core.info.xml" prefix="coreversion"
187 keepRoot="true" collapseAttributes="true" />
188 <echo>Building against core revision
189 ${coreversion.info.entry.revision}.</echo>
190 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
191 <delete file="core.info.xml" />
192 </target>
193
194 <!--
195 ** commits the source tree for this plugin
196 -->
197 <target name="commit-current">
198 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
199 <exec append="true" output="svn.log" executable="svn"
200 failifexecutionfails="false">
201 <env key="LANG" value="C" />
202 <arg value="commit" />
203 <arg value="-m '${commit.message}'" />
204 <arg value="." />
205 </exec>
206 </target>
207
208 <!--
209 ** updates (svn up) the source tree for this plugin
210 -->
211 <target name="update-current">
212 <echo>Updating plugin source ...</echo>
213 <exec append="true" output="svn.log" executable="svn"
214 failifexecutionfails="false">
215 <env key="LANG" value="C" />
216 <arg value="up" />
217 <arg value="." />
218 </exec>
219 <echo>Updating ${plugin.jar} ...</echo>
220 <exec append="true" output="svn.log" executable="svn"
221 failifexecutionfails="false">
222 <env key="LANG" value="C" />
223 <arg value="up" />
224 <arg value="../dist/${plugin.jar}" />
225 </exec>
226 </target>
227
228 <!--
229 ** commits the plugin.jar
230 -->
231 <target name="commit-dist">
232 <echo>
233 ***** Properties of published ${plugin.jar} *****
234 Commit message
235 : '${commit.message}'
236 Plugin-Mainversion: ${plugin.main.version}
237 JOSM
238 build version: ${coreversion.info.entry.revision}
239 Plugin-Version :
240 ${version.entry.commit.revision}
241 ***** / Properties of published
242 ${plugin.jar} *****
243
244 Now commiting ${plugin.jar} ...
245 </echo>
246 <exec append="true" output="svn.log" executable="svn"
247 failifexecutionfails="false">
248 <env key="LANG" value="C" />
249 <arg value="-m '${commit.message}'" />
250 <arg value="commit" />
251 <arg value="${plugin.jar}" />
252 </exec>
253 </target>
254
255 <!-- ** make sure svn is present as a command line tool ** -->
256 <target name="ensure-svn-present">
257 <exec append="true" output="svn.log" executable="svn"
258 failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
259 <env key="LANG" value="C" />
260 <arg value="--version" />
261 </exec>
262 <fail
263 message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
264 <!-- return code not set at all? Most likely svn isn't installed -->
265 <condition>
266 <not>
267 <isset property="svn.exit.code" />
268 </not>
269 </condition>
270 </fail>
271 <fail
272 message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
273 <!--
274 error code from SVN? Most likely svn is not what we are looking on
275 this system
276 -->
277 <condition>
278 <isfailure code="${svn.exit.code}" />
279 </condition>
280 </fail>
281 </target>
282
283 <target name="publish"
284 depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
285 </target>
286</project>
Note: See TracBrowser for help on using the repository browser.