Class JacocoTaskExtension
java.lang.Object
org.gradle.testing.jacoco.plugins.JacocoTaskExtension
Extension for tasks that should run with a Jacoco agent to generate coverage execution data.
- Since:
- 1.6
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe types of output that the agent can use for execution data. -
Constructor Summary
ConstructorsConstructorDescriptionJacocoTaskExtension(ObjectFactory objects, org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task) Creates a Jacoco task extension. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringIP address or hostname to use withJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT.The Jacoco agent classpath.Gets all properties in the format expected of the agent JVM argument.@Nullable FilePath to dump all class files the agent sees are dumped to.abstract DirectoryPropertyPath to dump all class files the agent sees are dumped to.@Nullable FileThe path for the execution data to be written to.List of classloader names that should be excluded from analysis.List of class names that should be excluded from analysis.List of class names that should be included in analysis.The type of output to generate.intgetPort()Port to bind to forJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT.@Nullable StringAn identifier for the session written to the execution data.booleanWhether or not to dump the coverage data at VM shutdown.booleanWhether or not the task should generate execution data.booleanWhether or not classes without source location should be instrumented.booleanisJmx()Whether or not to expose functionality via JMX underorg.jacoco:type=Runtime.voidsetAddress(@Nullable String address) Sets the address.voidsetClassDumpDir(@Nullable File classDumpDir) Sets path to dump all class files the agent sees are dumped to.voidsetDestinationFile(@Nullable File destinationFile) Sets the destination file.voidsetDestinationFile(Provider<File> destinationFile) Set the provider for calculating the destination file.voidsetDumpOnExit(boolean dumpOnExit) Sets the dump on exit.voidsetEnabled(boolean enabled) Sets the enabled.voidsetExcludeClassLoaders(@Nullable List<String> excludeClassLoaders) Sets the exclude class loaders.voidsetExcludes(@Nullable List<String> excludes) Sets the excludes.voidsetIncludeNoLocationClasses(boolean includeNoLocationClasses) Sets the include no location classes.voidsetIncludes(@Nullable List<String> includes) Sets the includes.voidsetJmx(boolean jmx) Sets the jmx.voidsetOutput(JacocoTaskExtension.Output output) Sets the output.voidsetPort(int port) Sets the port.voidsetSessionId(@Nullable String sessionId) Sets the session id.
-
Constructor Details
-
JacocoTaskExtension
@Inject public JacocoTaskExtension(ObjectFactory objects, org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task) Creates a Jacoco task extension.- Parameters:
objects- the object factoryagent- the agent JAR to use for analysistask- the task we extend
-
-
Method Details
-
isEnabled
Whether or not the task should generate execution data. Defaults totrue.- Since:
- 1.6
-
setEnabled
public void setEnabled(boolean enabled) Sets the enabled.- Since:
- 1.6
-
getDestinationFile
The path for the execution data to be written to.- Since:
- 1.7
-
setDestinationFile
-
setDestinationFile
Sets the destination file.- Since:
- 1.7
-
getIncludes
-
setIncludes
-
getExcludes
-
setExcludes
-
getExcludeClassLoaders
-
setExcludeClassLoaders
-
isIncludeNoLocationClasses
Whether or not classes without source location should be instrumented. Defaults tofalse. This property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.7.6)- Since:
- 2.13
-
setIncludeNoLocationClasses
public void setIncludeNoLocationClasses(boolean includeNoLocationClasses) Sets the include no location classes.- Since:
- 2.13
-
getSessionId
-
setSessionId
-
isDumpOnExit
Whether or not to dump the coverage data at VM shutdown. Defaults totrue.- Since:
- 1.6
-
setDumpOnExit
public void setDumpOnExit(boolean dumpOnExit) Sets the dump on exit.- Since:
- 1.6
-
getOutput
The type of output to generate. Defaults toJacocoTaskExtension.Output.FILE.- Since:
- 1.6
-
setOutput
-
getAddress
IP address or hostname to use withJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT. Defaults to localhost.- Since:
- 1.6
-
setAddress
-
getPort
Port to bind to forJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT. Defaults to 6300.- Since:
- 1.6
-
setPort
public void setPort(int port) Sets the port.- Since:
- 1.6
-
getClassDumpDirectory
Path to dump all class files the agent sees are dumped to. Defaults to no dumps.- Since:
- 9.7.0
-
getClassDumpDir
Path to dump all class files the agent sees are dumped to. Defaults to no dumps.- Since:
- 3.4
-
setClassDumpDir
Sets path to dump all class files the agent sees are dumped to. Defaults to no dumps.- Since:
- 3.4
-
isJmx
Whether or not to expose functionality via JMX underorg.jacoco:type=Runtime. Defaults tofalse. The configuration of the jmx property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.6.2)- Since:
- 1.6
-
setJmx
public void setJmx(boolean jmx) Sets the jmx.- Since:
- 1.6
-
getAgentClasspath
The Jacoco agent classpath. This contains only one file - the agent jar.- Since:
- 4.6
-
getAsJvmArg
-