source: osm/applications/editors/josm/plugins/trustosm/build.xml@ 29734

Last change on this file since 29734 was 29435, checked in by stoecker, 12 years ago

i18n update

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