view clover-ant.xml @ 25:e6fd2f1eba13

add sonar with clover coverage
author smith@nwoca.org
date Thu, 07 Apr 2011 19:14:15 -0400
parents
children 639bec4999f2
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<project name="clover-project-tasks" default="" basedir="."
         xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
         xmlns:ssdt="http://www.ssdt-ohio.org/ant/common">

    <description>Clover Ant tasks</description>
    

    <target name="-check.clover">
        <property           name="clover.jar.file" value="${user.home.ant.lib}/clover.jar}"/>
        <property           name="ssdt.clover.jar.src"
                            value="http://ivy.ssdt.nwoca.org/repository/clover/clover.jar"/>
        <property           name="clover.dest" value="${build.dir}/clover"/>
        <ssdt:fetch         dest="${clover.jar.file}"
                            src="${ssdt.clover.jar.src}"/>
        <property           name="clover.license"
                            value="${user.home.ant.lib}/clover.license"/>
        <condition property="clover.installed">
            <and>
                <available classname="com.cenqua.clover.CloverInstr" />
                <available file="${clover.license}"/>
            </and>
        </condition>
    </target>

    <target name="with.coverage" depends="init,-check.clover" if="clover.installed">
        <taskdef resource="cloverlib.xml"/>
    
        <property name="coverage.run.with.clover" value="true"/>
        <clover-env/>
        <clover-setup recordTestResults="false"/>
        <clover-clean/>
        <mkdir dir="${build.dir}/.clover"/>
        <mkdir dir="${build.dir}/clover"/>
    </target>


    <target name="coverage.xml" description="Generates an XML report to ${clover.dest}." if="coverage.run.with.clover">
        <clover-report>
            <current outfile="${clover.dest}/clover.xml" title="${ivy.project.module}" span="${clover.span}">
                <format type="xml"/>
                <testresults dir="build/test/results" includes="TEST-*.xml"/>
             <sourcepath>
                <pathelement path="${src.dir}"/>
              </sourcepath>
            </current>
        </clover-report>
    </target>



</project>