Added support for historical reports by adding a new <code>clover:save-history</code> goal that saves a Clover history point. The history points are then used by <code>clover:report</code> to generate history reports (including a link on the Maven-generated website).
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@155182 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -64,13 +64,10 @@
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
<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.clover.build.classes}"/>
|
||||
<ant:mkdir dir="${cloverReportDirectory}"/>
|
||||
<ant:mkdir dir="${maven.clover.database.dir}"/>
|
||||
|
||||
<!-- Add the Clover license to the classpath. -->
|
||||
@@ -81,6 +78,8 @@
|
||||
</j:invokeStatic>
|
||||
</j:if>
|
||||
|
||||
<u:file var="historyDirAsFile" name="${maven.clover.history.dir}"/>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
@@ -317,7 +316,12 @@
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="clover:html-report-internal">
|
||||
|
||||
<j:set var="cloverReportDirectory" value="${maven.docs.dest}/clover"/>
|
||||
<ant:mkdir dir="${cloverReportDirectory}"/>
|
||||
|
||||
<ant:clover-report>
|
||||
|
||||
<ant:current
|
||||
outfile="${cloverReportDirectory}"
|
||||
title="${pom.name} - ${pom.currentVersion}">
|
||||
@@ -331,7 +335,23 @@
|
||||
|
||||
</ant:format>
|
||||
</ant:current>
|
||||
|
||||
<!-- Only generate history report if there is at least one history point -->
|
||||
<j:if test="${historyDirAsFile.exists() and !empty(historyDirAsFile.listFiles())}">
|
||||
|
||||
<j:set var="cloverHistoryReportDirectory" value="${maven.docs.dest}/clover/history"/>
|
||||
<ant:mkdir dir="${cloverHistoryReportDirectory}"/>
|
||||
|
||||
<ant:historical outfile="${cloverHistoryReportDirectory}"
|
||||
historyDir="${maven.clover.history.dir}"
|
||||
title="${pom.name} - ${pom.currentVersion} - History">
|
||||
<ant:format type="html"/>
|
||||
</ant:historical>
|
||||
|
||||
</j:if>
|
||||
|
||||
</ant:clover-report>
|
||||
|
||||
</goal>
|
||||
<goal
|
||||
name="clover:html-report"
|
||||
@@ -357,6 +377,7 @@
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="maven-clover-plugin:register">
|
||||
|
||||
<j:if test="${unitTestSourcesPresent == 'true'}">
|
||||
<doc:registerReport
|
||||
name="Clover"
|
||||
@@ -364,7 +385,19 @@
|
||||
link="clover/index"
|
||||
target="_blank"
|
||||
description="Clover test coverage report."/>
|
||||
|
||||
<!-- Only generate history report if there is at least one history point -->
|
||||
<j:if test="${historyDirAsFile.exists() and !empty(historyDirAsFile.listFiles())}">
|
||||
<doc:registerReport
|
||||
name="Clover History"
|
||||
pluginName="maven-clover-plugin"
|
||||
link="clover/history/historical"
|
||||
target="_blank"
|
||||
description="Clover test coverage history report."/>
|
||||
</j:if>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
@@ -373,9 +406,18 @@
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="maven-clover-plugin:deregister">
|
||||
|
||||
<j:if test="${unitTestSourcesPresent == 'true'}">
|
||||
|
||||
<doc:deregisterReport name="Clover"/>
|
||||
|
||||
<!-- Only deregister the history report if there is at least one history point -->
|
||||
<j:if test="${historyDirAsFile.exists() and !empty(historyDirAsFile.listFiles())}">
|
||||
<doc:deregisterReport name="Clover History"/>
|
||||
</j:if>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
@@ -428,4 +470,16 @@
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Record a history point
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="clover:save-history" prereqs="clover:init"
|
||||
description="Record a history point">
|
||||
|
||||
<ant:clover-historypoint historyDir="${maven.clover.history.dir}"/>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -60,6 +60,11 @@ maven.clover.execute.during.report = true
|
||||
maven.clover.includes = **/*.java
|
||||
maven.clover.excludes =
|
||||
|
||||
# Directory where Clover history data are saved. If you wish to save your
|
||||
# history point data so that they are not erased, point this directory to
|
||||
# a safe place that will not be deleted by a "maven clean".
|
||||
maven.clover.history.dir = ${maven.clover.build}/history
|
||||
|
||||
# Test coverage % under which the build will fail when clover:check is called.
|
||||
# Set it to an empty value if you wish to only use the per-package definitions.
|
||||
maven.clover.check.target = 50%
|
||||
|
||||
40
clover/src/plugin-test/testGenerateHistoryReport/maven.xml
Normal file
40
clover/src/plugin-test/testGenerateHistoryReport/maven.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<project default="testPlugin"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:x="jelly:xml"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:assert="assert">
|
||||
|
||||
<goal name="testPlugin">
|
||||
|
||||
<attainGoal name="clean"/>
|
||||
|
||||
<attainGoal name="clover:test"/>
|
||||
<attainGoal name="clover:save-history"/>
|
||||
|
||||
<attainGoal name="site"/>
|
||||
|
||||
<!-- Verifications -->
|
||||
<assert:assertFileExists file="${maven.docs.dest}/clover/history/historical.html"/>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
# -------------------------------------------------------------------
|
||||
# Copyright 2005 The Apache Software Foundation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# -------------------------------------------------------------------
|
||||
37
clover/src/plugin-test/testGenerateHistoryReport/project.xml
Normal file
37
clover/src/plugin-test/testGenerateHistoryReport/project.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<id>testGenerateHistoryReport</id>
|
||||
<name>testGenerateHistoryReport</name>
|
||||
<build>
|
||||
<sourceDirectory>src/main</sourceDirectory>
|
||||
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
|
||||
<unitTest>
|
||||
<includes>
|
||||
<include>**/*Test.java</include>
|
||||
</includes>
|
||||
</unitTest>
|
||||
</build>
|
||||
<reports>
|
||||
<report>maven-clover-plugin</report>
|
||||
</reports>
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.apache.maven.clover.test;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
public class Simple
|
||||
{
|
||||
public void someMethod()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.apache.maven.clover.test;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SimpleTest extends TestCase
|
||||
{
|
||||
public void testSomeMethod()
|
||||
{
|
||||
Simple simple = new Simple();
|
||||
simple.someMethod();
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,13 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.8" date="in SVN">
|
||||
<action dev="vmassol" type="add">
|
||||
Added support for historical reports by adding a new
|
||||
<code>clover:save-history</code> goal that saves a Clover
|
||||
history point. The history points are then used by
|
||||
<code>clover:report</code> to generate history reports
|
||||
(including a link on the Maven-generated website).
|
||||
</action>
|
||||
<action dev="vmassol" type="update">
|
||||
Updated to Clover 1.3.5 and applied new license that supports
|
||||
generating history report (the previous one didn't support it).
|
||||
|
||||
@@ -110,6 +110,13 @@
|
||||
threshold.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>clover:save-history</name>
|
||||
<description>
|
||||
Saves a Clover history point that will then be used for generating
|
||||
history reports when the <code>clover:report</code> goal is called.
|
||||
</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
@@ -246,6 +246,20 @@
|
||||
N/A
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.clover.history.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Directory where Clover history data are saved. If you wish to save
|
||||
your history point data so that they are not erased, point this
|
||||
directory to a safe place that will not be deleted by a
|
||||
"maven clean". In the future we will try to implement saving the
|
||||
history points in the Maven repositories.
|
||||
</td>
|
||||
<td>
|
||||
${maven.clover.build}/history
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user