summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--build.xml58
2 files changed, 60 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 57fc66b..dd434e8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
all: dist/lib/stroke.jar
-DEFINES = -Dxpp-dir=third-party/xpp -Djzlib-dir=third-party/jzlib -Dicu4j-dir=third-party/ -Dstax2-dir=third-party/stax2/ -Daalto-dir=third-party/aalto/
+DEFINES = -Dxpp-dir=third-party/xpp -Djzlib-dir=third-party/jzlib -Dicu4j-dir=third-party/ -Dstax2-dir=third-party/stax2/ -Daalto-dir=third-party/aalto/ -Dcobertura-jar=third-party/cobertura/cobertura.jar -Djakarta-oro-jar=third-party/cobertura/lib/jakarta-oro-2.0.8.jar -Dlog4j-jar=third-party/cobertura/lib/log4j-1.2.9.jar -Dasm-jar=third-party/cobertura/lib/asm-3.0.jar -Dasm-tree-jar=third-party/cobertura/lib/asm-tree-3.0.jar
JUNIT ?= /usr/share/junit/junit.jar
@@ -18,7 +18,7 @@ dist/lib/stroke.jar: third-party/jzlib/jzlib.jar third-party/icu4j.jar third-par
ant ${DEFINES}
.PHONY : test
-test: dist/lib/stroke.jar
+test: dist/lib/stroke.jar third-party/cobertura/cobertura.jar
ant ${DEFINES} -DJUNIT_JAR=${JUNIT} test
third-party/aalto/aalto-xml.jar:
@@ -41,6 +41,12 @@ third-party/icu4j.jar:
mkdir -p third-party
curl http://download.icu-project.org/files/icu4j/4.8.1/icu4j-4_8_1.jar -o third-party/icu4j.jar
+third-party/cobertura/cobertura.jar:
+ mkdir -p third-party
+ curl -L 'http://sourceforge.net/projects/cobertura/files/cobertura/1.9.4.1/cobertura-1.9.4.1-bin.tar.bz2/download' -o third-party/cobertura-1.9.4.1-bin.tar.bz2
+ tar -xvjf third-party/cobertura-1.9.4.1-bin.tar.bz2 -C third-party/
+ mv third-party/cobertura-1.9.4.1 third-party/cobertura
+
.git/hooks/commit-msg:
curl -k https://git.swift.im/review/tools/hooks/commit-msg -o .git/hooks/commit-msg
chmod u+x .git/hooks/commit-msg
diff --git a/build.xml b/build.xml
index ef3ec6a..238aaa5 100644
--- a/build.xml
+++ b/build.xml
@@ -20,6 +20,18 @@
<property name="stax2-dir" value="../third-party/stax2"/>
<property name="jzlib-dir" value="../third-party/jzlib"/>
<property name="icu4j-dir" value="../third-party/icu4j"/>
+ <property name="cobertura.dir" value="instrumented"/>
+ <property name="coveragereport.dir" value="coverage"/>
+
+
+ <path id="cobertura.classpath">
+ <pathelement path="${cobertura-jar}"/>
+ <pathelement path="${jakarta-oro-jar}"/>
+ <pathelement path="${log4j-jar}"/>
+ <pathelement path="${asm-jar}"/>
+ <pathelement path="${asm-tree-jar}"/>
+ </path>
+ <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<path id="classpath">
<fileset dir="${aalto-dir}" includes="aalto-xml.jar"/>
@@ -60,24 +72,55 @@
</javac>
</target>
- <target name="test" depends="compile-tests">
- <delete dir="${test.results}"/>
- <mkdir dir="${test.results}"/>
- <junit fork="false">
+ <target name="instrument" if="cobertura-jar" depends="compile-tests">
+ <delete dir="${cobertura.dir}"/>
+ <mkdir dir="${cobertura.dir}"/>
+ <cobertura-instrument todir="${cobertura.dir}">
+ <fileset dir="test">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </target>
+
+ <target name="run-tests" depends="compile-tests">
+ <delete dir="${test.results}"/>
+ <mkdir dir="${test.results}"/>
+ <junit fork="yes">
<formatter type="xml"/>
<classpath>
+ <pathelement location="${cobertura.dir}"/>
+ <path refid="cobertura.classpath"/>
+ </classpath>
+ <classpath>
<pathelement location="${JUNIT_JAR}"/>
<pathelement location="${jar}"/>
<pathelement location="${src.tests}"/>
- <path refid="classpath"/>
+ <path refid="classpath"/>
</classpath>
- <batchtest fork="yes" todir="${test.results}">
+ <batchtest todir="${test.results}">
<fileset dir="${src.tests}">
<include name="**/*Test.java"/>
<!--<exclude name="**/AllTests.java"/>-->
</fileset>
</batchtest>
</junit>
+
+ </target>
+
+ <target name="coverage" if="cobertura-jar" depends="instrument, run-tests">
+ <delete dir="${coveragereport.dir}"/>
+ <mkdir dir="${coveragereport.dir}"/>
+ <cobertura-report format="html" destdir="${coveragereport.dir}">
+ <fileset dir="${src}">
+ <include name="**/*.java"/>
+ </fileset>
+ <fileset dir="${src.tests}">
+ <include name="**/*.java"/>
+ </fileset>
+ </cobertura-report>
+ </target>
+
+ <target name="test" depends="compile-tests, instrument, run-tests, coverage">
</target>
<target name="clean"
@@ -86,6 +129,9 @@
<delete dir="${test.results}"/>
<delete dir="${dist}"/>
<delete dir="${doc}"/>
+ <delete dir="${coveragereport.dir}"/>
+ <delete dir="${cobertura.dir}"/>
+
</target>
<target name="javadoc" depends="init">