source: subversion/applications/editors/josm/plugins/openvisible/build.xml @ 29210

Last change on this file since 29210 was 27852, checked in by Dirk Stoecker, 7 years ago

fix shortcut deprecation

File size: 7.8 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** This is the build file for the openvisible 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="openvisible" default="dist" basedir=".">
31    <!-- enter the SVN commit message -->
32    <property name="commit.message" value="Changed the constructor signature of the plugin main class; updated build.xml"/>
33    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
34    <property name="plugin.main.version" value="4980"/>
35    <property name="josm" location="../../core/dist/josm-custom.jar"/>
36    <property name="plugin.dist.dir" value="../../dist"/>
37    <property name="plugin.build.dir" value="build"/>
38    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
39    <property name="ant.build.javac.target" value="1.5"/>
40    <target name="init">
41        <mkdir dir="${plugin.build.dir}"/>
42    </target>
43    <target name="compile" depends="init">
44        <echo message="creating ${plugin.jar}"/>
45        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
46            <compilerarg value="-Xlint:deprecation"/>
47            <compilerarg value="-Xlint:unchecked"/>
48        </javac>
49    </target>
50    <target name="dist" depends="compile,revision">
51        <copy todir="${plugin.build.dir}/images">
52            <fileset dir="images"/>
53        </copy>
54        <copy todir="${plugin.build.dir}/data">
55            <fileset dir="data"/>
56        </copy>
57        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
58            <manifest>
59                <attribute name="Author" value="Christof Dallermassl"/>
60                <attribute name="Plugin-Class" value="at.dallermassl.josm.plugin.openvisible.OpenVisiblePlugin"/>
61                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
62                <attribute name="Plugin-Dependencies" value="jgrapht-jdk1.5"/>
63                <attribute name="Plugin-Description" value="Allows opening gpx/osm files that intersect the currently visible screen area"/>
64                <attribute name="Plugin-Icon" value="images/openvisible.png"/>
65                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
66                <attribute name="Plugin-Stage" value="50"/>
67                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
68            </manifest>
69        </jar>
70    </target>
71    <target name="revision">
72        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
73            <env key="LANG" value="C"/>
74            <arg value="info"/>
75            <arg value="--xml"/>
76            <arg value="."/>
77        </exec>
78        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
79        <delete file="REVISION"/>
80    </target>
81    <target name="clean">
82        <delete dir="${plugin.build.dir}"/>
83        <delete file="${plugin.jar}"/>
84    </target>
85    <target name="install" depends="dist">
86        <property environment="env"/>
87        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
88            <and>
89                <os family="windows"/>
90            </and>
91        </condition>
92        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
93    </target>
94    <!--
95    ************************** Publishing the plugin ***********************************
96    -->
97    <!--
98        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
99        ** property ${coreversion.info.entry.revision}
100        **
101        -->
102    <target name="core-info">
103        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
104            <env key="LANG" value="C"/>
105            <arg value="info"/>
106            <arg value="--xml"/>
107            <arg value="../../core"/>
108        </exec>
109        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
110        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
111        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
112        <delete file="core.info.xml"/>
113    </target>
114    <!--
115        ** commits the source tree for this plugin
116        -->
117    <target name="commit-current">
118        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
119        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
120            <env key="LANG" value="C"/>
121            <arg value="commit"/>
122            <arg value="-m '${commit.message}'"/>
123            <arg value="."/>
124        </exec>
125    </target>
126    <!--
127        ** updates (svn up) the source tree for this plugin
128        -->
129    <target name="update-current">
130        <echo>Updating plugin source ...</echo>
131        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
132            <env key="LANG" value="C"/>
133            <arg value="up"/>
134            <arg value="."/>
135        </exec>
136        <echo>Updating ${plugin.jar} ...</echo>
137        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
138            <env key="LANG" value="C"/>
139            <arg value="up"/>
140            <arg value="../dist/${plugin.jar}"/>
141        </exec>
142    </target>
143    <!--
144        ** commits the plugin.jar
145        -->
146    <target name="commit-dist">
147        <echo>
148    ***** Properties of published ${plugin.jar} *****
149    Commit message    : '${commit.message}'                 
150    Plugin-Mainversion: ${plugin.main.version}
151    JOSM build version: ${coreversion.info.entry.revision}
152    Plugin-Version    : ${version.entry.commit.revision}
153    ***** / Properties of published ${plugin.jar} *****                 
154                       
155    Now commiting ${plugin.jar} ...
156    </echo>
157        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
158            <env key="LANG" value="C"/>
159            <arg value="-m '${commit.message}'"/>
160            <arg value="commit"/>
161            <arg value="${plugin.jar}"/>
162        </exec>
163    </target>
164    <!-- ** make sure svn is present as a command line tool ** -->
165    <target name="ensure-svn-present">
166        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
167            <env key="LANG" value="C"/>
168            <arg value="--version"/>
169        </exec>
170        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
171            <!-- return code not set at all? Most likely svn isn't installed -->
172            <condition>
173                <not>
174                    <isset property="svn.exit.code"/>
175                </not>
176            </condition>
177        </fail>
178        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
179            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
180            <condition>
181                <isfailure code="${svn.exit.code}"/>
182            </condition>
183        </fail>
184    </target>
185    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
186    </target>
187</project>
Note: See TracBrowser for help on using the repository browser.