forked from I2P_Developers/i2p.i2p
Added ScalaTest support to router build.xml
This commit is contained in:
@@ -86,30 +86,54 @@
|
||||
windowtitle="I2P Router" />
|
||||
</target>
|
||||
|
||||
<!-- scala paths -->
|
||||
<target name="scala.init">
|
||||
<property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" />
|
||||
<property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" />
|
||||
<taskdef resource="scala/tools/ant/antlib.xml">
|
||||
<classpath>
|
||||
<pathelement location="${scalatest.libs}/scala-compiler.jar" />
|
||||
<pathelement location="${scala-library.jar}" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
</target>
|
||||
|
||||
<!-- unit tests -->
|
||||
<target name="builddeptest">
|
||||
<ant dir="../../core/java/" target="jarTest" />
|
||||
</target>
|
||||
<target name="compileTest" depends="builddeptest">
|
||||
<target name="scalatest.compileTest" depends="jar, scala.init">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj_scala" />
|
||||
<scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
|
||||
<classpath>
|
||||
<pathelement location="${scala-library.jar}" />
|
||||
<pathelement location="${scalatest.jar}" />
|
||||
<pathelement location="../../core/java/build/i2p.jar" />
|
||||
<pathelement location="./build/router.jar" />
|
||||
</classpath>
|
||||
</scalac>
|
||||
</target>
|
||||
<target name="junit.compileTest" depends="builddeptest, compile">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj" />
|
||||
<!-- junit classes are in ant runtime -->
|
||||
<javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" deprecation="on"
|
||||
<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" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
</javac>
|
||||
</target>
|
||||
<target name="jarTest" depends="compileTest">
|
||||
<target name="jarTest" depends="junit.compileTest">
|
||||
<jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
|
||||
</target>
|
||||
<!-- preparation of code coverage tool of choice -->
|
||||
<target name="prepareClover" depends="compileTest" if="with.clover">
|
||||
<target name="prepareClover" depends="compile" if="with.clover">
|
||||
<taskdef resource="clovertasks"/>
|
||||
<mkdir dir="../../reports/router/clover" />
|
||||
<clover-setup initString="../../reports/router/clover/coverage.db"/>
|
||||
</target>
|
||||
<target name="prepareCobertura" depends="compileTest" if="with.cobertura">
|
||||
<target name="prepareCobertura" depends="compile" if="with.cobertura">
|
||||
<taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
|
||||
<mkdir dir="./build/obj_cobertura" />
|
||||
<delete file="./cobertura.ser" />
|
||||
@@ -122,7 +146,40 @@
|
||||
</target>
|
||||
<target name="prepareTest" depends="prepareClover, prepareCobertura" />
|
||||
<!-- end preparation of code coverage tool -->
|
||||
<target name="test" depends="clean, compileTest, prepareTest">
|
||||
<target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest">
|
||||
<mkdir dir="../../reports/router/scalatest/" />
|
||||
<delete>
|
||||
<fileset dir="../../reports/router/scalatest">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
|
||||
<classpath>
|
||||
<pathelement location="${scala-library.jar}" />
|
||||
<pathelement location="${scalatest.jar}" />
|
||||
<pathelement location="./build/obj_cobertura" />
|
||||
<pathelement location="./build/obj" />
|
||||
<pathelement location="../../core/java/build/i2p.jar" />
|
||||
<pathelement location="../../build/jbigi.jar" />
|
||||
<pathelement location="${with.clover}" />
|
||||
<pathelement location="${with.cobertura}" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
<scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M">
|
||||
<tagsToExclude>
|
||||
SlowTests
|
||||
</tagsToExclude>
|
||||
<reporter type="stdout" />
|
||||
<reporter type="junitxml" directory="../../reports/router/scalatest/" />
|
||||
</scalatest>
|
||||
<!-- fetch the real hostname of this machine -->
|
||||
<exec executable="hostname" outputproperty="host.name"/>
|
||||
<!-- set if unset -->
|
||||
<property name="host.fakename" value="i2ptester" />
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/router/scalatest/" token="${host.name}" value="${host.fakename}"/>
|
||||
</target>
|
||||
<target name="junit.test" depends="clean, junit.compileTest, prepareTest">
|
||||
<mkdir dir="../../reports/router/junit/" />
|
||||
<delete>
|
||||
<fileset dir="../../reports/router/junit">
|
||||
@@ -154,7 +211,16 @@
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/router/junit/" token="${host.name}" value="${host.fakename}"/>
|
||||
</target>
|
||||
<target name="test" depends="scalatest.test"/>
|
||||
<!-- test reports -->
|
||||
<target name="scalatest.report">
|
||||
<junitreport todir="../../reports/router/scalatest">
|
||||
<fileset dir="../../reports/router/scalatest">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report format="frames" todir="../../reports/router/html/scalatest"/>
|
||||
</junitreport>
|
||||
</target>
|
||||
<target name="junit.report">
|
||||
<junitreport todir="../../reports/router/junit">
|
||||
<fileset dir="../../reports/router/junit">
|
||||
@@ -177,9 +243,9 @@
|
||||
<cobertura-report format="html" srcdir="./src" destdir="../../reports/router/html/cobertura" />
|
||||
<delete file="./cobertura.ser" />
|
||||
</target>
|
||||
<target name="test.report" depends="junit.report, clover.report, cobertura.report"/>
|
||||
<target name="test.report" depends="scalatest.report, clover.report, cobertura.report"/>
|
||||
<!-- end test reports -->
|
||||
<target name="fulltest" depends="cleandep, builddeptest, jarTest, test, test.report" />
|
||||
<target name="fulltest" depends="cleandep, test, test.report" />
|
||||
<!-- end unit tests -->
|
||||
|
||||
<target name="clean">
|
||||
|
Reference in New Issue
Block a user