| 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="plugin.jar" value="${plugin.dist.dir}/${plugin.name}.jar" />
|
|---|
| 48 |
|
|---|
| 49 | <!-- There's no josm.jar in the svn, so point "josm" to a local copy of your JOSM binary -->
|
|---|
| 50 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
|---|
| 51 |
|
|---|
| 52 | <property name="ant.build.javac.target" value="1.5" />
|
|---|
| 53 |
|
|---|
| 54 | <target name="init">
|
|---|
| 55 | <mkdir dir="${plugin.build.dir}">
|
|---|
| 56 | </mkdir>
|
|---|
| 57 | <mkdir dir="${plugin.dist.dir}">
|
|---|
| 58 | </mkdir>
|
|---|
| 59 | </target>
|
|---|
| 60 |
|
|---|
| 61 | <target name="compile" depends="init">
|
|---|
| 62 | <echo message="creating ${plugin.jar}" />
|
|---|
| 63 | <javac srcdir="src" target="1.5" destdir="build" debug="true">
|
|---|
| 64 | <include name="**/*.java" />
|
|---|
| 65 | <classpath>
|
|---|
| 66 | <pathelement location="${josm}"/>
|
|---|
| 67 | </classpath>
|
|---|
| 68 | </javac>
|
|---|
| 69 | </target>
|
|---|
| 70 |
|
|---|
| 71 | <target name="revision">
|
|---|
| 72 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
|---|
| 73 | <env key="LANG" value="C" />
|
|---|
| 74 | <arg value="info" />
|
|---|
| 75 | <arg value="--xml" />
|
|---|
| 76 | <arg value="." />
|
|---|
| 77 | </exec>
|
|---|
| 78 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
|---|
| 79 | <delete file="REVISION" />
|
|---|
| 80 | </target>
|
|---|
| 81 |
|
|---|
| 82 | <target name="dist" depends="compile,revision">
|
|---|
| 83 | <copy todir="${plugin.build.dir}/images">
|
|---|
| 84 | <fileset dir="images" />
|
|---|
| 85 | </copy>
|
|---|
| 86 |
|
|---|
| 87 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
|---|
| 88 | <manifest>
|
|---|
| 89 | <attribute name="Author" value="extropy" />
|
|---|
| 90 | <attribute name="Plugin-Class" value="pdfimport.PdfImportPlugin" />
|
|---|
| 91 | <attribute name="Plugin-Description" value="Import PDF file and convert to ways." />
|
|---|
| 92 | <attribute name="Plugin-Icon" value="images/pdf_import.png"/>
|
|---|
| 93 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
|---|
| 94 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
|---|
| 95 | <attribute name="Plugin-Link" value="http://svn.openstreetmap.org/applications/editors/josm/plugins/pdfimport/" />
|
|---|
| 96 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
|---|
| 97 | </manifest>
|
|---|
| 98 | </jar>
|
|---|
| 99 | </target>
|
|---|
| 100 |
|
|---|
| 101 | <target name="clean">
|
|---|
| 102 | <delete dir="${plugin.build.dir}" />
|
|---|
| 103 | <delete file="${plugin.jar}" />
|
|---|
| 104 | </target>
|
|---|
| 105 |
|
|---|
| 106 | <target name="clean_install">
|
|---|
| 107 | <delete file="${plugins}/pdfimport.jar" />
|
|---|
| 108 | </target>
|
|---|
| 109 |
|
|---|
| 110 | <target name="install" depends="dist">
|
|---|
| 111 | <property environment="env" />
|
|---|
| 112 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
|---|
| 113 | <and>
|
|---|
| 114 | <os family="windows" />
|
|---|
| 115 | </and>
|
|---|
| 116 | </condition>
|
|---|
| 117 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
|---|
| 118 | </target>
|
|---|
| 119 |
|
|---|
| 120 | <!--
|
|---|
| 121 | ************************** Publishing the plugin ***********************************
|
|---|
| 122 | -->
|
|---|
| 123 | <!--
|
|---|
| 124 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
|---|
| 125 | ** property ${coreversion.info.entry.revision}
|
|---|
| 126 | **
|
|---|
| 127 | -->
|
|---|
| 128 | <target name="core-info">
|
|---|
| 129 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
|---|
| 130 | <env key="LANG" value="C" />
|
|---|
| 131 | <arg value="info" />
|
|---|
| 132 | <arg value="--xml" />
|
|---|
| 133 | <arg value="../../core" />
|
|---|
| 134 | </exec>
|
|---|
| 135 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
|
|---|
| 136 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
|---|
| 137 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
|---|
| 138 | <delete file="core.info.xml" />
|
|---|
| 139 | </target>
|
|---|
| 140 |
|
|---|
| 141 | <!--
|
|---|
| 142 | ** commits the source tree for this plugin
|
|---|
| 143 | -->
|
|---|
| 144 | <target name="commit-current">
|
|---|
| 145 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
|---|
| 146 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
|---|
| 147 | <env key="LANG" value="C" />
|
|---|
| 148 | <arg value="commit" />
|
|---|
| 149 | <arg value="-m '${commit.message}'" />
|
|---|
| 150 | <arg value="." />
|
|---|
| 151 | </exec>
|
|---|
| 152 | </target>
|
|---|
| 153 |
|
|---|
| 154 | <!--
|
|---|
| 155 | ** updates (svn up) the source tree for this plugin
|
|---|
| 156 | -->
|
|---|
| 157 | <target name="update-current">
|
|---|
| 158 | <echo>Updating plugin source ...</echo>
|
|---|
| 159 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
|---|
| 160 | <env key="LANG" value="C" />
|
|---|
| 161 | <arg value="up" />
|
|---|
| 162 | <arg value="." />
|
|---|
| 163 | </exec>
|
|---|
| 164 | <echo>Updating ${plugin.jar} ...</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="../dist/${plugin.jar}" />
|
|---|
| 169 | </exec>
|
|---|
| 170 | </target>
|
|---|
| 171 |
|
|---|
| 172 | <!--
|
|---|
| 173 | ** commits the plugin.jar
|
|---|
| 174 | -->
|
|---|
| 175 | <target name="commit-dist">
|
|---|
| 176 | <echo>
|
|---|
| 177 | ***** Properties of published ${plugin.jar} *****
|
|---|
| 178 | Commit message : '${commit.message}'
|
|---|
| 179 | Plugin-Mainversion: ${plugin.main.version}
|
|---|
| 180 | JOSM build version: ${coreversion.info.entry.revision}
|
|---|
| 181 | Plugin-Version : ${version.entry.commit.revision}
|
|---|
| 182 | ***** / Properties of published ${plugin.jar} *****
|
|---|
| 183 |
|
|---|
| 184 | Now commiting ${plugin.jar} ...
|
|---|
| 185 | </echo>
|
|---|
| 186 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
|---|
| 187 | <env key="LANG" value="C" />
|
|---|
| 188 | <arg value="-m '${commit.message}'" />
|
|---|
| 189 | <arg value="commit" />
|
|---|
| 190 | <arg value="${plugin.jar}" />
|
|---|
| 191 | </exec>
|
|---|
| 192 | </target>
|
|---|
| 193 |
|
|---|
| 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 |
|
|---|
| 216 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
|---|
| 217 | </target>
|
|---|
| 218 |
|
|---|
| 219 | </project>
|
|---|