maven-plugins/clover/plugin.jelly

146 lines
4.5 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:doc="doc">
<!--
|
| This last namespace entry is not obvious so here's a little
| explanation. For anything documentation related we don't want to have to
| duplicated documentation properties like ${maven.dest.docs} in every
| single plugin. So we use the following to access the properties of the
| xdoc plugin:
|
| ${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}
|
| But this of course only works if the xdoc plugin is loaded ... So we
| trick the xdoc plugin into loading by declaring the xmlns:doc usage
| above. This forces the lookup and loading of the xdoc plugin which
| loads the properties. This is not entirely clear but works and I'll
| find a better way to declare this.
|
-->
<path id="clover.classpath">
<pathelement path="${plugin.getDependencyPath('clover')}"/>
</path>
<j:set var="tmp.clover.excludes">
<j:forEach var="pat" items="${pom.build.unitTest.includes}"> ${pat} </j:forEach>
</j:set>
<property name="clover.excludes" value="${tmp.clover.excludes}"/>
<goal name="maven-clover-plugin:register">
<doc:registerReport
name="Clover"
pluginName="maven-clover-plugin"
link="clover/index"
description="Clover test coverage report."/>
</goal>
<goal name="maven-clover-plugin:deregister">
<doc:deregisterReport name="Clover"/>
</goal>
<goal name="maven-clover-plugin:report">
<attainGoal name="clover:html-report"/>
</goal>
<!-- =================================================================== -->
<!-- Prepare for clover -->
<!-- =================================================================== -->
<goal
name="clover:on"
description="Create the needed directory structure"
trim="true">
<preGoal name="java:compile">
${pom.getContext().setVariable('build.compiler',"org.apache.tools.ant.taskdefs.CloverCompilerAdapter")}
</preGoal>
<postGoal name="java:compile">
${pom.getContext().removeVariable('build.compiler')}
</postGoal>
<property
name="clover.initstring"
value="${maven.clover.database.dir}/clover_coverage.db"/>
<j:set
var="cloverReportDirectory"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}/clover"/>
<maven:addPath id="maven.dependency.classpath" refid="clover.classpath"/>
<mkdir dir="${maven.build.clover}"/>
<mkdir dir="${maven.build.clover.classes}"/>
<mkdir dir="${maven.clover.database.dir}"/>
<j:set var="tmp" value="${maven.build.clover.classes}"/>
${pom.getPluginContext('maven-java-plugin').setVariable('maven.build.dest',tmp)}
${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest',tmp)}
</goal>
<!-- =================================================================== -->
<!-- C L O V E R R E P O R T S -->
<!-- =================================================================== -->
<goal name="clover"
description="Generate HTML test coverage reports with Clover"
prereqs="clover:html-report"/>
<goal
name="clover:html-report"
prereqs="clover:on,test:test"
description="Generate HTML test coverage reports with Clover">
<!--
|
| Grab the value maven.docs.dest from the xdoc plugin.
|
-->
<mkdir dir="${cloverReportDirectory}"/>
<java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter"
fork="true">
<arg line="-o ${cloverReportDirectory}"/>
<arg line="-i ${clover.initstring}"/>
<arg line="-t '${pom.name} - ${pom.currentVersion}'"/>
<classpath>
<path refid="maven-classpath"/>
<pathelement path="${plugin.getDependencyPath('velocity')}"/>
<pathelement path="${plugin.getDependencyPath('clover')}"/>
</classpath>
</java>
</goal>
<goal
name="clover:swing-report"
prereqs="clover:on,test:test"
description="Generate Swing test coverage reports with Clover">
<mkdir dir="${cloverReportDirectory}"/>
<java classname="com.cortexeb.tools.clover.reporters.jfc.Viewer"
fork="yes">
<arg line="${clover.initstring}"/>
<classpath>
<path refid="maven-classpath"/>
<pathelement path="${plugin.getDependencyPath('velocity')}"/>
<pathelement path="${plugin.getDependencyPath('clover')}"/>
</classpath>
</java>
</goal>
</project>