source: osm/applications/editors/josm/plugins/graphview/build.xml@ 24143

Last change on this file since 24143 was 23435, checked in by tordanik, 14 years ago

set proper main version in build.xml

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