[26341] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!--
|
---|
| 3 | ** Template for the build targets common to all plugins
|
---|
| 4 | ** ====================================================
|
---|
| 5 | **
|
---|
| 6 | ** To override a property, add it to the plugin build.xml _before_
|
---|
| 7 | ** this template has been imported.
|
---|
| 8 | ** To override a target, add it _after_ this template has been imported.
|
---|
| 9 | **
|
---|
| 10 | ** Paths are relative to the build.xml that imports this template.
|
---|
| 11 | **
|
---|
| 12 | -->
|
---|
[30550] | 13 | <project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
|
---|
[26341] | 14 |
|
---|
| 15 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
[30553] | 16 | <property name="josm.test.build.dir" location="../../core/test/build"/>
|
---|
[30721] | 17 | <property name="groovy.jar" location="../00_core_tools/groovy-all-2.3.7.jar"/>
|
---|
[30550] | 18 | <property name="plugin.build.dir" location="build"/>
|
---|
| 19 | <property name="plugin.test.dir" location="test"/>
|
---|
| 20 | <property name="plugin.src.dir" location="src"/>
|
---|
| 21 | <property name="plugin.lib.dir" location="lib"/>
|
---|
[26341] | 22 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
[30550] | 23 | <property name="plugin.dist.dir" location="../../dist"/>
|
---|
[30416] | 24 | <property name="ant.build.javac.target" value="1.7"/>
|
---|
| 25 | <property name="ant.build.javac.source" value="1.7"/>
|
---|
[30550] | 26 | <property name="plugin.jar" location="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
[26341] | 27 |
|
---|
[30699] | 28 | <!-- For Windows-specific stuff -->
|
---|
| 29 | <condition property="isWindows">
|
---|
| 30 | <os family="Windows"/>
|
---|
| 31 | </condition>
|
---|
| 32 | <target name="-jaxb_win" if="isWindows">
|
---|
| 33 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
| 34 | </target>
|
---|
| 35 | <target name="-jaxb_nix" unless="isWindows">
|
---|
| 36 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
| 37 | </target>
|
---|
| 38 |
|
---|
[26341] | 39 | <!--
|
---|
| 40 | **********************************************************
|
---|
| 41 | ** init - initializes the build
|
---|
| 42 | **********************************************************
|
---|
| 43 | -->
|
---|
| 44 | <target name="init">
|
---|
| 45 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 46 | </target>
|
---|
| 47 | <!--
|
---|
| 48 | **********************************************************
|
---|
[29442] | 49 | ** compile - compiles the source tree
|
---|
[26341] | 50 | **********************************************************
|
---|
| 51 | -->
|
---|
| 52 | <target name="compile" depends="init">
|
---|
[28290] | 53 | <echo message="compiling sources for ${plugin.jar} ..."/>
|
---|
[29694] | 54 | <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false" encoding="UTF-8">
|
---|
[26341] | 55 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 56 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[28990] | 57 | <classpath>
|
---|
| 58 | <pathelement location="${josm}"/>
|
---|
| 59 | <fileset dir="${plugin.lib.dir}" erroronmissingdir="no">
|
---|
| 60 | <include name="**/*.jar"/>
|
---|
| 61 | </fileset>
|
---|
| 62 | </classpath>
|
---|
[26341] | 63 | </javac>
|
---|
| 64 | </target>
|
---|
| 65 | <!--
|
---|
| 66 | **********************************************************
|
---|
[29005] | 67 | ** setup-dist - copies files for distribution
|
---|
[28990] | 68 | **********************************************************
|
---|
| 69 | -->
|
---|
[29005] | 70 | <target name="setup-dist-default">
|
---|
[28990] | 71 | <copy todir="${plugin.build.dir}/resources" failonerror="no" includeemptydirs="no">
|
---|
| 72 | <fileset dir="resources"/>
|
---|
| 73 | </copy>
|
---|
| 74 | <copy todir="${plugin.build.dir}/images" failonerror="no" includeemptydirs="no">
|
---|
| 75 | <fileset dir="images"/>
|
---|
| 76 | </copy>
|
---|
| 77 | <copy todir="${plugin.build.dir}/data" failonerror="no" includeemptydirs="no">
|
---|
| 78 | <fileset dir="data"/>
|
---|
| 79 | </copy>
|
---|
| 80 | <copy todir="${plugin.build.dir}">
|
---|
| 81 | <fileset dir=".">
|
---|
| 82 | <include name="README"/>
|
---|
[28996] | 83 | <include name="LICENSE*"/>
|
---|
| 84 | <include name="*GPL*"/>
|
---|
[28990] | 85 | </fileset>
|
---|
| 86 | </copy>
|
---|
[29005] | 87 | </target>
|
---|
| 88 | <target name="setup-dist">
|
---|
[29007] | 89 | <antcall target="setup-dist-default" />
|
---|
[29005] | 90 | </target>
|
---|
| 91 | <!--
|
---|
| 92 | **********************************************************
|
---|
| 93 | ** dist - creates the plugin jar
|
---|
| 94 | **********************************************************
|
---|
| 95 | -->
|
---|
| 96 | <target name="dist" depends="compile,revision">
|
---|
| 97 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
[29007] | 98 | <antcall target="setup-dist" />
|
---|
[28990] | 99 | <delete file="MANIFEST" failonerror="no"/>
|
---|
| 100 | <manifest file="MANIFEST" mode="update">
|
---|
| 101 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 102 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 103 | <attribute name="Plugin-Class" value="${plugin.class}" />
|
---|
| 104 | <attribute name="Plugin-Description" value="${plugin.description}" />
|
---|
| 105 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
| 106 | <attribute name="Author" value="${plugin.author}"/>
|
---|
| 107 | </manifest>
|
---|
| 108 | <antcall target="add-manifest-attribute">
|
---|
| 109 | <param name="manifest.attribute" value="Plugin-Link"/>
|
---|
[30562] | 110 | <param name="property.name" value="plugin.link"/>
|
---|
| 111 | <param name="property.value" value="${plugin.link}"/>
|
---|
[28990] | 112 | </antcall>
|
---|
| 113 | <antcall target="add-manifest-attribute">
|
---|
| 114 | <param name="manifest.attribute" value="Plugin-Icon"/>
|
---|
[30562] | 115 | <param name="property.name" value="plugin.icon"/>
|
---|
| 116 | <param name="property.value" value="${plugin.icon}"/>
|
---|
[28990] | 117 | </antcall>
|
---|
| 118 | <antcall target="add-manifest-attribute">
|
---|
| 119 | <param name="manifest.attribute" value="Plugin-Early"/>
|
---|
[30562] | 120 | <param name="property.name" value="plugin.early"/>
|
---|
| 121 | <param name="property.value" value="${plugin.early}"/>
|
---|
[28990] | 122 | </antcall>
|
---|
| 123 | <antcall target="add-manifest-attribute">
|
---|
| 124 | <param name="manifest.attribute" value="Plugin-Requires"/>
|
---|
[30562] | 125 | <param name="property.name" value="plugin.requires"/>
|
---|
| 126 | <param name="property.value" value="${plugin.requires}"/>
|
---|
[28990] | 127 | </antcall>
|
---|
| 128 | <antcall target="add-manifest-attribute">
|
---|
| 129 | <param name="manifest.attribute" value="Plugin-Stage"/>
|
---|
[30562] | 130 | <param name="property.name" value="plugin.stage"/>
|
---|
| 131 | <param name="property.value" value="${plugin.stage}"/>
|
---|
[28990] | 132 | </antcall>
|
---|
[29435] | 133 | <antcall target="additional-manifest" />
|
---|
[28990] | 134 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifest="MANIFEST">
|
---|
| 135 | <zipgroupfileset dir="${plugin.lib.dir}" includes="*.jar" erroronmissingdir="no"/>
|
---|
| 136 | </jar>
|
---|
| 137 | <delete file="MANIFEST" failonerror="no"/>
|
---|
[29007] | 138 | <antcall target="post-dist" />
|
---|
[28990] | 139 | </target>
|
---|
[29007] | 140 | <target name="post-dist">
|
---|
| 141 | <!-- to be overidden by plugins that need to perform additional tasks on resulting jar -->
|
---|
| 142 | </target>
|
---|
[30562] | 143 | <target name="add-manifest-attribute" depends="check-manifest-attribute" if="have-${property.name}">
|
---|
[28990] | 144 | <manifest file="MANIFEST" mode="update">
|
---|
[30562] | 145 | <attribute name="${manifest.attribute}" value="${property.value}" />
|
---|
[28990] | 146 | </manifest>
|
---|
| 147 | </target>
|
---|
[29435] | 148 | <!-- target to add additional entries, empty in commons -->
|
---|
| 149 | <target name="additional-manifest">
|
---|
| 150 | </target>
|
---|
[28990] | 151 | <target name="check-manifest-attribute">
|
---|
[30562] | 152 | <condition property="have-${property.name}">
|
---|
[28990] | 153 | <and>
|
---|
[30562] | 154 | <isset property="${property.name}"/>
|
---|
[28990] | 155 | <not>
|
---|
[30562] | 156 | <equals arg1="${property.value}" arg2=""/>
|
---|
[28990] | 157 | </not>
|
---|
| 158 | <not>
|
---|
[30562] | 159 | <equals arg1="${property.value}" arg2="..."/>
|
---|
[28990] | 160 | </not>
|
---|
| 161 | </and>
|
---|
| 162 | </condition>
|
---|
| 163 | </target>
|
---|
| 164 | <!--
|
---|
| 165 | **********************************************************
|
---|
[26341] | 166 | ** revision - extracts the current revision number for the
|
---|
| 167 | ** file build.number and stores it in the XML property
|
---|
| 168 | ** version.*
|
---|
| 169 | **********************************************************
|
---|
| 170 | -->
|
---|
[30161] | 171 | <!--
|
---|
| 172 | ** Initializes the REVISION.XML file from SVN information
|
---|
| 173 | -->
|
---|
| 174 | <target name="init-svn-revision-xml">
|
---|
| 175 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
[26341] | 176 | <env key="LANG" value="C"/>
|
---|
| 177 | <arg value="info"/>
|
---|
| 178 | <arg value="--xml"/>
|
---|
| 179 | <arg value="."/>
|
---|
| 180 | </exec>
|
---|
[30161] | 181 | <condition property="svn.info.success">
|
---|
| 182 | <equals arg1="${svn.info.result}" arg2="0" />
|
---|
| 183 | </condition>
|
---|
[26341] | 184 | </target>
|
---|
| 185 | <!--
|
---|
[30306] | 186 | ** Initializes the REVISION.XML file from git-svn information.
|
---|
| 187 | Obtains the revision from the git-svn-id field.
|
---|
[30161] | 188 | -->
|
---|
[30306] | 189 | <target name="init-git-svn-revision-xml" unless="svn.info.success">
|
---|
| 190 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.svn.info.result">
|
---|
[30161] | 191 | <arg value="log"/>
|
---|
| 192 | <arg value="-1"/>
|
---|
| 193 | <arg value="--grep=git-svn-id"/>
|
---|
| 194 | <!--
|
---|
| 195 | %B: raw body (unwrapped subject and body)
|
---|
| 196 | %n: new line
|
---|
| 197 | %ai: author date, ISO 8601 format
|
---|
| 198 | -->
|
---|
| 199 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
| 200 | <arg value="HEAD"/>
|
---|
| 201 | </exec>
|
---|
| 202 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 203 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 204 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30306] | 205 | <condition property="git.svn.fail">
|
---|
| 206 | <not>
|
---|
| 207 | <and>
|
---|
| 208 | <equals arg1="${git.svn.info.result}" arg2="0" />
|
---|
| 209 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 210 | </and>
|
---|
| 211 | </not>
|
---|
| 212 | </condition>
|
---|
[30562] | 213 | </target>
|
---|
[30306] | 214 | <!--
|
---|
| 215 | ** Initializes the REVISION.XML file from git (w/o svn) information.
|
---|
| 216 | Uses Unix date as revision number.
|
---|
| 217 | -->
|
---|
| 218 | <target name="init-git-revision-xml" if="git.svn.fail">
|
---|
[30309] | 219 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.info.result">
|
---|
[30306] | 220 | <arg value="log"/>
|
---|
| 221 | <arg value="-1"/>
|
---|
| 222 | <arg value="--pretty=format:%at%n%ai"/>
|
---|
| 223 | <arg value="HEAD"/>
|
---|
| 224 | </exec>
|
---|
| 225 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 226 | match="\s*(\d*)\s+(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 227 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30309] | 228 | <condition property="git.fail">
|
---|
| 229 | <not>
|
---|
| 230 | <and>
|
---|
| 231 | <equals arg1="${git.info.result}" arg2="0" />
|
---|
| 232 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 233 | </and>
|
---|
| 234 | </not>
|
---|
| 235 | </condition>
|
---|
[30161] | 236 | </target>
|
---|
[30309] | 237 | <target name="init-revision-fallback" if="git.fail">
|
---|
| 238 | <tstamp>
|
---|
| 239 | <format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS" />
|
---|
| 240 | </tstamp>
|
---|
| 241 | <echo file="REVISION.XML"><![CDATA[<info><entry><commit revision="UNKNOWN"><date>${current.time}</date></commit></entry></info>]]></echo>
|
---|
| 242 | </target>
|
---|
| 243 | <target name="revision" depends="init-svn-revision-xml, init-git-svn-revision-xml, init-git-revision-xml, init-revision-fallback">
|
---|
[30161] | 244 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 245 | <delete file="REVISION.XML"/>
|
---|
| 246 | </target>
|
---|
| 247 | <!--
|
---|
[26341] | 248 | **********************************************************
|
---|
| 249 | ** clean - clean up the build environment
|
---|
| 250 | **********************************************************
|
---|
| 251 | -->
|
---|
| 252 | <target name="clean">
|
---|
| 253 | <delete dir="${plugin.build.dir}"/>
|
---|
| 254 | <delete file="${plugin.jar}"/>
|
---|
| 255 | </target>
|
---|
| 256 | <!--
|
---|
| 257 | **********************************************************
|
---|
| 258 | ** install - install the plugin in your local JOSM installation
|
---|
| 259 | **********************************************************
|
---|
| 260 | -->
|
---|
| 261 | <target name="install" depends="dist">
|
---|
| 262 | <property environment="env"/>
|
---|
| 263 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 264 | <and>
|
---|
| 265 | <os family="windows"/>
|
---|
| 266 | </and>
|
---|
| 267 | </condition>
|
---|
| 268 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 269 | </target>
|
---|
| 270 | <!--
|
---|
| 271 | ************************** Publishing the plugin ***********************************
|
---|
| 272 | -->
|
---|
| 273 | <!--
|
---|
| 274 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
| 275 | ** property ${coreversion.info.entry.revision}
|
---|
| 276 | **
|
---|
| 277 | -->
|
---|
| 278 | <target name="core-info">
|
---|
| 279 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 280 | <env key="LANG" value="C"/>
|
---|
| 281 | <arg value="info"/>
|
---|
| 282 | <arg value="--xml"/>
|
---|
| 283 | <arg value="../../core"/>
|
---|
| 284 | </exec>
|
---|
| 285 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 286 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 287 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 288 | <delete file="core.info.xml"/>
|
---|
| 289 | </target>
|
---|
| 290 | <!--
|
---|
| 291 | ** commits the source tree for this plugin
|
---|
| 292 | -->
|
---|
| 293 | <target name="commit-current">
|
---|
| 294 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 295 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 296 | <env key="LANG" value="C"/>
|
---|
| 297 | <arg value="commit"/>
|
---|
[28400] | 298 | <arg value="-m"/>
|
---|
| 299 | <arg value="${commit.message}"/>
|
---|
[26341] | 300 | <arg value="."/>
|
---|
| 301 | </exec>
|
---|
| 302 | </target>
|
---|
| 303 | <!--
|
---|
| 304 | ** updates (svn up) the source tree for this plugin
|
---|
| 305 | -->
|
---|
| 306 | <target name="update-current">
|
---|
| 307 | <echo>Updating plugin source ...</echo>
|
---|
| 308 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 309 | <env key="LANG" value="C"/>
|
---|
| 310 | <arg value="up"/>
|
---|
| 311 | <arg value="."/>
|
---|
| 312 | </exec>
|
---|
| 313 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 314 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 315 | <env key="LANG" value="C"/>
|
---|
| 316 | <arg value="up"/>
|
---|
| 317 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 318 | </exec>
|
---|
| 319 | </target>
|
---|
| 320 | <!--
|
---|
| 321 | ** commits the plugin.jar
|
---|
| 322 | -->
|
---|
| 323 | <target name="commit-dist">
|
---|
| 324 | <echo>
|
---|
| 325 | ***** Properties of published ${plugin.jar} *****
|
---|
[27960] | 326 | Commit message : '${commit.message}'
|
---|
[26341] | 327 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 328 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 329 | Plugin-Version : ${version.entry.commit.revision}
|
---|
[27960] | 330 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 331 |
|
---|
[26341] | 332 | Now commiting ${plugin.jar} ...
|
---|
| 333 | </echo>
|
---|
| 334 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 335 | <env key="LANG" value="C"/>
|
---|
[28400] | 336 | <arg value="-m"/>
|
---|
| 337 | <arg value="${commit.message}"/>
|
---|
[26341] | 338 | <arg value="commit"/>
|
---|
| 339 | <arg value="${plugin.jar}"/>
|
---|
| 340 | </exec>
|
---|
| 341 | </target>
|
---|
| 342 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 343 | <target name="ensure-svn-present">
|
---|
| 344 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 345 | <env key="LANG" value="C"/>
|
---|
| 346 | <arg value="--version"/>
|
---|
| 347 | </exec>
|
---|
| 348 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 349 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 350 | <condition>
|
---|
| 351 | <not>
|
---|
| 352 | <isset property="svn.exit.code"/>
|
---|
| 353 | </not>
|
---|
| 354 | </condition>
|
---|
| 355 | </fail>
|
---|
| 356 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 357 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 358 | <condition>
|
---|
| 359 | <isfailure code="${svn.exit.code}"/>
|
---|
| 360 | </condition>
|
---|
| 361 | </fail>
|
---|
| 362 | </target>
|
---|
[28807] | 363 |
|
---|
[26341] | 364 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 365 | </target>
|
---|
[30550] | 366 |
|
---|
| 367 | <path id="test.classpath">
|
---|
[30552] | 368 | <fileset dir="../00_core_test_lib">
|
---|
[30550] | 369 | <include name="**/*.jar"/>
|
---|
| 370 | </fileset>
|
---|
| 371 | <fileset dir="${plugin.test.dir}/lib" erroronmissingdir="no">
|
---|
| 372 | <include name="**/*.jar"/>
|
---|
| 373 | </fileset>
|
---|
| 374 | <fileset dir="lib" erroronmissingdir="no">
|
---|
| 375 | <include name="**/*.jar"/>
|
---|
| 376 | </fileset>
|
---|
[30553] | 377 | <pathelement path="${josm.test.build.dir}/unit"/>
|
---|
[30550] | 378 | <pathelement path="${josm}"/>
|
---|
| 379 | <pathelement path="${plugin.jar}"/>
|
---|
| 380 | <pathelement path="${groovy.jar}"/>
|
---|
| 381 | </path>
|
---|
[30562] | 382 | <condition property="plugin.requires.jars.set">
|
---|
| 383 | <isreference refid="plugin.requires.jars"/>
|
---|
| 384 | </condition>
|
---|
[30550] | 385 | <macrodef name="init-test-preferences">
|
---|
| 386 | <sequential>
|
---|
[30562] | 387 | <copy file="${plugin.test.dir}/config/preferences.template.xml" tofile="${plugin.test.dir}/config/unit-josm.home/preferences.xml"/>
|
---|
| 388 | <replace file="${plugin.test.dir}/config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 389 | <replace file="${plugin.test.dir}/config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
[30550] | 390 | </sequential>
|
---|
| 391 | </macrodef>
|
---|
| 392 | <target name="test-init">
|
---|
| 393 | <mkdir dir="${plugin.test.dir}/build"/>
|
---|
| 394 | <mkdir dir="${plugin.test.dir}/build/unit"/>
|
---|
| 395 | <mkdir dir="${plugin.test.dir}/report"/>
|
---|
[30562] | 396 | <init-test-preferences/>
|
---|
[30550] | 397 | </target>
|
---|
| 398 | <target name="test-clean">
|
---|
| 399 | <delete dir="${plugin.test.dir}/build"/>
|
---|
| 400 | <delete dir="${plugin.test.dir}/report"/>
|
---|
| 401 | <delete file="${plugin.test.dir}/jacoco.exec" />
|
---|
| 402 | <delete file="${plugin.test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
| 403 | <delete dir="${plugin.test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
| 404 | </target>
|
---|
| 405 | <macrodef name="call-groovyc">
|
---|
| 406 | <element name="cp-elements"/>
|
---|
| 407 | <sequential>
|
---|
[30562] | 408 | <groovyc srcdir="${plugin.test.dir}/unit" destdir="${plugin.test.dir}/build/unit" encoding="UTF-8">
|
---|
[30550] | 409 | <classpath>
|
---|
| 410 | <cp-elements/>
|
---|
[30562] | 411 | <path refid="test.classpath"/>
|
---|
[30550] | 412 | </classpath>
|
---|
[30562] | 413 | <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
|
---|
[30550] | 414 | <compilerarg value="-Xlint:all"/>
|
---|
| 415 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 416 | </javac>
|
---|
| 417 | </groovyc>
|
---|
| 418 | </sequential>
|
---|
| 419 | </macrodef>
|
---|
[30562] | 420 | <target name="call-groovyc-extended" if="plugin.requires.jars.set">
|
---|
| 421 | <call-groovyc>
|
---|
[30550] | 422 | <cp-elements>
|
---|
[30562] | 423 | <fileset refid="plugin.requires.jars"/>
|
---|
[30550] | 424 | </cp-elements>
|
---|
| 425 | </call-groovyc>
|
---|
| 426 | </target>
|
---|
[30562] | 427 | <target name="call-groovyc-base" unless="plugin.requires.jars.set">
|
---|
| 428 | <call-groovyc>
|
---|
| 429 | <cp-elements/>
|
---|
| 430 | </call-groovyc>
|
---|
| 431 | </target>
|
---|
| 432 | <target name="test-compile" depends="test-init,dist">
|
---|
| 433 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/>
|
---|
| 434 | <antcall target="call-groovyc-base"/>
|
---|
| 435 | <antcall target="call-groovyc-extended"/>
|
---|
| 436 | </target>
|
---|
[30550] | 437 | <macrodef name="call-junit">
|
---|
[30562] | 438 | <element name="cp-elements"/>
|
---|
[30550] | 439 | <sequential>
|
---|
[30562] | 440 | <echo message="Running unit tests with JUnit"/>
|
---|
[30550] | 441 | <jacoco:coverage destfile="${plugin.test.dir}/jacoco.exec">
|
---|
[30556] | 442 | <junit printsummary="yes" fork="true" forkmode="once" dir="${basedir}">
|
---|
[30562] | 443 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
| 444 | <sysproperty key="josm.home" value="${plugin.test.dir}/config/unit-josm.home"/>
|
---|
[30550] | 445 | <sysproperty key="josm.test.data" value="${plugin.test.dir}/data"/>
|
---|
| 446 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 447 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
| 448 | <classpath>
|
---|
[30562] | 449 | <cp-elements/>
|
---|
[30550] | 450 | <path refid="test.classpath"/>
|
---|
| 451 | <pathelement path="${plugin.test.dir}/build/unit"/>
|
---|
| 452 | </classpath>
|
---|
| 453 | <formatter type="plain"/>
|
---|
| 454 | <formatter type="xml"/>
|
---|
| 455 | <batchtest fork="yes" todir="${plugin.test.dir}/report">
|
---|
[30562] | 456 | <fileset dir="${plugin.test.dir}/build/unit" includes="**/*Test.class"/>
|
---|
[30550] | 457 | </batchtest>
|
---|
| 458 | </junit>
|
---|
| 459 | </jacoco:coverage>
|
---|
| 460 | </sequential>
|
---|
| 461 | </macrodef>
|
---|
[30562] | 462 | <target name="call-junit-extended" if="plugin.requires.jars.set">
|
---|
| 463 | <call-junit>
|
---|
| 464 | <cp-elements>
|
---|
| 465 | <fileset refid="plugin.requires.jars"/>
|
---|
| 466 | </cp-elements>
|
---|
| 467 | </call-junit>
|
---|
| 468 | </target>
|
---|
| 469 | <target name="call-junit-base" unless="plugin.requires.jars.set">
|
---|
| 470 | <call-junit>
|
---|
| 471 | <cp-elements/>
|
---|
| 472 | </call-junit>
|
---|
| 473 | </target>
|
---|
| 474 | <target name="test" depends="dist, test-compile"
|
---|
[30550] | 475 | description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 476 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="../00_core_tools/jacocoant.jar" />
|
---|
[30562] | 477 | <antcall target="call-junit-base"/>
|
---|
| 478 | <antcall target="call-junit-extended"/>
|
---|
[30550] | 479 | </target>
|
---|
| 480 |
|
---|
[28807] | 481 | <target name="runjosm" depends="install">
|
---|
| 482 | <java jar="${josm}" fork="true">
|
---|
| 483 | </java>
|
---|
| 484 | </target>
|
---|
| 485 |
|
---|
| 486 | <target name="profilejosm" depends="install">
|
---|
| 487 | <nbprofiledirect>
|
---|
| 488 | </nbprofiledirect>
|
---|
| 489 | <java jar="${josm}" fork="true">
|
---|
| 490 | <jvmarg value="${profiler.info.jvmargs.agent}"/>
|
---|
| 491 | </java>
|
---|
| 492 | </target>
|
---|
[29004] | 493 | <!--
|
---|
| 494 | ** shows a help text
|
---|
| 495 | -->
|
---|
| 496 | <target name="help">
|
---|
| 497 | <echo>
|
---|
| 498 | You can use following targets:
|
---|
| 499 | * dist This default target builds the plugin jar file
|
---|
[29006] | 500 | * clean Cleanup automatical created files
|
---|
[30550] | 501 | * test Run unit tests (if any)
|
---|
[29004] | 502 | * publish Checkin source code, build jar and checkin plugin jar
|
---|
| 503 | (requires proper entry for SVN commit message!)
|
---|
| 504 | * install Install the plugin in current system
|
---|
| 505 | * runjosm Install plugin and start josm
|
---|
| 506 | * profilejosm Install plugin and start josm in profiling mode
|
---|
| 507 |
|
---|
| 508 | There are other targets, which usually should not be called manually.
|
---|
| 509 | </echo>
|
---|
| 510 | </target>
|
---|
[26341] | 511 | </project>
|
---|
| 512 |
|
---|