Home | Forums

Clover Setup Task


The <clover-setup> task initializes Clover.NET for your project. In addition to telling Clover.NET where to find the coverage database, the setup task tells NAnt to use Clover.NET instrumentation when compiling C# code with the <csc> task when Clover is enabled.


Attribute Description Required
initstring The initString describes the location of the Clover.NET coverage database. Typically this is a relative or absolute file reference. Yes
builddir The location where the Instrumented source is written. If you do not specify a location a temporary location is used and the instrumented source is deleted after compilation. No
enabled This controls whether Clover.NET will instrument code during code compilation. This attribute provides a convenient control point to enable or disable Clover.NET from the command line No
flushinterval When set to a value, this enables flushing and the value is the minimum period between flush operations (in milliseconds) No
flatten Instructs Clover.NET to flatten the directory structure of the source tree in the CloverBuild area. If not set or set to false the source directory structure is replicated in the build area No
instassigns If false, Clover.NET will not instrument boolean expressions containing assignment statements as this instrumentation may cause the compiler to not be able to decide if an uninitialized variable has been used. Defaults to true. No
keyfile Location of the key file for signing assemblies. Normally Clover.NET can determine this without any additional infromation. In some cases, where the location is a constant, for example, it can be specified here to allow the Clovered build to be signed correctly. No

Nested Filesets

The <clover-setup> task supports one or more nested filesets which can be used to control which source files are Clovered during the compilation process. Files which are excluded are copied to the build area but are not instrumented.


This example shows a straight forward use of <clover-setup>

        <clover-setup initstring="CloverBuild\clover.cdb" 

In this example, the use of Clover.NETis controlled through the clover.enabled property. This allows the use of Clover to be controlled from the NAnt command line. Note also the use of a flushinterval to enable flushing every second. Finally, the use of the flatten attribute causes the Clover.NET instrumenter to write all the instrumented files into the CloverBuild directory regardless of their location in the source hierarchy

This example shows the use of nested filesets to control which classes are instrumented

        <clover-setup initstring="CloverBuild\clover.cdb" 
          <fileset basedir=".">
            <include name="**/*"/>
            <exclude name="**/nunit-gui/**/*"/>
            <exclude name="**/uikit/**/*"/>
            <exclude name="**/tests/**/*"/>