Changeset 30550 in osm for applications/editors/josm/plugins/build-common.xml
- Timestamp:
- 2014-08-04T02:45:06+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/build-common.xml
r30416 r30550 11 11 ** 12 12 --> 13 <project name="plugin_common" basedir="."> 13 <project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant"> 14 14 15 15 <property name="josm" location="../../core/dist/josm-custom.jar"/> 16 <property name="plugin.build.dir" value="build"/> 17 <property name="plugin.src.dir" value="src"/> 18 <property name="plugin.lib.dir" value="lib"/> 16 <property name="groovy.jar" location="../00_core_tools/groovy-all-2.3.4.jar"/> 17 <property name="plugin.build.dir" location="build"/> 18 <property name="plugin.test.dir" location="test"/> 19 <property name="plugin.src.dir" location="src"/> 20 <property name="plugin.lib.dir" location="lib"/> 19 21 <!-- this is the directory where the plugin jar is copied to --> 20 <property name="plugin.dist.dir" value="../../dist"/>22 <property name="plugin.dist.dir" location="../../dist"/> 21 23 <property name="ant.build.javac.target" value="1.7"/> 22 24 <property name="ant.build.javac.source" value="1.7"/> 23 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>25 <property name="plugin.jar" location="${plugin.dist.dir}/${ant.project.name}.jar"/> 24 26 25 27 <!-- … … 350 352 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist"> 351 353 </target> 352 354 355 <path id="test.classpath"> 356 <fileset dir="../../core/test/lib"> 357 <include name="**/*.jar"/> 358 </fileset> 359 <fileset dir="${plugin.test.dir}/lib" erroronmissingdir="no"> 360 <include name="**/*.jar"/> 361 </fileset> 362 <fileset dir="lib" erroronmissingdir="no"> 363 <include name="**/*.jar"/> 364 </fileset> 365 <pathelement path="../../core/test/build/unit"/> 366 <pathelement path="${josm}"/> 367 <pathelement path="${plugin.jar}"/> 368 <pathelement path="${groovy.jar}"/> 369 </path> 370 <macrodef name="init-test-preferences"> 371 <attribute name="testfamily"/> 372 <sequential> 373 <copy file="${plugin.test.dir}/config/preferences.template.xml" tofile="${plugin.test.dir}/config/@{testfamily}-josm.home/preferences.xml"/> 374 <replace file="${plugin.test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/> 375 <replace file="${plugin.test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/> 376 </sequential> 377 </macrodef> 378 <target name="test-init"> 379 <mkdir dir="${plugin.test.dir}/build"/> 380 <mkdir dir="${plugin.test.dir}/build/unit"/> 381 <mkdir dir="${plugin.test.dir}/report"/> 382 <init-test-preferences testfamily="unit"/> 383 </target> 384 <target name="test-clean"> 385 <delete dir="${plugin.test.dir}/build"/> 386 <delete dir="${plugin.test.dir}/report"/> 387 <delete file="${plugin.test.dir}/jacoco.exec" /> 388 <delete file="${plugin.test.dir}/config/unit-josm.home/preferences.xml" /> 389 <delete dir="${plugin.test.dir}/config/unit-josm.home/cache" failonerror="false"/> 390 </target> 391 <macrodef name="call-groovyc"> 392 <attribute name="testfamily"/> 393 <element name="cp-elements"/> 394 <sequential> 395 <groovyc srcdir="${plugin.test.dir}/@{testfamily}" destdir="${plugin.test.dir}/build/@{testfamily}" encoding="UTF-8"> 396 <classpath> 397 <cp-elements/> 398 </classpath> 399 <javac target="1.7" source="1.7" debug="on"> 400 <compilerarg value="-Xlint:all"/> 401 <compilerarg value="-Xlint:-serial"/> 402 </javac> 403 </groovyc> 404 </sequential> 405 </macrodef> 406 <target name="test-compile" depends="test-init,dist"> 407 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/> 408 <call-groovyc testfamily="unit"> 409 <cp-elements> 410 <path refid="test.classpath"/> 411 </cp-elements> 412 </call-groovyc> 413 </target> 414 <macrodef name="call-junit"> 415 <attribute name="testfamily"/> 416 <sequential> 417 <echo message="Running @{testfamily} tests with JUnit"/> 418 <jacoco:coverage destfile="${plugin.test.dir}/jacoco.exec"> 419 <junit printsummary="yes" fork="true" forkmode="once"> 420 <sysproperty key="josm.home" value="${plugin.test.dir}/config/@{testfamily}-josm.home"/> 421 <sysproperty key="josm.test.data" value="${plugin.test.dir}/data"/> 422 <sysproperty key="java.awt.headless" value="true"/> 423 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/> 424 <classpath> 425 <path refid="test.classpath"/> 426 <pathelement path="${plugin.test.dir}/build/unit"/> 427 <pathelement path="${plugin.test.dir}/build/@{testfamily}"/> 428 <pathelement path="${plugin.test.dir}/config"/> 429 </classpath> 430 <formatter type="plain"/> 431 <formatter type="xml"/> 432 <batchtest fork="yes" todir="${plugin.test.dir}/report"> 433 <fileset dir="${plugin.test.dir}/build/@{testfamily}" includes="**/*Test.class"/> 434 </batchtest> 435 </junit> 436 </jacoco:coverage> 437 </sequential> 438 </macrodef> 439 <target name="test" depends="test-compile" 440 description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password"> 441 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="../00_core_tools/jacocoant.jar" /> 442 <call-junit testfamily="unit"/> 443 </target> 444 353 445 <target name="runjosm" depends="install"> 354 446 <java jar="${josm}" fork="true"> … … 371 463 * dist This default target builds the plugin jar file 372 464 * clean Cleanup automatical created files 465 * test Run unit tests (if any) 373 466 * publish Checkin source code, build jar and checkin plugin jar 374 467 (requires proper entry for SVN commit message!)
Note:
See TracChangeset
for help on using the changeset viewer.
