source: osm/applications/editors/josm/plugins/CommandLine/build.xml@ 25107

Last change on this file since 25107 was 25060, checked in by hind, 14 years ago

Moar bugfixes

File size: 9.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project name="CommandLine" default="dist" basedir=".">
3
4 <!-- enter the SVN commit message -->
5 <property name="commit.message" value="Moar bugfixes" />
6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
7 <property name="plugin.main.version" value="3751" />
8
9
10 <!--
11 ************************************************
12 ** should not be necessary to change the following properties
13 -->
14 <property name="josm" location="../../core/dist/josm-custom.jar"/>
15 <property name="plugin.build.dir" value="build"/>
16 <property name="plugin.src.dir" value="src"/>
17 <!-- this is the directory where the plugin jar is copied to -->
18 <property name="plugin.dist.dir" value="../../dist"/>
19 <property name="ant.build.javac.target" value="1.5"/>
20 <property name="plugin.dist.dir" value="../../dist"/>
21 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
22
23 <!--
24 **********************************************************
25 ** init - initializes the build
26 **********************************************************
27 -->
28 <target name="init">
29 <mkdir dir="${plugin.build.dir}"/>
30 </target>
31
32 <!--
33 **********************************************************
34 ** compile - complies the source tree
35 **********************************************************
36 -->
37 <target name="compile" depends="init">
38 <echo message="compiling sources for ${plugin.jar} ... "/>
39 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
40 <compilerarg value="-Xlint:deprecation"/>
41 <compilerarg value="-Xlint:unchecked"/>
42 </javac>
43 </target>
44
45 <!--
46 **********************************************************
47 ** dist - creates the plugin jar
48 **********************************************************
49 -->
50 <target name="dist" depends="compile,revision">
51 <echo message="creating ${ant.project.name}.jar ... "/>
52 <copy todir="${plugin.build.dir}/resources">
53 <fileset dir="resources"/>
54 </copy>
55 <copy todir="${plugin.build.dir}/images">
56 <fileset dir="images"/>
57 </copy>
58 <copy todir="${plugin.build.dir}">
59 <fileset dir=".">
60 <include name="README" />
61 <include name="LICENSE" />
62 </fileset>
63 </copy>
64 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
65 <!--
66 ************************************************
67 ** configure these properties. Most of them will be copied to the plugins
68 ** manifest file. Property values will also show up in the list available
69 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
70 **
71 ************************************************
72 -->
73 <manifest>
74 <attribute name="Author" value="Hind"/>
75 <attribute name="Plugin-Class" value="CommandLine.CommandLine"/>
76 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
77 <attribute name="Plugin-Description" value="Implements a command line and enables to create your commands. See link for standard commands (arc, circle etc.)"/>
78 <attribute name="ru_Plugin-Description" value="Реализует командную строку с возможностью создания своих команд. Стандартные команды можно скачать по ссылке."/>
79 <attribute name="Plugin-Icon" value="images/commandline.png"/>
80 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/CommandLine"/>
81 <attribute name="ru_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/RU:JOSM/Plugins/CommandLine"/>
82 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
83 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
84 </manifest>
85 </jar>
86 </target>
87
88 <!--
89 **********************************************************
90 ** revision - extracts the current revision number for the
91 ** file build.number and stores it in the XML property
92 ** version.*
93 **********************************************************
94 -->
95 <target name="revision">
96
97 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
98 <env key="LANG" value="C"/>
99 <arg value="info"/>
100 <arg value="--xml"/>
101 <arg value="."/>
102 </exec>
103 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
104 <delete file="REVISION"/>
105 </target>
106
107 <!--
108 **********************************************************
109 ** clean - clean up the build environment
110 **********************************************************
111 -->
112 <target name="clean">
113 <delete dir="${plugin.build.dir}"/>
114 <delete file="${plugin.jar}"/>
115 </target>
116
117 <!--
118 **********************************************************
119 ** install - install the plugin in your local JOSM installation
120 **********************************************************
121 -->
122 <target name="install" depends="dist">
123 <property environment="env"/>
124 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
125 <and>
126 <os family="windows"/>
127 </and>
128 </condition>
129 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
130 </target>
131
132
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 <!--
155 ** commits the source tree for this plugin
156 -->
157 <target name="commit-current">
158 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
159 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
160 <env key="LANG" value="C"/>
161 <arg value="commit"/>
162 <arg value="-m '${commit.message}'"/>
163 <arg value="."/>
164 </exec>
165 </target>
166
167 <!--
168 ** updates (svn up) the source tree for this plugin
169 -->
170 <target name="update-current">
171 <echo>Updating plugin source ...</echo>
172 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
173 <env key="LANG" value="C"/>
174 <arg value="up"/>
175 <arg value="."/>
176 </exec>
177 <echo>Updating ${plugin.jar} ...</echo>
178 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
179 <env key="LANG" value="C"/>
180 <arg value="up"/>
181 <arg value="../dist/${plugin.jar}"/>
182 </exec>
183 </target>
184
185 <!--
186 ** commits the plugin.jar
187 -->
188 <target name="commit-dist">
189 <echo>
190 ***** Properties of published ${plugin.jar} *****
191 Commit message : '${commit.message}'
192 Plugin-Mainversion: ${plugin.main.version}
193 JOSM build version: ${coreversion.info.entry.revision}
194 Plugin-Version : ${version.entry.commit.revision}
195 ***** / Properties of published ${plugin.jar} *****
196
197 Now commiting ${plugin.jar} ...
198 </echo>
199 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
200 <env key="LANG" value="C"/>
201 <arg value="-m '${commit.message}'"/>
202 <arg value="commit"/>
203 <arg value="${plugin.jar}"/>
204 </exec>
205 </target>
206
207 <!-- ** make sure svn is present as a command line tool ** -->
208 <target name="ensure-svn-present">
209 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
210 <env key="LANG" value="C" />
211 <arg value="--version" />
212 </exec>
213 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
214 <!-- return code not set at all? Most likely svn isn't installed -->
215 <condition>
216 <not>
217 <isset property="svn.exit.code" />
218 </not>
219 </condition>
220 </fail>
221 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
222 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
223 <condition>
224 <isfailure code="${svn.exit.code}" />
225 </condition>
226 </fail>
227 </target>
228
229 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
230 </target>
231</project>
Note: See TracBrowser for help on using the repository browser.