source: subversion/applications/editors/josm/plugins/OpeningHoursEditor/build.xml @ 29935

Last change on this file since 29935 was 29854, checked in by donvip, 7 years ago

[josm_plugins] fix #8987 - bump min JOSM version of nearly all plugins to r6162 + code update/cleanup, fix warnings

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