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