Files
luaj/build-coverage.xml

109 lines
3.9 KiB
XML

<project default="all" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!--
Run code coverage for unit tests on the luaj vm and libraries.
-->
<property name="classes.dir" value="build/classes" />
<property name="instrumented.dir" value="build/instrumented" />
<property name="reports.xml.dir" value="build/reports-junit-xml" />
<property name="reports.html.dir" value="build/reports-junit-html" />
<property name="coverage.xml.dir" value="build/reports-coverage-xml" />
<property name="coverage.html.dir" value="build/reports-coverage-html" />
<artifact:dependencies filesetId="cobutura.fileset">
<dependency groupId="cobertura" artifactId="cobertura" version="1.8"/>
<dependency groupId="junit" artifactId="junit" version="3.8.1"/>
</artifact:dependencies>
<path id="cobertura.classpath">
<fileset refid="cobutura.fileset" />
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<import file="wtk.xml"/>
<property environment="env"/>
<property name="antlr.version" value="3.1.3"/>
<property name="antlr.home" value="${env.ANTLR_HOME}"/>
<property name="antlr.tool.jar" value="${antlr.home}/lib/antlr-${antlr.version}.jar"/>
<property name="antlr.runtime.jar" value="${antlr.home}/lib/antlr-runtime-${antlr.version}.jar"/>
<target name="clean" description="Remove all files created by the build/test process.">
<delete dir="build" failonerror="no"/>
<delete file="cobertura.log" />
<delete file="cobertura.ser" />
</target>
<target name="init">
<mkdir dir="${classes.dir}" />
<mkdir dir="${instrumented.dir}" />
<mkdir dir="${reports.xml.dir}" />
<mkdir dir="${reports.html.dir}" />
<mkdir dir="${coverage.xml.dir}" />
<mkdir dir="${coverage.html.dir}" />
</target>
<target name="compile" depends="init,wtk-or-fail">
<javac destdir="${classes.dir}" debug="yes" target="1.5">
<classpath refid="cobertura.classpath" />
<classpath refid="wtk-libs" />
<classpath path="${antlr.runtime.jar}"/>
<src path="src/core"/>
<src path="src/jme"/>
<src path="src/jse"/>
<src path="test/junit"/>
</javac>
</target>
<target name="instrument" depends="compile">
<delete file="cobertura.ser"/>
<delete dir="${instrumented.dir}" failonerror="no"/>
<cobertura-instrument todir="${instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${classes.dir}">
<include name="org/luaj/vm2/*.class" />
<include name="org/luaj/vm2/lib/*.class" />
<include name="org/luaj/vm2/lib/jse/*.class" />
<include name="org/luaj/vm2/lib/jme/*.class" />
<include name="org/luaj/vm2/compiler/*.class" />
<include name="org/luaj/vm2/luajc/*.class" />
<include name="org/luaj/vm2/luajc/antlr/*.class" />
<include name="org/luaj/vm2/luajc/lst/*.class" />
<include name="org/luaj/vm2/script/*.class" />
<exclude name="**/*Test*.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="test" depends="instrument">
<junit fork="yes" forkmode="once" showoutput="no">
<classpath location="${instrumented.dir}" />
<classpath location="${classes.dir}" />
<classpath location="src/test/res" />
<classpath refid="cobertura.classpath" />
<formatter type="xml" />
<batchtest todir="${reports.xml.dir}">
<fileset dir="test/junit">
<include name="org/luaj/vm2/AllTests.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${reports.xml.dir}">
<fileset dir="${reports.xml.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reports.html.dir}" />
</junitreport>
</target>
<target name="coverage" depends="test">
<cobertura-report srcdir="src/core" destdir="${coverage.xml.dir}" format="xml" />
<cobertura-report srcdir="src/core" destdir="${coverage.html.dir}" />
</target>
<target name="all" depends="clean,init,compile,instrument,test,coverage" />
</project>