source: osm/applications/editors/josm/plugins/pdfimport/build.xml@ 25260

Last change on this file since 25260 was 25260, checked in by stoecker, 14 years ago

adapt to josm 3872

File size: 7.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3** This is the build file for the pdfimport plugin.
4** Same as build.xml, but uses local version of pdfclown
5**
6** Maintaining versions
7** ====================
8** see README.template
9**
10** Usage
11** =====
12** To build it run
13**
14** > ant dist
15**
16** To install the generated plugin locally (in you default plugin directory) run
17**
18** > ant install
19**
20** The generated plugin jar is not automatically available in JOSMs plugin configuration
21** dialog. You have to check it in first.
22**
23** Use the ant target 'publish' to check in the plugin and make it available to other
24** JOSM users:
25** set the properties commit.message and plugin.main.version
26** and run
27** > ant publish
28**
29**
30-->
31<project name="pdfimport" default="dist" basedir=".">
32
33
34 <!-- enter the SVN commit message -->
35 <property name="commit.message" value="Initial pdfimport version" />
36 <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
37 <property name="plugin.main.version" value="3872" />
38
39
40 <!-- compilation properties -->
41 <property name="josm.build.dir" value="../../core" />
42 <property name="josm.home.dir" value="${user.home}/.josm" />
43 <property name="josm" location="../../core/dist/josm-custom.jar" />
44 <property name="plugin.build.dir" value="build" />
45 <property name="plugin.dist.dir" value="../../dist" />
46 <property name="plugin.name" value="${ant.project.name}" />
47 <property name="libpdf" value="lib/pdfbox.jar"/>
48 <property name="plugin.jar" value="${plugin.dist.dir}/${plugin.name}.jar" />
49
50 <!-- There's no josm.jar in the svn, so point "josm" to a local copy of your JOSM binary -->
51 <property name="josm" location="../../core/dist/josm-custom.jar" />
52
53 <property name="ant.build.javac.target" value="1.5" />
54
55 <target name="init">
56 <mkdir dir="${plugin.build.dir}">
57 </mkdir>
58 <mkdir dir="${plugin.dist.dir}">
59 </mkdir>
60 </target>
61
62 <target name="compile" depends="init">
63 <echo message="creating ${plugin.jar}" />
64 <javac srcdir="src" target="1.5" destdir="build" debug="true">
65 <include name="**/*.java" />
66 <classpath>
67 <pathelement location="${josm}"/>
68 <pathelement location="${libpdf}"/>
69 </classpath>
70 </javac>
71 </target>
72
73 <target name="revision">
74 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
75 <env key="LANG" value="C" />
76 <arg value="info" />
77 <arg value="--xml" />
78 <arg value="." />
79 </exec>
80 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
81 <delete file="REVISION" />
82 </target>
83
84 <target name="dist" depends="compile,revision">
85 <unjar dest="${plugin.build.dir}" src="${libpdf}"/>
86 <copy todir="${plugin.build.dir}/images">
87 <fileset dir="images" />
88 </copy>
89 <copy todir="${plugin.build.dir}">
90 <fileset dir="resources" />
91 </copy>
92
93 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
94 <manifest>
95 <attribute name="Author" value="extropy" />
96 <attribute name="Plugin-Class" value="pdfimport.PdfImportPlugin" />
97 <attribute name="Plugin-Description" value="Import PDF file and convert to ways." />
98 <attribute name="Plugin-Icon" value="images/pdf_import.png"/>
99 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
100 <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
101 <attribute name="Plugin-Link" value="http://svn.openstreetmap.org/applications/editors/josm/plugins/pdfimport/" />
102 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
103 </manifest>
104 </jar>
105 </target>
106
107 <target name="clean">
108 <delete dir="${plugin.build.dir}" />
109 <delete file="${plugin.jar}" />
110 </target>
111
112 <target name="clean_install">
113 <delete file="${plugins}/pdfimport.jar" />
114 </target>
115
116 <target name="install" depends="dist">
117 <property environment="env" />
118 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
119 <and>
120 <os family="windows" />
121 </and>
122 </condition>
123 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
124 </target>
125
126 <!--
127 ************************** Publishing the plugin ***********************************
128 -->
129 <!--
130 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
131 ** property ${coreversion.info.entry.revision}
132 **
133 -->
134 <target name="core-info">
135 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
136 <env key="LANG" value="C" />
137 <arg value="info" />
138 <arg value="--xml" />
139 <arg value="../../core" />
140 </exec>
141 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
142 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
143 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
144 <delete file="core.info.xml" />
145 </target>
146
147 <!--
148 ** commits the source tree for this plugin
149 -->
150 <target name="commit-current">
151 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
152 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
153 <env key="LANG" value="C" />
154 <arg value="commit" />
155 <arg value="-m '${commit.message}'" />
156 <arg value="." />
157 </exec>
158 </target>
159
160 <!--
161 ** updates (svn up) the source tree for this plugin
162 -->
163 <target name="update-current">
164 <echo>Updating plugin source ...</echo>
165 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
166 <env key="LANG" value="C" />
167 <arg value="up" />
168 <arg value="." />
169 </exec>
170 <echo>Updating ${plugin.jar} ...</echo>
171 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
172 <env key="LANG" value="C" />
173 <arg value="up" />
174 <arg value="../dist/${plugin.jar}" />
175 </exec>
176 </target>
177
178 <!--
179 ** commits the plugin.jar
180 -->
181 <target name="commit-dist">
182 <echo>
183 ***** Properties of published ${plugin.jar} *****
184 Commit message : '${commit.message}'
185 Plugin-Mainversion: ${plugin.main.version}
186 JOSM build version: ${coreversion.info.entry.revision}
187 Plugin-Version : ${version.entry.commit.revision}
188 ***** / Properties of published ${plugin.jar} *****
189
190 Now commiting ${plugin.jar} ...
191 </echo>
192 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
193 <env key="LANG" value="C" />
194 <arg value="-m '${commit.message}'" />
195 <arg value="commit" />
196 <arg value="${plugin.jar}" />
197 </exec>
198 </target>
199
200 <!-- ** make sure svn is present as a command line tool ** -->
201 <target name="ensure-svn-present">
202 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
203 <env key="LANG" value="C" />
204 <arg value="--version" />
205 </exec>
206 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
207 <!-- return code not set at all? Most likely svn isn't installed -->
208 <condition>
209 <not>
210 <isset property="svn.exit.code" />
211 </not>
212 </condition>
213 </fail>
214 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
215 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
216 <condition>
217 <isfailure code="${svn.exit.code}" />
218 </condition>
219 </fail>
220 </target>
221
222 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
223 </target>
224
225</project>
Note: See TracBrowser for help on using the repository browser.