allow setting hamcrest and junit locations with properties

Defaults to the ant library path (the previously hardcoded path) if not set.
This commit is contained in:
kytv
2013-01-03 11:53:08 +00:00
parent 5b81a1a6d5
commit 9d77cd7761
3 changed files with 46 additions and 8 deletions

View File

@ -18,7 +18,7 @@ wrapperdocs.url=http://wrapper.tanukisoftware.com/jdoc/
i2pdocs.url=http://docs.i2p-projekt.de/javadoc/
junitdocs.url=http://junit.org/apidocs/
# This will go in the jar manifests
build.built-by=unknown
build.built-by=unknown
# filename of the sloccount report
sloccount.report.file=sloccount.sc
@ -44,6 +44,7 @@ require.gettext=true
# This one keeps gcj a lot quieter
#javac.compilerargs=-warn:-unchecked,raw,unused,serial
### UnitTests ##
# Location of the libraries required for the ScalaTest tests.
# Define this in override.properties or pass in on the command line.
# The directory must contain the following library names:
@ -53,6 +54,18 @@ require.gettext=true
# scalatest.jar
#scalatest.libs=/PATH/TO/SCALATEST/lib
# Location of the junit libraries
# Defaults to the ant library path if not set.
# If set, this must point to a directory that contains the files
# junit.jar and junit4.jar
#junit.home=
# Location of the hamcrest libraries
# Defaults to the ant library path if not set
# If set, this must point to a directory containing the files
# hamcrest-core.jar, hamcrest-library.jar, and hamcrest-integration.jar
#hamcrest.home=
# Optional properties used in tests to enable additional tools.
#with.cobertura=/PATH/TO/cobertura.jar
#with.clover=/PATH/TO/clover.jar

View File

@ -98,10 +98,20 @@
<target name="junit.compileTest" depends="compile">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<!-- junit and hamcrest classes should be in ant runtime -->
<!-- set hamcrest and junit homes to the old default unless overridden elsewhere -->
<property name="hamcrest.home" value="${ant.home}/lib/" />
<property name="junit.home" value="${ant.home}/lib/" />
<javac srcdir="./test/junit" debug="true" source="1.5" target="1.5" deprecation="on"
includeAntRuntime="true"
destdir="./build/obj" >
<classpath>
<pathelement path="${classpath}" />
<pathelement location="${hamcrest.home}/hamcrest-core.jar" />
<pathelement location="${hamcrest.home}/hamcrest-library.jar" />
<pathelement location="${hamcrest.home}/hamcrest-integration.jar" />
<pathelement location="${junit.home}/junit.jar" />
<pathelement location="${junit.home}/junit4.jar" />
</classpath>
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
@ -191,6 +201,8 @@
<replace dir="../../reports/core/scalatest/" token="${host.name}" value="${host.fakename}"/>
</target>
<target name="junit.test" depends="clean, junit.compileTest, prepareTest">
<property name="hamcrest.home" value="${ant.home}/lib/" />
<property name="junit.home" value="${ant.home}/lib/" />
<mkdir dir="../../reports/core/junit/" />
<delete>
<fileset dir="../../reports/core/junit">
@ -201,9 +213,11 @@
<sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" />
<classpath>
<pathelement path="${classpath}" />
<pathelement location="${ant.home}/lib/hamcrest-core.jar" />
<pathelement location="${ant.home}/lib/hamcrest-library.jar" />
<pathelement location="${ant.home}/lib/hamcrest-integration.jar" />
<pathelement location="${hamcrest.home}/hamcrest-core.jar" />
<pathelement location="${hamcrest.home}/hamcrest-library.jar" />
<pathelement location="${hamcrest.home}/hamcrest-integration.jar" />
<pathelement location="${junit.home}/junit.jar" />
<pathelement location="${junit.home}/junit4.jar" />
<pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" />
<pathelement location="../../build/jbigi.jar" />

View File

@ -119,13 +119,24 @@
</classpath>
</scalac>
</target>
<target name="junit.compileTest" depends="builddeptest, compile">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<!-- junit classes are in ant runtime -->
<!-- set hamcrest and junit homes to the old default unless overridden elsewhere -->
<property name="hamcrest.home" value="${ant.home}/lib/" />
<property name="junit.home" value="${ant.home}/lib/" />
<javac srcdir="./test/junit" debug="true" source="1.5" target="1.5" deprecation="on"
includeAntRuntime="true"
destdir="./build/obj" classpath="../../core/java/build/i2ptest.jar" >
includeAntRuntime="true"
destdir="./build/obj">
<classpath>
<pathelement location="${hamcrest.home}/hamcrest-core.jar" />
<pathelement location="${hamcrest.home}/hamcrest-library.jar" />
<pathelement location="${hamcrest.home}/hamcrest-integration.jar" />
<pathelement location="$junit.home}/junit.jar" />
<pathelement location="$junit.home}/junit4.jar" />
<pathelement location="../../core/java/build/i2ptest.jar" />
</classpath>
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>