source: osm/applications/editors/josm/plugins/piclayer/build.xml@ 27403

Last change on this file since 27403 was 27403, checked in by larry0ua, 13 years ago

'PicLayer - now all actions are shown in history and user can undo/redo changes'

File size: 9.3 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
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-->
23<project name="PicLayer" default="dist" basedir=".">
24 <property name="commit.message" value="PicLayer - now all actions are shown in history and user can undo/redo changes"/>
25 <property name="plugin.main.version" value="4669"/>
26 <!--
27 ************************************************
28 ** should not be necessary to change the following properties
29 -->
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.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
37 <!--
38 **********************************************************
39 ** init - initializes the build
40 **********************************************************
41 -->
42 <target name="init">
43 <mkdir dir="${plugin.build.dir}"/>
44 </target>
45 <!--
46 **********************************************************
47 ** compile - complies the source tree
48 **********************************************************
49 -->
50 <target name="compile" depends="init">
51 <echo message="compiling sources for ${ant.project.name} ... "/>
52 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
53 <compilerarg value="-Xlint:deprecation"/>
54 <compilerarg value="-Xlint:unchecked"/>
55 </javac>
56 </target>
57 <!--
58 **********************************************************
59 ** dist - creates the plugin jar
60 **********************************************************
61 -->
62 <target name="dist" depends="compile,revision">
63 <echo message="creating ${plugin.jar} ... "/>
64 <copy todir="${plugin.build.dir}/resources">
65 <fileset dir="resources"/>
66 </copy>
67 <copy todir="${plugin.build.dir}/images">
68 <fileset dir="images"/>
69 </copy>
70 <copy todir="${plugin.build.dir}/data">
71 <fileset dir="data"/>
72 </copy>
73 <copy todir="${plugin.build.dir}">
74 <fileset dir=".">
75 <include name="README"/>
76 <include name="LICENSE"/>
77 </fileset>
78 </copy>
79 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
80 <manifest>
81 <attribute name="Author" value="Tomasz Stelmach"/>
82 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.piclayer.PicLayerPlugin"/>
83 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
84 <attribute name="Plugin-Description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/>
85 <attribute name="Plugin-Icon" value="images/layericon.png"/>
86 <attribute name="Plugin-Link" value="http://josm.openstreetmap.de/wiki/Help/Plugin/PicLayer"/>
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 <!-- extract the SVN revision information for file build.number -->
101 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
102 <env key="LANG" value="C"/>
103 <arg value="info"/>
104 <arg value="--xml"/>
105 <arg value="."/>
106 </exec>
107 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
108 <delete file="REVISION"/>
109 </target>
110 <!--
111 **********************************************************
112 ** clean - clean up the build environment
113 **********************************************************
114 -->
115 <target name="clean">
116 <delete dir="${plugin.build.dir}"/>
117 <delete file="${plugin.jar}"/>
118 </target>
119 <!--
120 **********************************************************
121 ** install - install the plugin in your local JOSM installation
122 **********************************************************
123 -->
124 <target name="install" depends="dist">
125 <property environment="env"/>
126 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
127 <and>
128 <os family="windows"/>
129 </and>
130 </condition>
131 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
132 </target>
133 <!--
134 ************************** Publishing the plugin ***********************************
135 -->
136 <!--
137 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
138 ** property ${coreversion.info.entry.revision}
139 **
140 -->
141 <target name="core-info">
142 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
143 <env key="LANG" value="C"/>
144 <arg value="info"/>
145 <arg value="--xml"/>
146 <arg value="../../core"/>
147 </exec>
148 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
149 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
150 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
151 <delete file="core.info.xml"/>
152 </target>
153 <!--
154 ** commits the source tree for this plugin
155 -->
156 <target name="commit-current">
157 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
158 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
159 <env key="LANG" value="C"/>
160 <arg value="commit"/>
161 <arg value="-m '${commit.message}'"/>
162 <arg value="."/>
163 </exec>
164 </target>
165 <!--
166 ** updates (svn up) the source tree for this plugin
167 -->
168 <target name="update-current">
169 <echo>Updating plugin source ...</echo>
170 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
171 <env key="LANG" value="C"/>
172 <arg value="up"/>
173 <arg value="."/>
174 </exec>
175 <echo>Updating ${plugin.jar} ...</echo>
176 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
177 <env key="LANG" value="C"/>
178 <arg value="up"/>
179 <arg value="../dist/${plugin.jar}"/>
180 </exec>
181 </target>
182 <!--
183 ** commits the plugin.jar
184 -->
185 <target name="commit-dist">
186 <echo>
187 ***** Properties of published ${plugin.jar} *****
188 Commit message : '${commit.message}'
189 Plugin-Mainversion: ${plugin.main.version}
190 JOSM build version: ${coreversion.info.entry.revision}
191 Plugin-Version : ${version.entry.commit.revision}
192 ***** / Properties of published ${plugin.jar} *****
193
194 Now commiting ${plugin.jar} ...
195 </echo>
196 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
197 <env key="LANG" value="C"/>
198 <arg value="-m '${commit.message}'"/>
199 <arg value="commit"/>
200 <arg value="${plugin.jar}"/>
201 </exec>
202 </target>
203 <!-- ** make sure svn is present as a command line tool ** -->
204 <target name="ensure-svn-present">
205 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
206 <env key="LANG" value="C"/>
207 <arg value="--version"/>
208 </exec>
209 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
210 <!-- return code not set at all? Most likely svn isn't installed -->
211 <condition>
212 <not>
213 <isset property="svn.exit.code"/>
214 </not>
215 </condition>
216 </fail>
217 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
218 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
219 <condition>
220 <isfailure code="${svn.exit.code}"/>
221 </condition>
222 </fail>
223 </target>
224 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
225 </target>
226</project>
Note: See TracBrowser for help on using the repository browser.