Author: vmassol
Date: Thu Feb 24 04:39:06 2005
New Revision: 155182

URL: http://svn.apache.org/viewcvs?view=rev&rev=155182
Log:
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).

Added:
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/maven.xml
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.properties
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.xml
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java
   (with props)
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/
    
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java
   (with props)
Modified:
    maven/maven-1/plugins/trunk/clover/plugin.jelly
    maven/maven-1/plugins/trunk/clover/plugin.properties
    maven/maven-1/plugins/trunk/clover/xdocs/changes.xml
    maven/maven-1/plugins/trunk/clover/xdocs/goals.xml
    maven/maven-1/plugins/trunk/clover/xdocs/properties.xml

Modified: maven/maven-1/plugins/trunk/clover/plugin.jelly
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/plugin.jelly?view=diff&r1=155181&r2=155182
==============================================================================
--- maven/maven-1/plugins/trunk/clover/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/clover/plugin.jelly Thu Feb 24 04:39:06 2005
@@ -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>
   
   <!--
@@ -426,6 +468,18 @@
 
     </ant:clover-check>
     
+  </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>

Modified: maven/maven-1/plugins/trunk/clover/plugin.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/plugin.properties?view=diff&r1=155181&r2=155182
==============================================================================
--- maven/maven-1/plugins/trunk/clover/plugin.properties (original)
+++ maven/maven-1/plugins/trunk/clover/plugin.properties Thu Feb 24 04:39:06 
2005
@@ -60,6 +60,11 @@
 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%

Added: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/maven.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/maven.xml?view=auto&rev=155182
==============================================================================
--- 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/maven.xml
 (added)
+++ 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/maven.xml
 Thu Feb 24 04:39:06 2005
@@ -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>
\ No newline at end of file

Added: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.properties?view=auto&rev=155182
==============================================================================
--- 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.properties
 (added)
+++ 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.properties
 Thu Feb 24 04:39:06 2005
@@ -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.
+# -------------------------------------------------------------------

Added: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.xml?view=auto&rev=155182
==============================================================================
--- 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.xml
 (added)
+++ 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/project.xml
 Thu Feb 24 04:39:06 2005
@@ -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>

Added: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java?view=auto&rev=155182
==============================================================================
--- 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java
 (added)
+++ 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java
 Thu Feb 24 04:39:06 2005
@@ -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()
+    {        
+    }
+} 
\ No newline at end of file

Propchange: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/main/org/apache/maven/clover/test/Simple.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java?view=auto&rev=155182
==============================================================================
--- 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java
 (added)
+++ 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java
 Thu Feb 24 04:39:06 2005
@@ -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();
+    }
+} 
\ No newline at end of file

Propchange: 
maven/maven-1/plugins/trunk/clover/src/plugin-test/testGenerateHistoryReport/src/test/org/apache/maven/clover/test/SimpleTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/maven-1/plugins/trunk/clover/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/xdocs/changes.xml?view=diff&r1=155181&r2=155182
==============================================================================
--- maven/maven-1/plugins/trunk/clover/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/clover/xdocs/changes.xml Thu Feb 24 04:39:06 
2005
@@ -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).

Modified: maven/maven-1/plugins/trunk/clover/xdocs/goals.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/xdocs/goals.xml?view=diff&r1=155181&r2=155182
==============================================================================
--- maven/maven-1/plugins/trunk/clover/xdocs/goals.xml (original)
+++ maven/maven-1/plugins/trunk/clover/xdocs/goals.xml Thu Feb 24 04:39:06 2005
@@ -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>

Modified: maven/maven-1/plugins/trunk/clover/xdocs/properties.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/clover/xdocs/properties.xml?view=diff&r1=155181&r2=155182
==============================================================================
--- maven/maven-1/plugins/trunk/clover/xdocs/properties.xml (original)
+++ maven/maven-1/plugins/trunk/clover/xdocs/properties.xml Thu Feb 24 04:39:06 
2005
@@ -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>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to