I'm not going to pretend that this works very well.
* Flushpolicy - it's just a hack that we have a 500ms flush interval. Should be allowed to flush with an ant task * Basically clover 1.2 sort of works, want to check something that reasonably works in before I break it again. PR: MAVEN-372 git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
acec98fc28
commit
4cf0745242
4 files changed
+69
-84
No files matched your search
+59
-65
@@ -4,35 +4,28 @@
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:java="java"
|
||||
xmlns:test="test"
|
||||
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.
|
||||
|
|
||||
-->
|
||||
|
||||
<java:dependency-handle/>
|
||||
<j:set var="javaPlugin" value="${pom.getPluginContext('maven-java-plugin')}"/>
|
||||
|
||||
<test:dependency-handle/>
|
||||
<j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
|
||||
|
||||
<!--ant:echo>Java Plugin: ${javaPlugin}</ant:echo>
|
||||
<ant:echo>Test Plugin: ${testPlugin}</ant:echo-->
|
||||
|
||||
<ant:path id="clover.classpath">
|
||||
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
|
||||
</ant:path>
|
||||
|
||||
<j:set var="tmp.clover.excludes">
|
||||
<!--j:set var="tmp.clover.excludes">
|
||||
<j:forEach var="pat" items="${pom.build.unitTest.includes}"> ${pat} </j:forEach>
|
||||
</j:set>
|
||||
|
||||
<ant:property name="clover.excludes" value="${tmp.clover.excludes}"/>
|
||||
<ant:property name="clover.excludes" value="${tmp.clover.excludes}"/-->
|
||||
|
||||
|
||||
<goal name="maven-clover-plugin:register">
|
||||
@@ -58,36 +51,44 @@
|
||||
|
||||
<goal
|
||||
name="clover:on"
|
||||
description="Create the needed directory structure"
|
||||
trim="true">
|
||||
|
||||
description="Create the needed directory structure">
|
||||
|
||||
<ant:taskdef resource="clovertasks"/>
|
||||
<ant:typedef resource="clovertypes"/>
|
||||
|
||||
<preGoal name="java:compile">
|
||||
${pom.getContext().setVariable('build.compiler',"org.apache.tools.ant.taskdefs.CloverCompilerAdapter")}
|
||||
<echo>Setting Clover compiler</echo>
|
||||
<ant:clover-setup
|
||||
initstring="${maven.clover.database.dir}/clover_coverage.db"
|
||||
flushpolicy="interval"
|
||||
flushinterval="500"
|
||||
/>
|
||||
<echo>Now using primary build.compiler : ${build.compiler}</echo>
|
||||
<!--${pom.getContext().setVariable('build.compiler',"org.apache.tools.ant.taskdefs.CloverCompilerAdapter")}-->
|
||||
</preGoal>
|
||||
|
||||
<postGoal name="java:compile">
|
||||
${pom.getContext().removeVariable('build.compiler')}
|
||||
</postGoal>
|
||||
|
||||
<ant: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"/>
|
||||
<clover-setup initstring="${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"/>
|
||||
|
||||
<ant:mkdir dir="${maven.build.clover}"/>
|
||||
<ant:mkdir dir="${maven.build.clover.classes}"/>
|
||||
<ant: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)}
|
||||
<ant:mkdir dir="${cloverReportDirectory}"/>
|
||||
|
||||
|
||||
<j:set var="tmp" value="${maven.build.clover.classes}"/>
|
||||
${pom.getPluginContext('maven-java-plugin').setVariable('maven.build.dest',tmp)}
|
||||
<!--echo>Found maven-test-plugin: ${pom.getPluginContext('maven-test-plugin')}</echo-->
|
||||
${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest',tmp)}
|
||||
</goal>
|
||||
|
||||
<!-- =================================================================== -->
|
||||
@@ -98,43 +99,37 @@
|
||||
description="Generate HTML test coverage reports with Clover"
|
||||
prereqs="clover:html-report"/>
|
||||
|
||||
<goal
|
||||
name="clover:html-report"
|
||||
description="Generate HTML test coverage reports with Clover">
|
||||
|
||||
<!-- Make sure that the report is generated whether the tests pass or
|
||||
not -->
|
||||
<goal name="clover:test" prereqs="clover:on">
|
||||
<!-- Make sure that the report is generated whether the tests pass or not -->
|
||||
<j:set var="ignoreTestFailureOld" value="${maven.test.failure.ignore}"/>
|
||||
<j:set var="junitForkOld" value="${maven.junit.fork}"/>
|
||||
|
||||
<j:set var="maven.test.failure.ignore" scope="parent" value="true"/>
|
||||
<attainGoal name="clover:on"/>
|
||||
<j:set var="maven.junit.fork" scope="parent" value="true"/>
|
||||
|
||||
<attainGoal name="test:test"/>
|
||||
<j:set var="maven.test.failure.ignore" scope="parent"
|
||||
value="${ignoreTestFailureOld}"/>
|
||||
|
||||
<j:set var="maven.test.failure.ignore" scope="parent" value="${ignoreTestFailureOld}"/>
|
||||
<j:set var="maven.junit.fork" scope="parent" value="${junitForkOld}"/>
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Grab the value maven.docs.dest from the xdoc plugin.
|
||||
|
|
||||
-->
|
||||
<ant:mkdir dir="${cloverReportDirectory}"/>
|
||||
|
||||
<ant:java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter"
|
||||
fork="true">
|
||||
<ant:arg line="-o ${cloverReportDirectory}"/>
|
||||
<ant:arg line="-i ${clover.initstring}"/>
|
||||
<ant:arg line="-t '${pom.name} - ${pom.currentVersion}'"/>
|
||||
<ant:classpath>
|
||||
<ant:path refid="maven-classpath"/>
|
||||
<ant:pathelement path="${plugin.getDependencyPath('velocity')}"/>
|
||||
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
|
||||
</ant:classpath>
|
||||
</ant:java>
|
||||
|
||||
<goal
|
||||
name="clover:html-report"
|
||||
description="Generate HTML test coverage reports with Clover">
|
||||
<attainGoal name="clover:test"/>
|
||||
<ant:clover-report>
|
||||
<current
|
||||
outfile="${cloverReportDirectory}"
|
||||
title="${pom.name} - ${pom.currentVersion}">
|
||||
<format type="html" orderBy="ElementsCoveredAsc"/>
|
||||
</current>
|
||||
</ant:clover-report>
|
||||
</goal>
|
||||
|
||||
<goal
|
||||
name="clover:swing-report"
|
||||
prereqs="clover:on,test:test"
|
||||
prereqs="clover:test"
|
||||
description="Generate Swing test coverage reports with Clover">
|
||||
|
||||
<ant:mkdir dir="${cloverReportDirectory}"/>
|
||||
@@ -144,7 +139,6 @@
|
||||
<ant:arg line="${clover.initstring}"/>
|
||||
<ant:classpath>
|
||||
<ant:path refid="maven-classpath"/>
|
||||
<ant:pathelement path="${plugin.getDependencyPath('velocity')}"/>
|
||||
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
|
||||
</ant:classpath>
|
||||
</ant:java>
|
||||
|
||||
@@ -7,13 +7,4 @@
|
||||
|
||||
maven.build.clover = ${maven.build.dir}/clover
|
||||
maven.build.clover.classes = ${maven.build.clover}/classes
|
||||
#maven.build.clover.src = ${maven.build.clover}/src
|
||||
#clover.tmpdir = ${maven.build.clover.src}
|
||||
|
||||
# Location of Clover database
|
||||
# (used only if maven.compile.clover = true)
|
||||
maven.clover.database.dir = ${maven.build.clover}/database
|
||||
|
||||
clover.preserve=true
|
||||
clover.flushpolicy=interval
|
||||
clover.flushpolicy.interval=10
|
||||
+3
-10
@@ -5,7 +5,7 @@
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-clover-plugin</id>
|
||||
<name>Maven Clover Plug-in</name>
|
||||
<currentVersion>1.2-SNAPSHOT</currentVersion>
|
||||
<currentVersion>1.3-SNAPSHOT</currentVersion>
|
||||
<description/>
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
<url>http://maven.apache.org/reference/plugins/clover/</url>
|
||||
@@ -72,17 +72,10 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<id>clover</id>
|
||||
<version>1.0</version>
|
||||
<version>1.2</version>
|
||||
<properties>
|
||||
<classloader>root</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<id>velocity</id>
|
||||
<version>1.3</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -44,6 +44,13 @@
|
||||
Specifies the location of the Clover database. The default value is
|
||||
<code>${maven.build.dir}/clover/database</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="maven.clover.report.format">maven.clover.report.format</a></td>
|
||||
<td>No (default "html")</td>
|
||||
<td>
|
||||
Specifies the format of the Clover report output
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user