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="fix shortcut conflict" />
|
---|
34 | <!--
|
---|
35 | enter the *lowest* JOSM version this plugin is currently compatible
|
---|
36 | with
|
---|
37 | -->
|
---|
38 | <property name="plugin.main.version" value="3600" />
|
---|
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-Icon" value="images/alignways.png"/>
|
---|
116 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
---|
117 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
---|
118 | <attribute name="Plugin-Link"
|
---|
119 | value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AlignWayS" />
|
---|
120 | </manifest>
|
---|
121 | </jar>
|
---|
122 | </target>
|
---|
123 |
|
---|
124 | <!--
|
---|
125 | ********************************************************** ** revision
|
---|
126 | - extracts the current revision number for the ** file build.number
|
---|
127 | and stores it in the XML property ** version.*
|
---|
128 | **********************************************************
|
---|
129 | -->
|
---|
130 | <target name="revision">
|
---|
131 |
|
---|
132 | <exec append="false" output="REVISION" executable="svn"
|
---|
133 | 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"
|
---|
140 | collapseAttributes="true" />
|
---|
141 | <delete file="REVISION" />
|
---|
142 | </target>
|
---|
143 |
|
---|
144 | <!--
|
---|
145 | ********************************************************** ** clean -
|
---|
146 | clean up the build environment
|
---|
147 | **********************************************************
|
---|
148 | -->
|
---|
149 | <target name="clean">
|
---|
150 | <delete dir="${plugin.build.dir}" />
|
---|
151 | <delete file="${plugin.jar}" />
|
---|
152 | </target>
|
---|
153 |
|
---|
154 | <!--
|
---|
155 | ********************************************************** ** install
|
---|
156 | - install the plugin in your local JOSM installation
|
---|
157 | **********************************************************
|
---|
158 | -->
|
---|
159 | <target name="install" depends="dist">
|
---|
160 | <property environment="env" />
|
---|
161 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins"
|
---|
162 | else="${user.home}/.josm/plugins">
|
---|
163 | <and>
|
---|
164 | <os family="windows" />
|
---|
165 | </and>
|
---|
166 | </condition>
|
---|
167 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
---|
168 | </target>
|
---|
169 |
|
---|
170 |
|
---|
171 | <!--
|
---|
172 | ************************** Publishing the plugin
|
---|
173 | ***********************************
|
---|
174 | -->
|
---|
175 | <!--
|
---|
176 | ** extracts the JOSM release for the JOSM version in ../core and saves
|
---|
177 | it in the ** property ${coreversion.info.entry.revision} **
|
---|
178 | -->
|
---|
179 | <target name="core-info">
|
---|
180 | <exec append="false" output="core.info.xml" executable="svn"
|
---|
181 | failifexecutionfails="false">
|
---|
182 | <env key="LANG" value="C" />
|
---|
183 | <arg value="info" />
|
---|
184 | <arg value="--xml" />
|
---|
185 | <arg value="../../core" />
|
---|
186 | </exec>
|
---|
187 | <xmlproperty file="core.info.xml" prefix="coreversion"
|
---|
188 | keepRoot="true" collapseAttributes="true" />
|
---|
189 | <echo>Building against core revision
|
---|
190 | ${coreversion.info.entry.revision}.</echo>
|
---|
191 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
192 | <delete file="core.info.xml" />
|
---|
193 | </target>
|
---|
194 |
|
---|
195 | <!--
|
---|
196 | ** commits the source tree for this plugin
|
---|
197 | -->
|
---|
198 | <target name="commit-current">
|
---|
199 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
200 | <exec append="true" output="svn.log" executable="svn"
|
---|
201 | failifexecutionfails="false">
|
---|
202 | <env key="LANG" value="C" />
|
---|
203 | <arg value="commit" />
|
---|
204 | <arg value="-m '${commit.message}'" />
|
---|
205 | <arg value="." />
|
---|
206 | </exec>
|
---|
207 | </target>
|
---|
208 |
|
---|
209 | <!--
|
---|
210 | ** updates (svn up) the source tree for this plugin
|
---|
211 | -->
|
---|
212 | <target name="update-current">
|
---|
213 | <echo>Updating plugin source ...</echo>
|
---|
214 | <exec append="true" output="svn.log" executable="svn"
|
---|
215 | failifexecutionfails="false">
|
---|
216 | <env key="LANG" value="C" />
|
---|
217 | <arg value="up" />
|
---|
218 | <arg value="." />
|
---|
219 | </exec>
|
---|
220 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
221 | <exec append="true" output="svn.log" executable="svn"
|
---|
222 | failifexecutionfails="false">
|
---|
223 | <env key="LANG" value="C" />
|
---|
224 | <arg value="up" />
|
---|
225 | <arg value="../dist/${plugin.jar}" />
|
---|
226 | </exec>
|
---|
227 | </target>
|
---|
228 |
|
---|
229 | <!--
|
---|
230 | ** commits the plugin.jar
|
---|
231 | -->
|
---|
232 | <target name="commit-dist">
|
---|
233 | <echo>
|
---|
234 | ***** Properties of published ${plugin.jar} *****
|
---|
235 | Commit message
|
---|
236 | : '${commit.message}'
|
---|
237 | Plugin-Mainversion: ${plugin.main.version}
|
---|
238 | JOSM
|
---|
239 | build version: ${coreversion.info.entry.revision}
|
---|
240 | Plugin-Version :
|
---|
241 | ${version.entry.commit.revision}
|
---|
242 | ***** / Properties of published
|
---|
243 | ${plugin.jar} *****
|
---|
244 |
|
---|
245 | Now commiting ${plugin.jar} ...
|
---|
246 | </echo>
|
---|
247 | <exec append="true" output="svn.log" executable="svn"
|
---|
248 | failifexecutionfails="false">
|
---|
249 | <env key="LANG" value="C" />
|
---|
250 | <arg value="-m '${commit.message}'" />
|
---|
251 | <arg value="commit" />
|
---|
252 | <arg value="${plugin.jar}" />
|
---|
253 | </exec>
|
---|
254 | </target>
|
---|
255 |
|
---|
256 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
257 | <target name="ensure-svn-present">
|
---|
258 | <exec append="true" output="svn.log" executable="svn"
|
---|
259 | failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
260 | <env key="LANG" value="C" />
|
---|
261 | <arg value="--version" />
|
---|
262 | </exec>
|
---|
263 | <fail
|
---|
264 | message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
265 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
266 | <condition>
|
---|
267 | <not>
|
---|
268 | <isset property="svn.exit.code" />
|
---|
269 | </not>
|
---|
270 | </condition>
|
---|
271 | </fail>
|
---|
272 | <fail
|
---|
273 | message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
274 | <!--
|
---|
275 | error code from SVN? Most likely svn is not what we are looking on
|
---|
276 | this system
|
---|
277 | -->
|
---|
278 | <condition>
|
---|
279 | <isfailure code="${svn.exit.code}" />
|
---|
280 | </condition>
|
---|
281 | </fail>
|
---|
282 | </target>
|
---|
283 |
|
---|
284 | <target name="publish"
|
---|
285 | depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
286 | </target>
|
---|
287 | </project>
|
---|