source: subversion/applications/editors/josm/plugins/waydownloader/build.xml @ 26268

Last change on this file since 26268 was 26174, checked in by Dirk Stoecker, 9 years ago

i18n update, split plugin and core translation

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