source: osm/applications/editors/josm/plugins/contourmerge/build.xml@ 25136

Last change on this file since 25136 was 24975, checked in by stoecker, 14 years ago

fix build

File size: 12.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3** This is the build file for the contour 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 your default plugin directory) run
16**
17** > ant install
18**
19** To build against the core in ../../core, create a correct manifest and deploy to
20** SVN,
21** set the properties commit.message and plugin.main.version
22** and run
23** > ant publish
24**
25**
26-->
27<project name="contourmerge" default="dist" basedir=".">
28
29 <property name="commit.message" value="Updating to JOSM 3210" />
30 <property name="plugin.main.version" value="3210" />
31
32 <!--
33 ************************************************
34 ** should not be necessary to change the following properties
35 -->
36 <property name="josm" location="../../core/dist/josm-custom.jar" />
37 <property name="plugin.build.dir" value="build" />
38 <property name="plugin.src.dir" value="src" />
39 <!-- this is the directory where the plugin jar is copied to -->
40 <property name="plugin.dist.dir" value="../../dist" />
41 <property name="ant.build.javac.target" value="1.5" />
42 <property name="plugin.dist.dir" value="../../dist" />
43 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
44
45 <!--
46 **********************************************************
47 ** init - initializes the build
48 **********************************************************
49 -->
50 <target name="init">
51 <mkdir dir="${plugin.build.dir}" />
52 </target>
53
54 <!--
55 **********************************************************
56 ** compile - complies the source tree
57 **********************************************************
58 -->
59 <target name="compile" depends="init">
60 <echo message="compiling sources for ${plugin.jar} ... " />
61 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
62 <compilerarg value="-Xlint:deprecation" />
63 <compilerarg value="-Xlint:unchecked" />
64 </javac>
65 </target>
66
67 <!--
68 **********************************************************
69 ** dist - creates the plugin jar
70 **********************************************************
71 -->
72 <target name="dist" depends="compile,revision">
73 <echo message="creating ${plugin.jar} for version ${version.entry.commit.revision} ... " />
74 <copy todir="${plugin.build.dir}/images">
75 <fileset dir="images">
76 <exclude name="*.svg" />
77 </fileset>
78 </copy>
79 <copy todir="${plugin.build.dir}">
80 <fileset dir=".">
81 <include name="README" />
82 <include name="LICENSE" />
83 </fileset>
84 </copy>
85 <copy todir="${plugin.build.dir}">
86 <fileset dir="${plugin.src.dir}">
87 <include name="**/*.dtd" />
88 </fileset>
89 </copy>
90 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
91 <manifest>
92 <attribute name="Author" value="Karl Guggisberg" />
93 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.contourmerge.ContourMergePlugin" />
94 <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
95 <attribute name="Plugin-Description" value="Merges the contours of two areas" />
96 <attribute name="Plugin-Icon" value="images/mapmode/contourmerge.png" />
97 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/ContourMerge" />
98 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
99 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
100 </manifest>
101 </jar>
102 </target>
103
104 <!--
105 **********************************************************
106 ** revision - extracts the current revision number for the
107 ** file build.number and stores it in the XML property
108 ** version.*
109 **********************************************************
110 -->
111 <target name="revision">
112 <!-- extract the SVN revision information -->
113 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
114 <env key="LANG" value="C" />
115 <arg value="info" />
116 <arg value="--xml" />
117 <arg value="." />
118 </exec>
119 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
120 <delete file="REVISION" />
121 </target>
122
123 <!--
124 **********************************************************
125 ** clean - clean up the build environment
126 **********************************************************
127 -->
128 <target name="clean">
129 <delete dir="${plugin.build.dir}" />
130 <delete file="${plugin.jar}" />
131 </target>
132
133 <!--
134 **********************************************************
135 ** install - install the plugin in your local JOSM installation
136 **********************************************************
137 -->
138 <target name="install" depends="dist">
139 <property environment="env" />
140 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
141 <and>
142 <os family="windows" />
143 </and>
144 </condition>
145 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
146 </target>
147
148 <!--
149 ************************** Publishing the plugin ***********************************
150 -->
151 <!--
152 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
153 ** property ${coreversion.info.entry.revision}
154 **
155 -->
156 <target name="core-info">
157 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
158 <env key="LANG" value="C" />
159 <arg value="info" />
160 <arg value="--xml" />
161 <arg value="../../core" />
162 </exec>
163 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
164 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
165 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
166 <delete file="core.info.xml" />
167 </target>
168
169 <!--
170 ** commits the source tree for this plugin
171 -->
172 <target name="commit-current">
173 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
174 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
175 <env key="LANG" value="C" />
176 <arg value="commit" />
177 <arg value="-m '${commit.message}'" />
178 <arg value="." />
179 </exec>
180 </target>
181
182 <!--
183 ** updates (svn up) the source tree for this plugin
184 -->
185 <target name="update-current">
186 <echo>Updating plugin source ...</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="." />
191 </exec>
192 <echo>Updating ${plugin.jar} ...</echo>
193 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
194 <env key="LANG" value="C" />
195 <arg value="up" />
196 <arg value="../dist/${plugin.jar}" />
197 </exec>
198 </target>
199
200 <!--
201 ** commits the plugin.jar
202 -->
203 <target name="commit-dist">
204 <echo>
205***** Properties of published ${plugin.jar} *****
206Commit message : '${commit.message}'
207Plugin-Mainversion: ${plugin.main.version}
208JOSM build version: ${coreversion.info.entry.revision}
209Plugin-Version : ${version.entry.commit.revision}
210***** / Properties of published ${plugin.jar} *****
211
212Now commiting ${plugin.jar} ...
213</echo>
214 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
215 <env key="LANG" value="C" />
216 <arg value="-m '${commit.message}'" />
217 <arg value="commit" />
218 <arg value="${plugin.jar}" />
219 </exec>
220 </target>
221
222 <!-- ** make sure svn is present as a command line tool ** -->
223 <target name="ensure-svn-present">
224 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
225 <env key="LANG" value="C" />
226 <arg value="--version" />
227 </exec>
228 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
229 <!-- return code not set at all? Most likely svn isn't installed -->
230 <condition>
231 <not>
232 <isset property="svn.exit.code" />
233 </not>
234 </condition>
235 </fail>
236 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
237 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
238 <condition>
239 <isfailure code="${svn.exit.code}" />
240 </condition>
241 </fail>
242 </target>
243
244 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
245 </target>
246
247 <!-- ************************************************************************************ -->
248 <!-- * Targets for compiling and running tests -->
249 <!-- ************************************************************************************ -->
250 <property name="eclipse.plugin.dir" value="C:\software\eclipse-3.6.1\plugins" />
251 <property name="test.build.dir" value="test/build" />
252
253 <path id="groovy.path">
254 <pathelement location="${eclipse.plugin.dir}/org.codehaus.groovy_1.7.5.xx-20100926-2000-e36-RC1\lib\groovy-all-1.7.5.jar" />
255 </path>
256
257 <path id="junit.path">
258 <pathelement location="${eclipse.plugin.dir}/org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar" />
259 </path>
260
261 <!-- groovy dependency: groovy fails unless hamcrest is on the path -->
262 <path id="hamcrest.path">
263 <pathelement location="test/lib/hamcrest-all-1.3.0RC2.jar" />
264 </path>
265
266 <path id="test.class.path">
267 <pathelement location="${josm}" />
268 <pathelement location="${plugin.build.dir}" />
269 <path refid="groovy.path" />
270 <path refid="junit.path" />
271 </path>
272
273 <path id="groovyc.path">
274 <path refid="junit.path" />
275 <path refid="groovy.path" />
276 <path refid="hamcrest.path" />
277 <pathelement location="${josm}" />
278 <pathelement location="${test.build.dir}" />
279 <pathelement location="${plugin.build.dir}" />
280 <!-- if we didn't explicitly put hamcrest on the class path, groovyc would
281 abort and report it is missing a hamcrest class -->
282 <pathelement location="test/lib/hamcrest-all-1.2.jar" />
283 </path>
284
285 <target name="test-clean">
286 <delete dir="${test.build.dir}" />
287 <mkdir dir="${test.build.dir}" />
288 </target>
289
290 <target name="test-compile" depends="compile,test-clean" description="Compiles the test files">
291
292 <available classname="org.codehaus.groovy.ant.Groovy" classpathref="groovyc.path" property="groovy.present" />
293 <fail message="Groovy not found. Make sure groovy is on the classpath. Check 'groovy.path' in this build file." unless="groovy.present" />
294
295 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.path" />
296
297 <echo message="compiling test infrastructur for ${plugin.jar} ... " />
298 <javac srcdir="test/src" classpathref="test.class.path" debug="true" destdir="${test.build.dir}" includes="org/openstreetmap/josm/plugins/contourmerge/fixtures/**/*">
299 <compilerarg value="-Xlint:deprecation" />
300 <compilerarg value="-Xlint:unchecked" />
301 </javac>
302
303 <echo message="compiling groovy test cases for ${plugin.jar} ... " />
304 <groovyc srcdir="test/src" destdir="${test.build.dir}" classpathref="groovyc.path">
305 </groovyc>
306
307 <echo message="compiling java test cases for ${plugin.jar} ... " />
308 <javac srcdir="test/src" classpathref="test.class.path" debug="true" destdir="${test.build.dir}">
309 <compilerarg value="-Xlint:deprecation" />
310 <compilerarg value="-Xlint:unchecked" />
311 </javac>
312 </target>
313
314 <target name="test-run" depends="test-compile" description="Runs the junit tests">
315 <delete dir="test/output" />
316 <mkdir dir="test/output" />
317
318 <junit printsummary="true" failureproperty="junit.failure">
319 <classpath>
320 <path refid="groovyc.path" />
321 <pathelement location="test/config" />
322 <!-- required for test config file -->
323 <pathelement location="." />
324 <!-- required to load images from subdir 'images/' -->
325 </classpath>
326
327 <test todir="test/output" name='org.openstreetmap.josm.plugins.contourmerge.AllUnitTests'>
328 <formatter type="xml" />
329 </test>
330 </junit>
331 </target>
332
333 <target name="dev-install" depends="dist">
334 <copy file="${plugin.jar}" todir="C:/data/projekte/osm/josm-dev/plugins" />
335 </target>
336</project>
Note: See TracBrowser for help on using the repository browser.