source: subversion/applications/editors/josm/plugins/epci-fr/build.xml @ 26284

Last change on this file since 26284 was 26281, checked in by donvip, 8 years ago

New JOSM plugin: epci-fr. Its goal is to ease handling of French EPCIs (boundary=local_authority). Works only with JOSM 4209 and above.

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