[19664] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
| 2 | <!--
|
---|
| 3 | ** Usage
|
---|
| 4 | ** =====
|
---|
| 5 | ** To build it run
|
---|
| 6 | **
|
---|
| 7 | ** > ant dist
|
---|
| 8 | **
|
---|
| 9 | ** To install the generated plugin locally (in you default plugin directory) run
|
---|
| 10 | **
|
---|
| 11 | ** > ant install
|
---|
| 12 | **
|
---|
| 13 | ** The generated plugin jar is not automatically available in JOSMs plugin configuration
|
---|
| 14 | ** dialog. You have to check it in first.
|
---|
| 15 | **
|
---|
[19672] | 16 | ** Use the ant target 'publish' to check in the plugin and make it available to other
|
---|
| 17 | ** JOSM users:
|
---|
| 18 | ** set the properties commit.message and plugin.main.version
|
---|
| 19 | ** and run
|
---|
| 20 | ** > ant publish
|
---|
| 21 | **
|
---|
| 22 | **
|
---|
[19664] | 23 | -->
|
---|
| 24 | <project name="photo_geotagging" default="dist" basedir=".">
|
---|
[19672] | 25 |
|
---|
| 26 | <!-- enter the SVN commit message -->
|
---|
[19873] | 27 | <property name="commit.message" value="fixed: month is off by 1; delete temporary test file" />
|
---|
[19672] | 28 | <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
|
---|
[19845] | 29 | <property name="plugin.main.version" value="2931" />
|
---|
[19672] | 30 |
|
---|
| 31 |
|
---|
| 32 | <!--
|
---|
[19664] | 33 | ************************************************
|
---|
| 34 | ** should not be necessary to change the following properties
|
---|
| 35 | -->
|
---|
[19672] | 36 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
| 37 | <property name="plugin.build.dir" value="build"/>
|
---|
| 38 | <property name="plugin.src.dir" value="src"/>
|
---|
| 39 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
| 40 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
| 41 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
| 42 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
| 43 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
[19664] | 44 |
|
---|
[19672] | 45 | <!--
|
---|
[19664] | 46 | **********************************************************
|
---|
| 47 | ** init - initializes the build
|
---|
| 48 | **********************************************************
|
---|
| 49 | -->
|
---|
[19672] | 50 | <target name="init">
|
---|
| 51 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 52 | </target>
|
---|
[19664] | 53 |
|
---|
[19672] | 54 | <!--
|
---|
[19664] | 55 | **********************************************************
|
---|
| 56 | ** compile - complies the source tree
|
---|
| 57 | **********************************************************
|
---|
| 58 | -->
|
---|
[19672] | 59 | <target name="compile" depends="init">
|
---|
| 60 | <echo message="compiling sources for ${plugin.jar} ... "/>
|
---|
| 61 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
| 62 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 63 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 64 | </javac>
|
---|
| 65 | </target>
|
---|
[19664] | 66 |
|
---|
[19672] | 67 | <!--
|
---|
[19664] | 68 | **********************************************************
|
---|
| 69 | ** dist - creates the plugin jar
|
---|
| 70 | **********************************************************
|
---|
| 71 | -->
|
---|
[19672] | 72 | <target name="dist" depends="compile,revision">
|
---|
| 73 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
| 74 | <copy todir="${plugin.build.dir}/images">
|
---|
| 75 | <fileset dir="images"/>
|
---|
| 76 | </copy>
|
---|
| 77 | <copy todir="${plugin.build.dir}">
|
---|
| 78 | <fileset dir=".">
|
---|
| 79 | <include name="README" />
|
---|
| 80 | </fileset>
|
---|
| 81 | </copy>
|
---|
| 82 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 83 | <!--
|
---|
[19664] | 84 | ************************************************
|
---|
| 85 | ** configure these properties. Most of them will be copied to the plugins
|
---|
| 86 | ** manifest file. Property values will also show up in the list available
|
---|
| 87 | ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
|
---|
| 88 | **
|
---|
| 89 | ************************************************
|
---|
| 90 | -->
|
---|
[19672] | 91 | <manifest>
|
---|
| 92 | <attribute name="Author" value="Sebastian Klein"/>
|
---|
| 93 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.photo_geotagging.GeotaggingPlugin"/>
|
---|
| 94 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
| 95 | <attribute name="Plugin-Description" value="Write gps position info to the image file header. Run this feature from the right click menu of the image layer."/>
|
---|
[21706] | 96 | <attribute name="Plugin-Icon" value="images/geotagging.png"/>
|
---|
[19672] | 97 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Photo_Geotagging"/>
|
---|
| 98 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 99 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 100 | </manifest>
|
---|
| 101 | </jar>
|
---|
| 102 | </target>
|
---|
[19664] | 103 |
|
---|
[19672] | 104 | <!--
|
---|
[19664] | 105 | **********************************************************
|
---|
| 106 | ** revision - extracts the current revision number for the
|
---|
| 107 | ** file build.number and stores it in the XML property
|
---|
| 108 | ** version.*
|
---|
| 109 | **********************************************************
|
---|
| 110 | -->
|
---|
[19672] | 111 | <target name="revision">
|
---|
[19664] | 112 |
|
---|
[19672] | 113 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 114 | <env key="LANG" value="C"/>
|
---|
| 115 | <arg value="info"/>
|
---|
| 116 | <arg value="--xml"/>
|
---|
| 117 | <arg value="."/>
|
---|
| 118 | </exec>
|
---|
| 119 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 120 | <delete file="REVISION"/>
|
---|
| 121 | </target>
|
---|
[19664] | 122 |
|
---|
[19672] | 123 | <!--
|
---|
[19664] | 124 | **********************************************************
|
---|
| 125 | ** clean - clean up the build environment
|
---|
| 126 | **********************************************************
|
---|
| 127 | -->
|
---|
[19672] | 128 | <target name="clean">
|
---|
| 129 | <delete dir="${plugin.build.dir}"/>
|
---|
| 130 | <delete file="${plugin.jar}"/>
|
---|
| 131 | </target>
|
---|
[19664] | 132 |
|
---|
[19672] | 133 | <!--
|
---|
[19664] | 134 | **********************************************************
|
---|
| 135 | ** install - install the plugin in your local JOSM installation
|
---|
| 136 | **********************************************************
|
---|
| 137 | -->
|
---|
[19672] | 138 | <target name="install" depends="dist">
|
---|
| 139 | <property environment="env"/>
|
---|
| 140 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 141 | <and>
|
---|
| 142 | <os family="windows"/>
|
---|
| 143 | </and>
|
---|
| 144 | </condition>
|
---|
| 145 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 146 | </target>
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 | <!--
|
---|
| 150 | ************************** Publishing the plugin ***********************************
|
---|
| 151 | -->
|
---|
| 152 | <!--
|
---|
| 153 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
| 154 | ** property ${coreversion.info.entry.revision}
|
---|
| 155 | **
|
---|
| 156 | -->
|
---|
| 157 | <target name="core-info">
|
---|
| 158 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 159 | <env key="LANG" value="C"/>
|
---|
| 160 | <arg value="info"/>
|
---|
| 161 | <arg value="--xml"/>
|
---|
| 162 | <arg value="../../core"/>
|
---|
| 163 | </exec>
|
---|
| 164 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 165 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 166 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 167 | <delete file="core.info.xml" />
|
---|
| 168 | </target>
|
---|
| 169 |
|
---|
| 170 | <!--
|
---|
| 171 | ** commits the source tree for this plugin
|
---|
| 172 | -->
|
---|
| 173 | <target name="commit-current">
|
---|
| 174 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 175 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 176 | <env key="LANG" value="C"/>
|
---|
| 177 | <arg value="commit"/>
|
---|
| 178 | <arg value="-m '${commit.message}'"/>
|
---|
| 179 | <arg value="."/>
|
---|
| 180 | </exec>
|
---|
| 181 | </target>
|
---|
| 182 |
|
---|
| 183 | <!--
|
---|
| 184 | ** updates (svn up) the source tree for this plugin
|
---|
| 185 | -->
|
---|
| 186 | <target name="update-current">
|
---|
| 187 | <echo>Updating plugin source ...</echo>
|
---|
| 188 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 189 | <env key="LANG" value="C"/>
|
---|
| 190 | <arg value="up"/>
|
---|
| 191 | <arg value="."/>
|
---|
| 192 | </exec>
|
---|
| 193 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 194 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 195 | <env key="LANG" value="C"/>
|
---|
| 196 | <arg value="up"/>
|
---|
| 197 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 198 | </exec>
|
---|
| 199 | </target>
|
---|
| 200 |
|
---|
| 201 | <!--
|
---|
| 202 | ** commits the plugin.jar
|
---|
| 203 | -->
|
---|
| 204 | <target name="commit-dist">
|
---|
| 205 | <echo>
|
---|
| 206 | ***** Properties of published ${plugin.jar} *****
|
---|
| 207 | Commit message : '${commit.message}'
|
---|
| 208 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 209 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 210 | Plugin-Version : ${version.entry.commit.revision}
|
---|
| 211 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 212 |
|
---|
| 213 | Now commiting ${plugin.jar} ...
|
---|
| 214 | </echo>
|
---|
| 215 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 216 | <env key="LANG" value="C"/>
|
---|
| 217 | <arg value="-m '${commit.message}'"/>
|
---|
| 218 | <arg value="commit"/>
|
---|
| 219 | <arg value="${plugin.jar}"/>
|
---|
| 220 | </exec>
|
---|
| 221 | </target>
|
---|
| 222 |
|
---|
| 223 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 224 | <target name="ensure-svn-present">
|
---|
| 225 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 226 | <env key="LANG" value="C" />
|
---|
| 227 | <arg value="--version" />
|
---|
| 228 | </exec>
|
---|
| 229 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 230 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 231 | <condition>
|
---|
| 232 | <not>
|
---|
| 233 | <isset property="svn.exit.code" />
|
---|
| 234 | </not>
|
---|
| 235 | </condition>
|
---|
| 236 | </fail>
|
---|
| 237 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 238 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 239 | <condition>
|
---|
| 240 | <isfailure code="${svn.exit.code}" />
|
---|
| 241 | </condition>
|
---|
| 242 | </fail>
|
---|
| 243 | </target>
|
---|
| 244 |
|
---|
| 245 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 246 | </target>
|
---|
[19664] | 247 | </project>
|
---|