source: subversion/applications/editors/josm/plugins/graphview/build.xml @ 29435

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

i18n update

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