source: osm/applications/editors/josm/plugins/proj4j/build.xml@ 25832

Last change on this file since 25832 was 25454, checked in by stoecker, 14 years ago

fix build issues

File size: 10.9 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="proj4j" default="dist" basedir=".">
31
32 <!-- read build.properties for local settings -->
33 <property file="build.properties" />
34 <!-- enter the SVN command file name -->
35 <property name="svn" value="svn" />
36 <!-- enter the SVN commit message -->
37 <property name="commit.message" value="Commit message" />
38 <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
39 <property name="plugin.main.version" value="3872" />
40
41 <property name="libproj4j" value="lib/proj4j-0.1.0.jar"/>
42
43 <!--
44 ************************************************
45 ** should not be necessary to change the following properties
46 -->
47 <property name="josm" location="../../core/dist/josm-custom.jar"/>
48 <property name="plugin.build.dir" value="build"/>
49 <property name="plugin.src.dir" value="src"/>
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.dist.dir" value="../../dist"/>
54 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
55
56 <!--
57 **********************************************************
58 ** init - initializes the build
59 **********************************************************
60 -->
61 <target name="init">
62 <mkdir dir="${plugin.build.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" debug="true" destdir="${plugin.build.dir}">
73 <classpath>
74 <pathelement location="${josm}"/>
75 <pathelement location="${libproj4j}"/>
76 </classpath>
77 <compilerarg value="-Xlint:deprecation"/>
78 <compilerarg value="-Xlint:unchecked"/>
79 </javac>
80 </target>
81
82 <!--
83 **********************************************************
84 ** dist - creates the plugin jar
85 **********************************************************
86 -->
87 <target name="dist" depends="compile,revision">
88 <echo message="creating ${ant.project.name}.jar ... "/>
89 <copy todir="${plugin.build.dir}/resources">
90 <fileset dir="resources"/>
91 </copy>
92 <copy todir="${plugin.build.dir}/images">
93 <fileset dir="images"/>
94 </copy>
95 <copy todir="${plugin.build.dir}">
96 <fileset dir=".">
97 <include name="README" />
98 <include name="LICENSE" />
99 </fileset>
100 </copy>
101 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
102 <!-- All jar files necessary to run plugin (no tests) -->
103 <zipfileset src="${libproj4j}"/>
104 <!--
105 ************************************************
106 ** configure these properties. Most of them will be copied to the plugins
107 ** manifest file. Property values will also show up in the list available
108 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
109 **
110 ************************************************
111 -->
112 <manifest>
113 <attribute name="Author" value="Josh Doe &lt;josh@joshdoe.com&gt;"/>
114 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.proj4j.Proj4J"/>
115 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
116 <attribute name="Plugin-Description" value="adds projections from Proj4J"/>
117 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Proj4J"/>
118 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
119 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
120 </manifest>
121 </jar>
122 </target>
123
124 <!--
125 **********************************************************
126 ** revision - extracts the current revision number for the
127 ** file build.number and stores it in the XML property
128 ** version.*
129 **********************************************************
130 -->
131 <target name="revision">
132
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 **********************************************************
145 ** clean - 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 **********************************************************
155 ** install - 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" else="${user.home}/.josm/plugins">
161 <and>
162 <os family="windows"/>
163 </and>
164 </condition>
165 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
166 </target>
167
168
169 <!--
170 ************************** Publishing the plugin ***********************************
171 -->
172 <!--
173 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
174 ** property ${coreversion.info.entry.revision}
175 **
176 -->
177 <target name="core-info">
178 <exec append="false" output="core.info.xml" executable="${svn}" failifexecutionfails="false">
179 <env key="LANG" value="C"/>
180 <arg value="info"/>
181 <arg value="--xml"/>
182 <arg value="../../core"/>
183 </exec>
184 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
185 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
186 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
187 <delete file="core.info.xml" />
188 </target>
189
190 <!--
191 ** commits the source tree for this plugin
192 -->
193 <target name="commit-current">
194 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
195 <exec append="true" output="svn.log" executable="${svn}" failifexecutionfails="false">
196 <env key="LANG" value="C"/>
197 <arg value="commit"/>
198 <arg value="-m '${commit.message}'"/>
199 <arg value="."/>
200 <arg value="${svn.username_arg}"/>
201 <arg value="${svn.username}"/>
202 <arg value="${svn.password_arg}"/>
203 <arg value="${svn.password}"/>
204 </exec>
205 </target>
206
207 <!--
208 ** updates (svn up) the source tree for this plugin
209 -->
210 <target name="update-current">
211 <echo>Updating plugin source ...</echo>
212 <exec append="true" output="svn.log" executable="${svn}" failifexecutionfails="false">
213 <env key="LANG" value="C"/>
214 <arg value="up"/>
215 <arg value="."/>
216 </exec>
217 <echo>Updating ${plugin.jar} ...</echo>
218 <exec append="true" output="svn.log" executable="${svn}" failifexecutionfails="false">
219 <env key="LANG" value="C"/>
220 <arg value="up"/>
221 <arg value="../dist/${plugin.jar}"/>
222 </exec>
223 </target>
224
225 <!--
226 ** commits the plugin.jar
227 -->
228 <target name="commit-dist">
229 <echo>
230 ***** Properties of published ${plugin.jar} *****
231 Commit message : '${commit.message}'
232 Plugin-Mainversion: ${plugin.main.version}
233 JOSM build version: ${coreversion.info.entry.revision}
234 Plugin-Version : ${version.entry.commit.revision}
235 ***** / Properties of published ${plugin.jar} *****
236
237 Now commiting ${plugin.jar} ...
238 </echo>
239 <exec append="true" output="svn.log" executable="${svn}" failifexecutionfails="false">
240 <env key="LANG" value="C"/>
241 <arg value="-m '${commit.message}'"/>
242 <arg value="commit"/>
243 <arg value="${plugin.jar}"/>
244 <arg value="${svn.username_arg}"/>
245 <arg value="${svn.username}"/>
246 <arg value="${svn.password_arg}"/>
247 <arg value="${svn.password}"/>
248 </exec>
249 </target>
250
251 <!-- ** make sure svn is present as a command line tool ** -->
252 <target name="ensure-svn-present">
253 <exec append="true" output="svn.log" executable="${svn}" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
254 <env key="LANG" value="C" />
255 <arg value="--version" />
256 </exec>
257 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
258 <!-- return code not set at all? Most likely svn isn't installed -->
259 <condition>
260 <not>
261 <isset property="svn.exit.code" />
262 </not>
263 </condition>
264 </fail>
265 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
266 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
267 <condition>
268 <isfailure code="${svn.exit.code}" />
269 </condition>
270 </fail>
271 </target>
272
273 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
274 </target>
275</project>
Note: See TracBrowser for help on using the repository browser.