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

Last change on this file since 27632 was 27242, checked in by stoecker, 13 years ago

update to support core changes

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