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

Last change on this file since 28807 was 28446, checked in by jttt, 12 years ago

adapt to latest josm

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