vmassol     2004/04/02 13:12:02

  Modified:    clover   plugin.jelly project.properties plugin.properties
                        project.xml
               clover/xdocs properties.xml navigation.xml index.xml
                        goals.xml changes.xml
               clover/src/plugin-test project.xml
  Log:
  - 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

  
  Revision  Changes    Path
  1.20      +119 -57   maven-plugins/clover/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/plugin.jelly,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- plugin.jelly      4 Mar 2004 18:01:58 -0000       1.19
  +++ plugin.jelly      2 Apr 2004 21:12:01 -0000       1.20
  @@ -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)}
  @@ -165,6 +178,20 @@
   
     <!--
        ========================================================================
  +       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
          be generated.
        ========================================================================
  @@ -251,5 +278,40 @@
       name="clover:swing-report"
       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>
  
  
  
  1.6       +1 -1      maven-plugins/clover/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/project.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- project.properties        4 Mar 2004 18:01:58 -0000       1.5
  +++ project.properties        2 Apr 2004 21:12:01 -0000       1.6
  @@ -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
   
  
  
  
  1.8       +12 -7     maven-plugins/clover/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/plugin.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- plugin.properties 4 Mar 2004 18:01:58 -0000       1.7
  +++ plugin.properties 2 Apr 2004 21:12:01 -0000       1.8
  @@ -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.33      +2 -2      maven-plugins/clover/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/project.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- project.xml       7 Mar 2004 23:01:24 -0000       1.32
  +++ project.xml       2 Apr 2004 21:12:02 -0000       1.33
  @@ -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>
  
  
  
  1.9       +1 -0      maven-plugins/clover/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/xdocs/properties.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- properties.xml    4 Mar 2004 18:01:58 -0000       1.8
  +++ properties.xml    2 Apr 2004 21:12:02 -0000       1.9
  @@ -1,4 +1,5 @@
   <?xml version="1.0"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  
  
  
  1.6       +3 -1      maven-plugins/clover/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/xdocs/navigation.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- navigation.xml    4 Mar 2004 18:01:58 -0000       1.5
  +++ navigation.xml    2 Apr 2004 21:12:02 -0000       1.6
  @@ -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.5       +3 -2      maven-plugins/clover/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/xdocs/index.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.xml 4 Mar 2004 18:01:58 -0000       1.4
  +++ index.xml 2 Apr 2004 21:12:02 -0000       1.5
  @@ -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="[EMAIL PROTECTED]">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>
  
  
  
  1.4       +2 -2      maven-plugins/clover/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/xdocs/goals.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- goals.xml 4 Mar 2004 18:01:58 -0000       1.3
  +++ goals.xml 2 Apr 2004 21:12:02 -0000       1.4
  @@ -1,5 +1,6 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<!-- 
  +
  +  <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    * 
  @@ -16,7 +17,6 @@
    * limitations under the License.
    */
    -->
  -
   
   <document>
     <properties>
  
  
  
  1.23      +30 -24    maven-plugins/clover/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/xdocs/changes.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- changes.xml       4 Mar 2004 18:01:58 -0000       1.22
  +++ changes.xml       2 Apr 2004 21:12:02 -0000       1.23
  @@ -18,6 +18,7 @@
    -->
   
   <document>
  +
     <properties>
       <title>Changes</title>
       <author email="[EMAIL PROTECTED]">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>
  
  
  
  1.4       +2 -2      maven-plugins/clover/src/plugin-test/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/clover/src/plugin-test/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml       4 Mar 2004 18:01:58 -0000       1.3
  +++ project.xml       2 Apr 2004 21:12:02 -0000       1.4
  @@ -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>
  
  
  

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

Reply via email to