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

Last change on this file since 29778 was 29778, checked in by akks, 6 years ago

[josm_plugins]: see #josm6355 - Move most of the other plugins to suitable menus, add Netbeans projects

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