source: osm/applications/editors/josm/plugins/smed/build.xml@ 27438

Last change on this file since 27438 was 27383, checked in by malcolmh, 13 years ago

'New release'

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