1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!--
|
---|
3 | ** This is the build file for the multipoly-convert 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 | -->
|
---|
30 | <project name="multipoly-convert" default="dist" basedir=".">
|
---|
31 |
|
---|
32 |
|
---|
33 | <!-- enter the SVN commit message -->
|
---|
34 | <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
|
---|
35 | <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
|
---|
36 | <property name="plugin.main.version" value="2830" />
|
---|
37 |
|
---|
38 |
|
---|
39 | <!-- compilation properties -->
|
---|
40 | <property name="josm.build.dir" value="../../core" />
|
---|
41 | <property name="josm.home.dir" value="${user.home}/.josm" />
|
---|
42 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
---|
43 | <property name="plugin.build.dir" value="build" />
|
---|
44 | <property name="plugin.dist.dir" value="../../dist" />
|
---|
45 | <property name="plugin.name" value="${ant.project.name}" />
|
---|
46 | <property name="plugin.jar" value="${plugin.dist.dir}/${plugin.name}.jar" />
|
---|
47 |
|
---|
48 | <!-- There's no josm.jar in the svn, so point "josm" to a local copy of your JOSM binary -->
|
---|
49 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
---|
50 |
|
---|
51 | <property name="ant.build.javac.target" value="1.5" />
|
---|
52 |
|
---|
53 | <target name="init">
|
---|
54 | <mkdir dir="${plugin.build.dir}">
|
---|
55 | </mkdir>
|
---|
56 | <mkdir dir="${plugin.dist.dir}">
|
---|
57 | </mkdir>
|
---|
58 | </target>
|
---|
59 |
|
---|
60 | <target name="compile" depends="init">
|
---|
61 | <echo message="creating ${plugin.jar}" />
|
---|
62 | <javac srcdir="src" target="1.5" classpath="${josm}" destdir="build" debug="true">
|
---|
63 | <include name="**/*.java" />
|
---|
64 | </javac>
|
---|
65 | </target>
|
---|
66 |
|
---|
67 | <target name="revision">
|
---|
68 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
69 | <env key="LANG" value="C" />
|
---|
70 | <arg value="info" />
|
---|
71 | <arg value="--xml" />
|
---|
72 | <arg value="." />
|
---|
73 | </exec>
|
---|
74 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
---|
75 | <delete file="REVISION" />
|
---|
76 | </target>
|
---|
77 |
|
---|
78 | <target name="dist" depends="compile,revision">
|
---|
79 | <copy todir="${plugin.build.dir}/images">
|
---|
80 | <fileset dir="images" />
|
---|
81 | </copy>
|
---|
82 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
83 | <manifest>
|
---|
84 | <attribute name="Author" value="Stéphane Brunner" />
|
---|
85 | <attribute name="Plugin-Class" value="converttomultipoly.MultipolyPlugin" />
|
---|
86 | <attribute name="Plugin-Description" value="Simply convert an area to a multipolygon." />
|
---|
87 | <attribute name="Plugin-Icon" value="images/multipoly_convert.png"/>
|
---|
88 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
---|
89 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
90 | <attribute name="Plugin-Link" value="http://www.stephane-brunner.ch/mediawiki/index.php/Plugins" />
|
---|
91 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
---|
92 | <!--attribute name="2830_Plugin-Url" value="20583;http://trac.openstreetmap.org/browser/applications/editors/josm/dist/multipoly-convert.jar?rev=20584&format=raw" /-->
|
---|
93 | </manifest>
|
---|
94 | </jar>
|
---|
95 | </target>
|
---|
96 |
|
---|
97 | <target name="clean">
|
---|
98 | <delete dir="${plugin.build.dir}" />
|
---|
99 | <delete file="${plugin.jar}" />
|
---|
100 | </target>
|
---|
101 |
|
---|
102 | <target name="clean_install">
|
---|
103 | <delete file="${plugins}/multipoly-convert.jar" />
|
---|
104 | </target>
|
---|
105 |
|
---|
106 | <target name="install" depends="dist">
|
---|
107 | <property environment="env" />
|
---|
108 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
109 | <and>
|
---|
110 | <os family="windows" />
|
---|
111 | </and>
|
---|
112 | </condition>
|
---|
113 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
---|
114 | </target>
|
---|
115 |
|
---|
116 | <!--
|
---|
117 | ************************** Publishing the plugin ***********************************
|
---|
118 | -->
|
---|
119 | <!--
|
---|
120 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
121 | ** property ${coreversion.info.entry.revision}
|
---|
122 | **
|
---|
123 | -->
|
---|
124 | <target name="core-info">
|
---|
125 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
126 | <env key="LANG" value="C" />
|
---|
127 | <arg value="info" />
|
---|
128 | <arg value="--xml" />
|
---|
129 | <arg value="../../core" />
|
---|
130 | </exec>
|
---|
131 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
|
---|
132 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
133 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
134 | <delete file="core.info.xml" />
|
---|
135 | </target>
|
---|
136 |
|
---|
137 | <!--
|
---|
138 | ** commits the source tree for this plugin
|
---|
139 | -->
|
---|
140 | <target name="commit-current">
|
---|
141 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
142 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
143 | <env key="LANG" value="C" />
|
---|
144 | <arg value="commit" />
|
---|
145 | <arg value="-m '${commit.message}'" />
|
---|
146 | <arg value="." />
|
---|
147 | </exec>
|
---|
148 | </target>
|
---|
149 |
|
---|
150 | <!--
|
---|
151 | ** updates (svn up) the source tree for this plugin
|
---|
152 | -->
|
---|
153 | <target name="update-current">
|
---|
154 | <echo>Updating plugin source ...</echo>
|
---|
155 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
156 | <env key="LANG" value="C" />
|
---|
157 | <arg value="up" />
|
---|
158 | <arg value="." />
|
---|
159 | </exec>
|
---|
160 | <echo>Updating ${plugin.jar} ...</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="../dist/${plugin.jar}" />
|
---|
165 | </exec>
|
---|
166 | </target>
|
---|
167 |
|
---|
168 | <!--
|
---|
169 | ** commits the plugin.jar
|
---|
170 | -->
|
---|
171 | <target name="commit-dist">
|
---|
172 | <echo>
|
---|
173 | ***** Properties of published ${plugin.jar} *****
|
---|
174 | Commit message : '${commit.message}'
|
---|
175 | Plugin-Mainversion: ${plugin.main.version}
|
---|
176 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
177 | Plugin-Version : ${version.entry.commit.revision}
|
---|
178 | ***** / Properties of published ${plugin.jar} *****
|
---|
179 |
|
---|
180 | Now commiting ${plugin.jar} ...
|
---|
181 | </echo>
|
---|
182 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
183 | <env key="LANG" value="C" />
|
---|
184 | <arg value="-m '${commit.message}'" />
|
---|
185 | <arg value="commit" />
|
---|
186 | <arg value="${plugin.jar}" />
|
---|
187 | </exec>
|
---|
188 | </target>
|
---|
189 |
|
---|
190 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
191 | <target name="ensure-svn-present">
|
---|
192 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
193 | <env key="LANG" value="C" />
|
---|
194 | <arg value="--version" />
|
---|
195 | </exec>
|
---|
196 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
197 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
198 | <condition>
|
---|
199 | <not>
|
---|
200 | <isset property="svn.exit.code" />
|
---|
201 | </not>
|
---|
202 | </condition>
|
---|
203 | </fail>
|
---|
204 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
205 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
206 | <condition>
|
---|
207 | <isfailure code="${svn.exit.code}" />
|
---|
208 | </condition>
|
---|
209 | </fail>
|
---|
210 | </target>
|
---|
211 |
|
---|
212 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
213 | </target>
|
---|
214 |
|
---|
215 | </project>
|
---|