This tool copies and instruments a set of Java source files specified on the command line. The output of the instrumentation process is instrumented java source; you will then need to compile the instrumented source using a standard Java compiler.
Usage
java com.cenqua.clover.CloverInstr [OPTIONS] PARAMS [FILES...]
Params
-i, --initstring <file> |
Clover initstring. This is the full path to the dbfile that will be used to construct/update to store coverage data. |
-s, --srcdir <dir> |
Directory containing source files to be instrumented. If omitted individual source files should be specified on the command line. |
-d, --destdir <dir> |
Directory where Clover should place the instrumented sources. Note that files will be overwritten in the destination directory. |
Options
-e, --encoding <encoding> |
Specify the file encoding for source files. If not specified, the platform default encoding is used. |
-f, --flushinterval <int> |
Tell Clover how often to flush coverage data when using either "interval" or "threaded" flushpolicy. Value in milliseconds. |
--instrumentation <policy> |
Set the instrumentation strategy. Valid values are "field" and "class". Default is "class". |
-jdk14 |
Direct Clover to parse sources using the JDK1.4 grammar. |
-jdk15 |
Direct Clover to parse sources using the JDK1.5 grammar. |
-p, --flushpolicy <policy> |
Tell Clover which flushpolicy to use when flushing coverage data to disk. Valid values are "directed", "interval" and "threaded". With "interval" or "threaded", you must also specify a flushinterval using -f. The default value is "directed". |
--recordTestResults <true|false> |
If set to " |
--sourceRoot <string> |
Source root path prefix that will be ignored when evaluating the test inclusion patterns. This parameter is optional; it specifies what is trimmed from the beginning of the file path before the tests Include/Exclude Pattern is evaluated (see parameters below). For example, if you specify |
--testsExcludePattern <string> |
Ant-style pattern of files NOT containing test classes and utilities. You may specify multiple patterns by separating them with commas. For example: |
--testsIncludePattern <string> |
Ant-style pattern of files containing test classes and utilities. If unspecified, Clover uses default test detection logic. You may specify multiple patterns by separating them with commas. For example: |
-v, --verbose |
Enable verbose logging. |
API Usage
CloverInstr provides a simple API that accepts an array of strings representing the command line arguments and returns an integer result code. The following fragment illustrates use of the API:
import com.cenqua.clover.CloverInstr;
...
String [] cliArgs =
{ "-jdk14", "-i", "clover.db", "-d", "build/instr", "Money.java" }
;
int result = CloverInstr.mainImpl(cliArgs);
if (result != 0) {
// problem during instrumentation
}
Examples
java com.cenqua.clover.CloverInstr -i clover.db -s src -d build/instr
Find all java source files in the directory "src", copy and instrument them into the directory "build/instr", which will be constructed if it does not exist. Coverage database "clover.db" is initialised.
java com.cenqua.clover.CloverInstr -jdk14 -i clover.db -d ../../build/instr \
Money.java IMoney.java
Copy and instrument the source files "Money.java" and "IMoney.java" into the directory "../../build/instr". Use the JDK1.4 grammar (ie. support the 'assert' keyword).