Extension class for configuring the Cobertura plugin. Most of the properties in this extension match options in Cobertura itself.
| Type | Name and description |
|---|---|
static java.lang.Object |
ENCODING_UNDEFINED |
java.lang.String |
androidVariantThe variant for android projects. |
org.gradle.api.file.FileCollection |
auxiliaryClasspathThe classpath when instrumenting. |
java.lang.String |
coberturaVersionVersion of cobertura to use for the plugin. |
boolean |
coverageCheckHaltOnFailureShould the build fail if the minimum coverage rates are not met? |
java.util.List<java.lang.String> |
coverageDirsDirectories under the base directory containing classes to be instrumented. |
java.lang.String |
coverageEncodingThe character encoding to use when generating coverage reports. |
java.util.List<java.lang.String> |
coverageExcludesList of exclude patterns |
java.util.Set<java.lang.String> |
coverageFormatsFormats of cobertura report. |
java.util.List<java.lang.String> |
coverageIgnoresList of ignore patterns |
java.util.List<java.lang.String> |
coverageIncludesList of include patterns |
java.io.File |
coverageInputDatafilePath to the data file to produce during instrumentation. |
java.util.List<java.io.File> |
coverageMergeDatafilesA list of data files to merge into a single data file to produce a merged report. |
java.io.File |
coverageOutputDatafilePath to the data file to use during tests. |
java.io.File |
coverageReportDatafilePath to the data file to use when generating reports tests. |
java.io.File |
coverageReportDirPath to report directory for coverage report. |
java.util.Set<java.io.File> |
coverageSourceDirsDirectories of source files to use. |
| Constructor and description |
|---|
CoberturaExtension
(org.gradle.api.Project project)Constructor for the extension. |
| Type | Name and description |
|---|---|
void |
coverageClassesTasks(groovy.lang.Closure c)Set the closure that will be used to determine what tasks need to be complete before we can instrument classes for coverage. |
void |
coverageTestTasks(groovy.lang.Closure c)Set the closure that will be used to determine what tests should be run when the cobertura task is invoked. |
java.lang.Integer |
getCoverageCheckBranchRate()@return The minimum acceptable branch coverage rate needed by each class. |
java.lang.Integer |
getCoverageCheckLineRate()@return The minimum acceptable line coverage rate needed by each class. |
java.lang.Integer |
getCoverageCheckPackageBranchRate()@return The minimum acceptable package branch coverage rate needed by each class. |
java.lang.Integer |
getCoverageCheckPackageLineRate()@return The minimum acceptable package line coverage rate needed by each class. |
java.util.List<java.util.Map> |
getCoverageCheckRegexes() |
java.lang.Integer |
getCoverageCheckTotalBranchRate()@return The minimum acceptable total branch coverage rate needed by each class. |
java.lang.Integer |
getCoverageCheckTotalLineRate()@return The minimum acceptable total line coverage rate needed by each class. |
org.gradle.api.tasks.TaskCollection |
getCoverageClassesTasks()@return the tasks that produce the classes that need to be instrumented for coverage reports, as returned by the coverageClassTasks closure |
java.util.List<java.lang.String> |
getCoverageIgnoreMethodAnnotations()@return the names of annotations used to flag methods to be ignored. |
boolean |
getCoverageIgnoreTrivial()@return whether or not we should ignore trivial methods. |
org.gradle.api.tasks.TaskCollection |
getCoverageTestTasks()@return the test tasks that should run, as returned by the coverageTestTask closure |
static org.gradle.api.file.FileCollection |
getExtractedJars(org.gradle.api.Project project)Used to fetch the extracted jars from android AARs during compilation. |
void |
setCoverageCheckBranchRate(java.lang.Integer coverageCheckBranchRate)Set the minimum acceptable branch coverage rate needed by each class. |
void |
setCoverageCheckLineRate(java.lang.Integer coverageCheckLineRate)Set the minimum acceptable line coverage rate needed by each class. |
void |
setCoverageCheckPackageBranchRate(java.lang.Integer coverageCheckPackageBranchRate)Set the minimum acceptable package branch coverage rate needed by each class. |
void |
setCoverageCheckPackageLineRate(java.lang.Integer coverageCheckPackageLineRate)Set the minimum acceptable package line coverage rate needed by each class. |
void |
setCoverageCheckRegexes(java.util.List<java.util.Map> coverageCheckRegexes)For finer grained control, you can optionally specify minimum branch and line coverage rates for individual classes using any number of regular expressions. |
void |
setCoverageCheckTotalBranchRate(java.lang.Integer coverageCheckTotalBranchRate)Set the minimum acceptable total branch coverage rate needed by each class. |
void |
setCoverageCheckTotalLineRate(java.lang.Integer coverageCheckTotalLineRate)Set the minimum acceptable total line coverage rate needed by each class. |
void |
setCoverageIgnoreMethodAnnotations(java.util.List<java.lang.String> ignoreMethodAnnotations)List of fully qualified annotation names that, if present on a method, will cause it to be ignored by Cobertura for coverage purposes. |
void |
setCoverageIgnoreTrivial(boolean ignoreTrivial)Whether or not to ignore trivial methods like simple getters and setters. |
static java.lang.String[] |
splitCamelCase(java.lang.String input) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The variant for android projects.
The classpath when instrumenting. Defaults to project.sourceSets.main.output.classesDir, project.sourceSets.main.compileClasspath,
Version of cobertura to use for the plugin. Defaults to 2.1.1
Should the build fail if the minimum coverage rates are not met?
Directories under the base directory containing classes to be instrumented. Defaults to [project.sourceSets.main.classesDir.path]
The character encoding to use when generating coverage reports. If no encoding is specified, the plugin uses the system default.
List of exclude patterns
Formats of cobertura report. Default is a single report in 'html' format.
List of ignore patterns
List of include patterns
Path to the data file to produce during instrumentation. This file is used to determine if instrumentation is up to date, so it cannot be used during the tests themselves. Defaults to ${project.buildDir.path}/cobertura/coberturaInput.ser
A list of data files to merge into a single data file to produce a merged report. If set, each of the datafiles in this list will be merged into a the single datafile, specified by coverageReportDatafile, before generating a coverage report.
Path to the data file to use during tests. The contents of this file are changed by testing, so a new copy is made from the input datafile before each test run. Defaults to ${project.buildDir.path}/cobertura/cobertura.ser
Path to the data file to use when generating reports tests. Most users won't need to change this property. Defaults to ${project.buildDir.path}/cobertura/cobertura.ser. The only time this should be changed is when users are merging datafiles and coverageMergeDatafiles contains the default datafile.
Path to report directory for coverage report. Defaults to ${project.reportsDir.path}/cobertura
Directories of source files to use. The default is to look for and include each of the following, if present: project.sourceSets.main.java.srcDirs, project.sourceSets.main.groovy.srcDirs, and project.sourceSets.main.scala.srcDirs
Constructor for the extension. It needs a project handle to set the coverageDirs sensible defaults.
project - the Gradle project that owns the extension.Set the closure that will be used to determine what tasks need to be complete before we can instrument classes for coverage. Used to override the default closure, which returns the "classes" task.
c - a no-argument closure that returns a TaskCollection. Set the closure that will be used to determine what tests should be run
when the cobertura task is invoked. Used to override the default
closure, which returns all tasks of type Test
c - a no-argument closure that returns a TaskCollection.
Used to fetch the extracted jars from android AARs during compilation.
Set the minimum acceptable branch coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckBranchRate - the rate to setSet the minimum acceptable line coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckLineRate - the rate to setSet the minimum acceptable package branch coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckPackageBranchRate - the rate to setSet the minimum acceptable package line coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckPackageLineRate - the rate to setFor finer grained control, you can optionally specify minimum branch and line coverage rates for individual classes using any number of regular expressions. Each expression is a map with 3 keys:
coverageCheckRegexes = [ [ regex: 'com.example.reallyimportant.*', branchRate: 80, lineRate: 90 ], [ regex: 'com.example.boringcode.*', branchRate: 40, lineRate: 30 ] ]
coverageCheckRegexes - the expressions to use.Set the minimum acceptable total branch coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckTotalBranchRate - the rate to setSet the minimum acceptable total line coverage rate needed by each class. This needs to be an integer value between 0 and 100.
coverageCheckTotalLineRate - the rate to setList of fully qualified annotation names that, if present on a method, will cause it to be ignored by Cobertura for coverage purposes. Available in Cobertura 2.0.0 and later. Attempting to set this property when using Cobertura 1.x will result in an error.
ignoreMethodAnnotations - the names of annotations used to flag
methods to be ignoredWhether or not to ignore trivial methods like simple getters and setters. Available in in Cobertura 2.0.0 and later. Attempting to set this property when using Cobertura 1.x will result in an error.
ignoreTrivial - whether or not we should ignore trivial methods.Groovy Documentation