Mercurial > public > develkit
diff jacoco-ant.xml @ 27:ea29594bb799
TL-34: Switch to Jacoco for coverage analysis.
author | smith@nwoca.org |
---|---|
date | Sun, 10 Apr 2011 21:42:19 -0400 |
parents | |
children | 0cbc383e341b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jacoco-ant.xml Sun Apr 10 21:42:19 2011 -0400 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="jacoco-project-tasks" default="" basedir="." + xmlns:ivy="antlib:fr.jayasoft.ivy.ant" + xmlns:ssdt="http://www.ssdt-ohio.org/ant/common" + xmlns:jacoco="antlib:org.jacoco.ant"> + + <description>jacoco Ant tasks</description> + + <property name="jacoco.report.dir" value="build/jacoco"/> + <property name="jacoco.data.file" value="build/jacoco/jacoco.exec"/> + + <target name="-check.jacoco" depends="project.init,ivy-info"> + <property name="jacoco.ant.jar.file" + value="${user.home.ant.lib}/jacoco-ant.jar"/> + <property name="jacoco.agent.jar.file" + value="${ssdt.devel.kit}/jacoco-agent.jar"/> + <property name="ssdt.jacoco.ant.jar.src" + value="http://ivy.ssdt.nwoca.org/repository/jacoco/jacocoant.jar"/> + <property name="ssdt.jacoco.agent.jar.src" + value="http://ivy.ssdt.nwoca.org/repository/jacoco/jacocoagent.jar"/> + <ssdt:fetch dest="${jacoco.ant.jar.file}" + src="${ssdt.jacoco.ant.jar.src}"/> + <ssdt:fetch dest="${jacoco.agent.jar.file}" + src="${ssdt.jacoco.agent.jar.src}"/> + <property name="jacoco.installed" value="true"/> + <property name="jacoco.dir" value="${build.dir}/jacoco"/> + + </target> + + <target name="with.coverage" depends="-check.jacoco" if="jacoco.installed"> + <property name="coverage.run.with.jacoco" value="true"/> + <mkdir dir="${jacoco.dir}"/> + <copy file="${jacoco.agent.jar.file}" tofile="${jacoco.dir}/jacocoagent.jar"/> + <property name="_jacoco.agentFile" value="${jacoco.dir}/jacocoagent.jar"/> + <taskdef uri="antlib:org.jacoco.ant" + classpath="${jacoco.ant.jar.file}" + resource="org/jacoco/ant/antlib.xml"/> + <jacoco:agent property="jacoco.coverage.agent" + destfile="${jacoco.data.file}"/> + </target> + + <target name="coverage.xml" + description="Generates an XML converage report." + depends="-check.jacoco,project.init" + if="jacoco.installed"> + <mkdir dir="${jacoco.report.dir}"/> + <jacoco:report> + <executiondata> + <file file="${jacoco.data.file}"/> + </executiondata> + <structure name="${ivy.project.module}"> + <classfiles> + <fileset dir="${build.classes.dir}"/> + </classfiles> + <sourcefiles encoding="UTF-8"> + <fileset dir="${src.dir}"/> + </sourcefiles> + </structure> + <xml destfile="${jacoco.report.dir}/jacoco.xml"/> + </jacoco:report> + + </target> + + <target name="coverage.html" + description="Generates an HTML converage report." + depends="-check.jacoco" + if="jacoco.installed"> + <mkdir dir="${jacoco.report.dir}"/> + <jacoco:report> + <executiondata> + <file file="${jacoco.data.file}"/> + </executiondata> + <structure name="${ivy.project.module}"> + <classfiles> + <fileset dir="${build.classes.dir}"/> + </classfiles> + <sourcefiles encoding="UTF-8"> + <fileset dir="${src.dir}"/> + </sourcefiles> + </structure> + <html destdir="${jacoco.report.dir}"/> + </jacoco:report> + </target> + +</project>