- Fixed plugin test

- Added developement documentation
- Cleaned up plugin.jelly
- Fixed clover:on goal which should be able to be considered as a public goal now. Need more test though. If it works fine, it should be documented to goals.xml.
- Added clover:off goal (internal goal for now) that restores properties in same state before call to clover:on


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114973 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol committed 2004-04-02 21:12:02 +00:00
1 parent 6e72bb9c1f
commit 1bdd755463
10 files changed
+175 -98

No files matched your search

+119 -57
View File
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -17,7 +18,6 @@
*/
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
@@ -27,84 +27,89 @@
xmlns:doc="doc"
xmlns:u="jelly:util">
<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:path id="clover.classpath">
<j:choose>
<j:when test="${context.getVariable('maven.clover.jar') != null}">
<ant:pathelement path="${maven.clover.jar}"/>
</j:when>
<j:otherwise>
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
</j:otherwise>
</j:choose>
</ant:path>
<!--
========================================================================
Initialize the Clover plugin.
========================================================================
-->
<goal name="clover:init">
<goal name="maven-clover-plugin:register">
<j:if test="${sourcesPresent == 'true'}">
<doc:registerReport
name="Clover"
pluginName="maven-clover-plugin"
link="clover/index"
description="Clover test coverage report."/>
</j:if>
</goal>
<!-- By calling a goal from the java plugin we ensure that all its
properties are loaded and are thus accessible from this plugin -->
<java:dependency-handle/>
<j:set var="javaPlugin" value="${pom.getPluginContext('maven-java-plugin')}"/>
<goal name="maven-clover-plugin:deregister">
<j:if test="${sourcesPresent == 'true'}">
<doc:deregisterReport name="Clover"/>
</j:if>
</goal>
<goal name="maven-clover-plugin:report">
<attainGoal name="clover:html-report"/>
</goal>
<!-- =================================================================== -->
<!-- Prepare for clover -->
<!-- =================================================================== -->
<!-- By calling a goal from the test plugin we ensure that all its
properties are loaded and are thus accessible from this plugin -->
<test:dependency-handle/>
<j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
<!-- Create an Ant <path> id that contains the Clover jar. If the user has
defined the maven.clover.jar property then this path will contain his
version of the clover jar. Otherwise use the version defined as a
dependency in this plugin's project.xml. -->
<ant:path id="clover.classpath">
<j:choose>
<j:when test="${context.getVariable('maven.clover.jar') != null}">
<ant:pathelement path="${maven.clover.jar}"/>
</j:when>
<j:otherwise>
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
</j:otherwise>
</j:choose>
</ant:path>
<goal name="clover:on">
<ant:taskdef resource="clovertasks"/>
<ant:typedef resource="clovertypes"/>
<j:set var="cloverDatabase"
value="${maven.clover.database.dir}/clover_coverage.db"/>
<clover-setup initstring="${cloverDatabase}"/>
<j:set var="cloverReportDirectory" value="${maven.docs.dest}/clover"/>
<!-- Allow users to override the version of the Clover jar to use -->
<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.build.classes}"/>
<ant:mkdir dir="${maven.clover.database.dir}"/>
<ant:mkdir dir="${cloverReportDirectory}"/>
</goal>
<!-- =================================================================== -->
<!-- C L O V E R R E P O R T S -->
<!-- =================================================================== -->
<!--
========================================================================
Generate test coverage reports with Clover.
========================================================================
-->
<goal name="clover"
description="Generate test coverage reports with Clover"
prereqs="clover:report"/>
<goal name="clover:test" prereqs="clover:on">
<!--
========================================================================
Prepare for Clover. Any goal that executes after this goal and that
runs the <javac> Ant task will result in sources being Clovered.
Clover sets the Ant build.compiler property that tells the <javac>
task which compiler to compile java sources with.
This goal also modifies some properties from the test plugin. You'll
need to call clover:off to reset them as they were initially.
========================================================================
-->
<goal name="clover:on" prereqs="clover:init">
<!-- 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"/>
<!-- We tell the test plugin to run tests in a forked JVM. Due to a
limitation in Clover, test coverage data are flushed upon JVM
shutdown. Running test in a forked JVM allows to write properly the
results before the goal finishes and thus it is possible to generate
Clover reports in the same Maven session. -->
<j:set var="maven.junit.fork" scope="parent" value="true"/>
<echo>Setting Clover compiler</echo>
@@ -143,15 +148,23 @@
<echo>Now using primary build.compiler : ${build.compiler}</echo>
<j:set var="tmp" value="${maven.build.clover.classes}"/>
<j:set var="tmp" value="${maven.clover.build.classes}"/>
<j:set var="mavenBuildDestJavaOld"
value="${pom.getPluginContext('maven-java-plugin').getVariable('maven.build.dest')}"/>
${pom.getPluginContext('maven-java-plugin').setVariable('maven.build.dest',tmp)}
<j:set var="mavenBuildDestTestOld"
value="${pom.getPluginContext('maven-test-plugin').getVariable('maven.build.dest')}"/>
${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest',tmp)}
<attainGoal name="test:test"/>
</goal>
<!--
========================================================================
Restore properties of the test plugin the same way they were before
the call to clover:on.
========================================================================
-->
<goal name="clover:off">
${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest',mavenBuildDestTestOld)}
${pom.getPluginContext('maven-java-plugin').setVariable('maven.build.dest',mavenBuildDestJavaOld)}
@@ -163,6 +176,20 @@
</goal>
<!--
========================================================================
Execute unit tests on Clovered code and thus generate Clover database
data.
========================================================================
-->
<goal name="clover:test">
<attainGoal name="clover:on"/>
<attainGoal name="test:test"/>
<attainGoal name="clover:off"/>
</goal>
<!--
========================================================================
Generate test coverage reports. It decides what kind of reports should
@@ -252,4 +279,39 @@
description="Generate Swing test coverage reports with Clover"
prereqs="clover:test,clover:swing-report-internal"/>
<!--
========================================================================
Register the Clover plugin for site generation.
========================================================================
-->
<goal name="maven-clover-plugin:register">
<j:if test="${sourcesPresent == 'true'}">
<doc:registerReport
name="Clover"
pluginName="maven-clover-plugin"
link="clover/index"
description="Clover test coverage report."/>
</j:if>
</goal>
<!--
========================================================================
Deregister the Clover plugin from site generation.
========================================================================
-->
<goal name="maven-clover-plugin:deregister">
<j:if test="${sourcesPresent == 'true'}">
<doc:deregisterReport name="Clover"/>
</j:if>
</goal>
<!--
========================================================================
Goal that is executed during the site generation
========================================================================
-->
<goal name="maven-clover-plugin:report">
<attainGoal name="clover:html-report"/>
</goal>
</project>
+12 -7
View File
@@ -17,14 +17,19 @@
# -------------------------------------------------------------------
# Default Maven properties for the Clover Plugin
# -------------------------------------------------------------------
# These are the properties that we believe are immutable so we
# keep them apart from the project specific properties.
# -------------------------------------------------------------------
maven.build.clover = ${maven.build.dir}/clover
maven.build.clover.classes = ${maven.build.clover}/classes
maven.clover.database.dir = ${maven.build.clover}/database
maven.clover.orderBy=PcCoveredAsc
# Location of build files generated by the Clover plugin
maven.clover.build = ${maven.build.dir}/clover
# Location where clovered classes will be generated
maven.clover.build.classes = ${maven.clover.build}/classes
# Location of the Clover database (i.e directory where coverage data
# will be generated).
maven.clover.database.dir = ${maven.clover.build}/database
# Default ordering for the generated Clover reports.
maven.clover.orderBy = PcCoveredAsc
# Whether tests should be instrumented by Clover or not
maven.clover.instrument.tests = false
+1 -1
View File
@@ -18,6 +18,6 @@
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------
maven.xdoc.date=left
## maven.xdoc.version=${pom.currentVersion}
maven.xdoc.version=${pom.currentVersion}
maven.license.licenseFile=${basedir}/../LICENSE.txt
+2 -2
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -17,12 +18,11 @@
*/
-->
<project>
<extend>../project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-clover-plugin</id>
<name>Maven Clover Plug-in</name>
<name>Maven Clover plugin</name>
<currentVersion>1.5-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Produce Clover reports</shortDescription>
+2 -2
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -17,7 +18,6 @@
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-clover-plugin</id>
@@ -44,7 +44,7 @@
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
</includes>
</unitTest>
</build>
+30 -24
View File
@@ -18,6 +18,7 @@
-->
<document>
<properties>
<title>Changes</title>
<author email="vmassol@apache.org">Vincent Massol</author>
@@ -26,31 +27,35 @@
<body>
<release version="1.5" date="in CVS">
<release version="1.5" date="in CVS">
<action dev="vmassol" type="fix" issue="MPCLOVER-13">
Tests executed after <code>&lt;clover:on</code> are now always
forked.
</action>
</release>
<release version="1.4" date="2003-12-05">
<action dev="vmassol" type="add" issue="MPCLOVER-11">
<release version="1.4" date="2003-12-05">
<action dev="vmassol" type="add" issue="MPCLOVER-11">
Allows the user to override the Clover jar. This is especially useful
as the Clover jars are license-signed for a specific project so you
might want to use different jars for different projects.
</action>
<action dev="vmassol" type="add" issue="MPCLOVER-12">
</action>
<action dev="vmassol" type="add" issue="MPCLOVER-12">
Conditionally instrument test classes too. To instrument test classes
set the <code>maven.clover.instrument.tests</code> to
<code>true</code>.
</action>
<action dev="vmassol" type="update">
Make sure that the clover plugin restore other plugin's
properties it has modified.
</action>
<action dev="vmassol" type="remove">
Removed public <code>clover:on</code> goal as it should not have
been public.
</action>
</release>
</action>
<action dev="vmassol" type="update">
Make sure that the clover plugin restore other plugin's
properties it has modified.
</action>
<action dev="vmassol" type="remove">
Removed public <code>clover:on</code> goal as it should not have
been public.
</action>
</release>
<release version="1.3" date="2003-11-28">
<release version="1.3" date="2003-11-28">
<action dev="vmassol" type="add">
Added unit tests for the plugin and reworked the documentation.
</action>
@@ -68,13 +73,13 @@
</action>
</release>
<release version="1.2" date="unknown">
<action dev="dion" type="fix" issue="MPCLOVER-1">
Allows a new property to be used to specify the sort order of the HTML
clover report.
</action>
<release version="1.2" date="unknown">
<action dev="dion" type="fix" issue="MPCLOVER-1">
Allows a new property to be used to specify the sort order of the HTML
clover report.
</action>
<action dev="dion" type="update">
update to use maven.docs.*/maven.gen.docs
Update to use maven.docs.*/maven.gen.docs
</action>
<action dev="evenisse" type="fix" issue="MPCHANGELOG-9">
I register reports only if source, test,... exists.
@@ -82,7 +87,7 @@
registered.
</action>
<action dev="bwalding" type="update">
Upgrade to Clover 1.2
Upgrade to Clover 1.2
</action>
<action dev="vmassol" type="update">
Make sure that test failures or errors do not stop the generation
@@ -106,9 +111,10 @@
<release version="1.0" date="unknown">
<action dev="vmassol" type="unknown">
This changes did not exist at that time. Please refer to CVS for
These changes did not exist at that time. Please refer to CVS for
history changes before version 1.1.
</action>
</release>
</body>
</document>
+2 -2
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
@@ -17,7 +18,6 @@
*/
-->
<document>
<properties>
<title>Maven Clover plugin goals</title>
+3 -2
View File
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -20,14 +21,14 @@
<document>
<properties>
<title>Maven Clover Plug-in</title>
<title>Maven Clover plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Maven Clover plugin">
<p>
The Clover Plug-in is the place where
The Clover plugin is the place where
<a href="http://www.thecortex.net/clover/">Clover</a> tools are found
in Maven.
</p>
+3 -1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -31,8 +32,9 @@
<item name="Properties" href="/properties.html"/>
</menu>
<menu name="Downloads">
<item name="Clover plugin 1.3" href="http://www.ibiblio.org/maven/maven/plugins/maven-clover-plugin-1.3.jar"/>
<item name="Clover plugin 1.4" href="http://www.ibiblio.org/maven/maven/plugins/maven-clover-plugin-1.4.jar"/>
<item name="Clover plugin 1.3" href="http://www.ibiblio.org/maven/maven/plugins/maven-clover-plugin-1.3.jar"/>
</menu>
</body>
</project>
+1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.