source: subversion/applications/editors/josm/plugins/smed/plugs/oseam/build.xml @ 26972

Last change on this file since 26972 was 26605, checked in by Dirk Stoecker, 8 years ago

fix build version due to core change

File size: 10.8 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="OSeaM" default="dist" basedir=".">
31    <!-- enter the SVN commit message -->
32    <property name="commit.message" value="some new features in internationalising"/>
33    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
34    <property name="plugin.main.version" value="4394"/>
35    <!-- Declaring  time-stamps-->
36    <tstamp/>
37    <!--
38      ************************************************
39      ** should not be necessary to change the following properties
40     -->
41    <property name="josm" location="../../../../core/dist/josm-custom.jar"/>
42    <property name="smed" location="../../core/dist/smed.jar"/>
43    <property name="plugin.build.dir" value="build"/>
44    <property name="plugin.src.dir" value="src"/>
45    <property name="smed.build.dir" value="../../../smed/build"/>
46    <property name="delete_string" value="*${ant.project.name}.jar"/>
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.jar" value="${plugin.dist.dir}/00_${DSTAMP}_${TSTAMP}_${ant.project.name}.jar"/>
51    <!--
52    **********************************************************
53    ** init - initializes the build
54    **********************************************************
55    -->
56    <target name="init">
57        <mkdir dir="${plugin.build.dir}"/>
58        <mkdir dir="${plugin.dist.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" classpath="${josm}:${smed}" debug="true" destdir="${plugin.build.dir}">
68            <compilerarg value="-Xlint:deprecation"/>
69            <compilerarg value="-Xlint:unchecked"/>
70        </javac>
71    </target>
72    <!--
73    **********************************************************
74    ** dist - creates the plugin jar
75    **********************************************************
76    -->
77    <target name="dist" depends="compile,revision">
78        <echo message="creating ${ant.project.name}.jar ... "/>
79        <copy todir="${plugin.build.dir}/images">
80            <fileset dir="${plugin.src.dir}/images"/>
81        </copy>
82        <copy todir="${plugin.build.dir}/images">
83            <fileset dir="images"/>
84        </copy>
85        <copy todir="${plugin.build.dir}/oseam/msg">
86            <fileset dir="${plugin.src.dir}/oseam/msg"/>
87        </copy>
88        <copy todir="${plugin.build.dir}">
89            <fileset dir=".">
90                <include name="copyright.txt"/>
91                <include name="LICENSE.txt"/>
92            </fileset>
93        </copy>
94        <delete>
95            <fileset dir="${plugin.dist.dir}">
96                <include name="${delete_string}"/>
97            </fileset>
98        </delete>
99        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
100            <!--
101        ************************************************
102        ** configure these properties. Most of them will be copied to the plugins
103        ** manifest file. Property values will also show up in the list available
104        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
105        **
106        ************************************************
107    -->
108            <manifest>
109                <attribute name="Author" value="Werner, Malcolm"/>
110                <attribute name="Plugin-Class" value="toms.Toms"/>
111                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
112                <attribute name="Plugin-Description" value="Create and edit seamarks for OpenSeaMap"/>
113                <attribute name="Plugin-Icon" value="images/Smp.png"/>
114                <attribute name="Plugin-Link" value="http://openseamap.org/"/>
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>
145            <fileset dir="${plugin.dist.dir}">
146                <include name="${delete_string}"/>
147            </fileset>
148        </delete>
149    </target>
150    <!--
151    **********************************************************
152    ** install - install the plugin in your local JOSM installation
153    ** for developing
154    **********************************************************
155    -->
156    <target name="install-develop" depends="dist">
157        <property environment="env"/>
158        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins/splug" else="${user.home}/.josm/plugins/splug">
159            <and>
160                <os family="windows"/>
161            </and>
162        </condition>
163        <delete>
164            <fileset dir="${josm.plugins.dir}">
165                <include name="${delete_string}"/>
166            </fileset>
167        </delete>
168        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
169        <delete file="${plugin.jar}"/>
170    </target>
171    <!--
172    ************************** Publishing the plugin ***********************************
173    -->
174    <!--
175        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
176        ** property ${coreversion.info.entry.revision}
177        **
178        -->
179    <target name="core-info">
180        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
181            <env key="LANG" value="C"/>
182            <arg value="info"/>
183            <arg value="--xml"/>
184            <arg value="../../core"/>
185        </exec>
186        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
187        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
188        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
189        <delete file="core.info.xml"/>
190    </target>
191    <!--
192        ** commits the source tree for this plugin
193        -->
194    <target name="commit-current">
195        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
196        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
197            <env key="LANG" value="C"/>
198            <arg value="commit"/>
199            <arg value="-m '${commit.message}'"/>
200            <arg value="."/>
201        </exec>
202    </target>
203    <!--
204        ** updates (svn up) the source tree for this plugin
205        -->
206    <target name="update-current">
207        <echo>Updating plugin source ...</echo>
208        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
209            <env key="LANG" value="C"/>
210            <arg value="up"/>
211            <arg value="."/>
212        </exec>
213        <echo>Updating ${plugin.jar} ...</echo>
214        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
215            <env key="LANG" value="C"/>
216            <arg value="up"/>
217            <arg value="../dist/${plugin.jar}"/>
218        </exec>
219    </target>
220    <!--
221        ** commits the plugin.jar
222        -->
223    <target name="commit-dist">
224        <echo>
225    ***** Properties of published ${plugin.jar} *****
226    Commit message    : '${commit.message}'                 
227    Plugin-Mainversion: ${plugin.main.version}
228    JOSM build version: ${coreversion.info.entry.revision}
229    Plugin-Version    : ${version.entry.commit.revision}
230    ***** / Properties of published ${plugin.jar} *****                 
231                       
232    Now commiting ${plugin.jar} ...
233    </echo>
234        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
235            <env key="LANG" value="C"/>
236            <arg value="-m '${commit.message}'"/>
237            <arg value="commit"/>
238            <arg value="${plugin.jar}"/>
239        </exec>
240    </target>
241    <!-- ** make sure svn is present as a command line tool ** -->
242    <target name="ensure-svn-present">
243        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
244            <env key="LANG" value="C"/>
245            <arg value="--version"/>
246        </exec>
247        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
248            <!-- return code not set at all? Most likely svn isn't installed -->
249            <condition>
250                <not>
251                    <isset property="svn.exit.code"/>
252                </not>
253            </condition>
254        </fail>
255        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
256            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
257            <condition>
258                <isfailure code="${svn.exit.code}"/>
259            </condition>
260        </fail>
261    </target>
262    <target name="publish">
263        <!-- depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist" -->
264        <echo>No normal josm-plugin, publishing over smed !!!
265            1. ant - dist to each subplugin
266            2. ant publish to smed
267        </echo>
268    </target>
269</project>
Note: See TracBrowser for help on using the repository browser.