source: subversion/applications/editors/josm/plugins/geotools/build.xml @ 28952

Last change on this file since 28952 was 28946, checked in by donvip, 7 years ago

[josm_geotools] fix services configuration and plugin-stage

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