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

Last change on this file since 23982 was 23863, checked in by extropy, 16 years ago

Transition to pdfbox library.

File size: 7.3 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="3592" />
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
90 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
91 <manifest>
92 <attribute name="Author" value="extropy" />
93 <attribute name="Plugin-Class" value="pdfimport.PdfImportPlugin" />
94 <attribute name="Plugin-Description" value="Import PDF file and convert to ways." />
95 <attribute name="Plugin-Icon" value="images/pdf_import.png"/>
96 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
97 <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
98 <attribute name="Plugin-Link" value="http://svn.openstreetmap.org/applications/editors/josm/plugins/pdfimport/" />
99 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
100 </manifest>
101 </jar>
102 </target>
103
104 <target name="clean">
105 <delete dir="${plugin.build.dir}" />
106 <delete file="${plugin.jar}" />
107 </target>
108
109 <target name="clean_install">
110 <delete file="${plugins}/pdfimport.jar" />
111 </target>
112
113 <target name="install" depends="dist">
114 <property environment="env" />
115 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
116 <and>
117 <os family="windows" />
118 </and>
119 </condition>
120 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
121 </target>
122
123 <!--
124 ************************** Publishing the plugin ***********************************
125 -->
126 <!--
127 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
128 ** property ${coreversion.info.entry.revision}
129 **
130 -->
131 <target name="core-info">
132 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
133 <env key="LANG" value="C" />
134 <arg value="info" />
135 <arg value="--xml" />
136 <arg value="../../core" />
137 </exec>
138 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
139 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
140 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
141 <delete file="core.info.xml" />
142 </target>
143
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 <!--
158 ** updates (svn up) the source tree for this plugin
159 -->
160 <target name="update-current">
161 <echo>Updating plugin source ...</echo>
162 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
163 <env key="LANG" value="C" />
164 <arg value="up" />
165 <arg value="." />
166 </exec>
167 <echo>Updating ${plugin.jar} ...</echo>
168 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
169 <env key="LANG" value="C" />
170 <arg value="up" />
171 <arg value="../dist/${plugin.jar}" />
172 </exec>
173 </target>
174
175 <!--
176 ** commits the plugin.jar
177 -->
178 <target name="commit-dist">
179 <echo>
180 ***** Properties of published ${plugin.jar} *****
181 Commit message : '${commit.message}'
182 Plugin-Mainversion: ${plugin.main.version}
183 JOSM build version: ${coreversion.info.entry.revision}
184 Plugin-Version : ${version.entry.commit.revision}
185 ***** / Properties of published ${plugin.jar} *****
186
187 Now commiting ${plugin.jar} ...
188 </echo>
189 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
190 <env key="LANG" value="C" />
191 <arg value="-m '${commit.message}'" />
192 <arg value="commit" />
193 <arg value="${plugin.jar}" />
194 </exec>
195 </target>
196
197 <!-- ** make sure svn is present as a command line tool ** -->
198 <target name="ensure-svn-present">
199 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
200 <env key="LANG" value="C" />
201 <arg value="--version" />
202 </exec>
203 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
204 <!-- return code not set at all? Most likely svn isn't installed -->
205 <condition>
206 <not>
207 <isset property="svn.exit.code" />
208 </not>
209 </condition>
210 </fail>
211 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
212 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
213 <condition>
214 <isfailure code="${svn.exit.code}" />
215 </condition>
216 </fail>
217 </target>
218
219 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
220 </target>
221
222</project>
Note: See TracBrowser for help on using the repository browser.