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