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