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

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

i18n update, split plugin and core translation

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