source: subversion/applications/editors/josm/plugins/tageditor/build.xml @ 27576

Last change on this file since 27576 was 27576, checked in by akks, 8 years ago

'Tageditor: help shortcut parser, rebuild'

File size: 9.3 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** This is the build file for the tageditor 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 your default plugin directory) run
16**
17**    > ant  install
18**
19** To build against the core in ../../core, create a correct manifest and deploy to
20** SVN,
21**    set the properties commit.message and plugin.main.version
22** and run
23**    > ant  publish
24**
25**
26-->
27<project name="tageditor" default="dist" basedir=".">
28    <property name="commit.message" value="Tageditor:  help shortcut parser, rebuild"/>
29    <property name="plugin.main.version" value="4847"/>
30    <!--
31      ************************************************
32      ** should not be necessary to change the following properties
33     -->
34    <property name="josm" location="../../core/dist/josm-custom.jar"/>
35    <property name="plugin.build.dir" value="build"/>
36    <property name="plugin.src.dir" value="src"/>
37    <!-- this is the directory where the plugin jar is copied to -->
38    <property name="plugin.dist.dir" value="../../dist"/>
39    <property name="ant.build.javac.target" value="1.5"/>
40    <property name="plugin.dist.dir" value="../../dist"/>
41    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
42    <!--
43    **********************************************************
44    ** init - initializes the build
45    **********************************************************
46    -->
47    <target name="init">
48        <mkdir dir="${plugin.build.dir}"/>
49    </target>
50    <!--
51    **********************************************************
52    ** compile - complies the source tree
53    **********************************************************
54    -->
55    <target name="compile" depends="init">
56        <echo message="compiling sources for  ${plugin.jar} ... "/>
57        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
58            <compilerarg value="-Xlint:deprecation"/>
59            <compilerarg value="-Xlint:unchecked"/>
60        </javac>
61    </target>
62    <!--
63    **********************************************************
64    ** dist - creates the plugin jar
65    **********************************************************
66    -->
67    <target name="dist" depends="compile,revision">
68        <echo message="creating ${plugin.jar} for version ${version.entry.commit.revision} ... "/>
69        <copy todir="${plugin.build.dir}/resources">
70            <fileset dir="resources"/>
71        </copy>
72        <copy todir="${plugin.build.dir}/data">
73            <fileset dir="data"/>
74        </copy>
75        <copy todir="${plugin.build.dir}">
76            <fileset dir=".">
77                <include name="README"/>
78                <include name="LICENSE"/>
79            </fileset>
80        </copy>
81        <copy todir="${plugin.build.dir}">
82            <fileset dir="${plugin.src.dir}">
83                <include name="**/*.dtd"/>
84            </fileset>
85        </copy>
86        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
87            <manifest>
88                <attribute name="Author" value="Karl Guggisberg"/>
89                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.tageditor.TagEditorPlugin"/>
90                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
91                <attribute name="Plugin-Description" value="Provides a dialog for editing tags in a tabular grid."/>
92                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/TagEditor"/>
93                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
94                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
95            </manifest>
96        </jar>
97    </target>
98    <!--
99    **********************************************************
100    ** revision - extracts the current revision number for the
101    **    file build.number and stores it in the XML property
102    **    version.*
103    **********************************************************
104    -->
105    <target name="revision">
106        <!-- extract the SVN revision information  -->
107        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
108            <env key="LANG" value="C"/>
109            <arg value="info"/>
110            <arg value="--xml"/>
111            <arg value="."/>
112        </exec>
113        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
114        <delete file="REVISION"/>
115    </target>
116    <!--
117    **********************************************************
118    ** clean - clean up the build environment
119    **********************************************************
120    -->
121    <target name="clean">
122        <delete dir="${plugin.build.dir}"/>
123        <delete file="${plugin.jar}"/>
124    </target>
125    <!--
126    **********************************************************
127    ** install - install the plugin in your local JOSM installation
128    **********************************************************
129    -->
130    <target name="install" depends="dist">
131        <property environment="env"/>
132        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
133            <and>
134                <os family="windows"/>
135            </and>
136        </condition>
137        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
138    </target>
139    <!--
140     ************************** Publishing the plugin ***********************************
141    -->
142    <!--
143    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
144    ** property ${coreversion.info.entry.revision}
145    **
146    -->
147    <target name="core-info">
148        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
149            <env key="LANG" value="C"/>
150            <arg value="info"/>
151            <arg value="--xml"/>
152            <arg value="../../core"/>
153        </exec>
154        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
155        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
156        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
157        <delete file="core.info.xml"/>
158    </target>
159    <!--
160    ** commits the source tree for this plugin
161    -->
162    <target name="commit-current">
163        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
164        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
165            <env key="LANG" value="C"/>
166            <arg value="commit"/>
167            <arg value="-m '${commit.message}'"/>
168            <arg value="."/>
169        </exec>
170    </target>
171    <!--
172    ** updates (svn up) the source tree for this plugin
173    -->
174    <target name="update-current">
175        <echo>Updating plugin source ...</echo>
176        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
177            <env key="LANG" value="C"/>
178            <arg value="up"/>
179            <arg value="."/>
180        </exec>
181        <echo>Updating ${plugin.jar} ...</echo>
182        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
183            <env key="LANG" value="C"/>
184            <arg value="up"/>
185            <arg value="../dist/${plugin.jar}"/>
186        </exec>
187    </target>
188    <!--
189    ** commits the plugin.jar
190    -->
191    <target name="commit-dist">
192        <echo>
193***** Properties of published ${plugin.jar} *****
194Commit message    : '${commit.message}'                 
195Plugin-Mainversion: ${plugin.main.version}
196JOSM build version: ${coreversion.info.entry.revision}
197Plugin-Version    : ${version.entry.commit.revision}
198***** / Properties of published ${plugin.jar} *****                 
199                   
200Now commiting ${plugin.jar} ...
201</echo>
202        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
203            <env key="LANG" value="C"/>
204            <arg value="-m '${commit.message}'"/>
205            <arg value="commit"/>
206            <arg value="${plugin.jar}"/>
207        </exec>
208    </target>
209    <!-- ** make sure svn is present as a command line tool ** -->
210    <target name="ensure-svn-present">
211        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
212            <env key="LANG" value="C"/>
213            <arg value="--version"/>
214        </exec>
215        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
216            <!-- return code not set at all? Most likely svn isn't installed -->
217            <condition>
218                <not>
219                    <isset property="svn.exit.code"/>
220                </not>
221            </condition>
222        </fail>
223        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
224            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
225            <condition>
226                <isfailure code="${svn.exit.code}"/>
227            </condition>
228        </fail>
229    </target>
230    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
231    </target>
232</project>
Note: See TracBrowser for help on using the repository browser.