api / org.gradle.testing.jacoco.plugins / JacocoTaskExtension

JacocoTaskExtension

@Incubating open class JacocoTaskExtension

Extension for tasks that should run with a Jacoco agent to generate coverage execution data.

Types

Output

class Output

The types of output that the agent can use for execution data.

Constructors

<init>

JacocoTaskExtension(project: Project, agent: JacocoAgentJar, task: JavaForkOptions)

Creates a Jacoco task extension.

Functions

getAddress

open fun getAddress(): String

IP address or hostname to use with Output#TCP_SERVER or Output#TCP_CLIENT. Defaults to localhost.

getAgentClasspath

open fun getAgentClasspath(): FileCollection

The Jacoco agent classpath. This contains only one file - the agent jar.

getAsJvmArg

open fun getAsJvmArg(): String

Gets all properties in the format expected of the agent JVM argument.

getClassDumpDir

open fun getClassDumpDir(): File

Path to dump all class files the agent sees are dumped to. Defaults to no dumps.

getDestinationFile

open fun getDestinationFile(): File

The path for the execution data to be written to.

getExcludeClassLoaders

open fun getExcludeClassLoaders(): MutableList<String>

List of classloader names that should be excluded from analysis. Names can use wildcards (* and ?). Defaults to an empty list.

getExcludes

open fun getExcludes(): MutableList<String>

List of class names that should be excluded from analysis. Names can use wildcard (* and ?). Defaults to an empty list.

getIncludes

open fun getIncludes(): MutableList<String>

List of class names that should be included in analysis. Names can use wildcards (* and ?). If left empty, all classes will be included. Defaults to an empty list.

getOutput

open fun getOutput(): Output

The type of output to generate. Defaults to Output#FILE.

getPort

open fun getPort(): Int

Port to bind to for Output#TCP_SERVER or Output#TCP_CLIENT. Defaults to 6300.

getSessionId

open fun getSessionId(): String

An identifier for the session written to the execution data. Defaults to an auto-generated identifier.

isAppend

open fun isAppend(): Boolean

Whether or not data should be appended if the destinationFile already exists. Defaults to true.

isDumpOnExit

open fun isDumpOnExit(): Boolean

Whether or not to dump the coverage data at VM shutdown. Defaults to true.

isEnabled

open fun isEnabled(): Boolean

Whether or not the task should generate execution data. Defaults to true.

isIncludeNoLocationClasses

open fun isIncludeNoLocationClasses(): Boolean

Whether or not classes without source location should be instrumented. Defaults to false. This property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.7.6)

isJmx

open fun isJmx(): Boolean

Whether or not to expose functionality via JMX under org.jacoco:type=Runtime. Defaults to false. The configuration of the jmx property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.6.2)

setAddress

open fun setAddress(address: String): Unit

setAppend

open fun setAppend(append: Boolean): Unit

setClassDumpDir

open fun setClassDumpDir(classDumpDir: File): Unit

Sets path to dump all class files the agent sees are dumped to. Defaults to no dumps.

setDestinationFile

open fun setDestinationFile(destinationFile: Provider<File>): Unit

Set the provider for calculating the destination file.

open fun setDestinationFile(destinationFile: File): Unit

setDumpOnExit

open fun setDumpOnExit(dumpOnExit: Boolean): Unit

setEnabled

open fun setEnabled(enabled: Boolean): Unit

setExcludeClassLoaders

open fun setExcludeClassLoaders(excludeClassLoaders: MutableList<String>): Unit

setExcludes

open fun setExcludes(excludes: MutableList<String>): Unit

setIncludeNoLocationClasses

open fun setIncludeNoLocationClasses(includeNoLocationClasses: Boolean): Unit

setIncludes

open fun setIncludes(includes: MutableList<String>): Unit

setJmx

open fun setJmx(jmx: Boolean): Unit

setOutput

open fun setOutput(output: Output): Unit

setPort

open fun setPort(port: Int): Unit

setSessionId

open fun setSessionId(sessionId: String): Unit