Mercurial > public > develkit
view jacoco-ant.xml @ 41:139a3611ae99
CM-127: Move castor-ant to develkit and teach jacoco how to instrument non-groovy projects.
author | smith@nwoca.org |
---|---|
date | Tue, 07 Jun 2011 18:08:47 -0400 |
parents | 0cbc383e341b |
children | c1619b87800e |
line wrap: on
line source
<?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}"/> <var name="runmain.jvmargs.jacoco" value="${runmain.jvmargs}"/> <var name="runmain.jvmargs" value="${jacoco.coverage.agent} ${runmain.jvmargs.jacoco}"/> <echoproperties prefix="jacoco"/> <echoproperties prefix="runmain"/> </target> <target name="coverage.xml" description="Generates an XML converage report." depends="-check.jacoco,project.init" if="jacoco.installed"> <if><available file="${jacoco.data.file}"/> <then> <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> </then> <else> <echo message="Coverage data not available. coverage.xml skipped"/> </else> </if> </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>