source: subversion/applications/editors/josm/plugins/alignways/build.xml @ 27606

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

'AlignWays?: help shortcut parser'

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