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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumThe types of output that the agent can use for execution data.
- 
Constructor SummaryConstructorsConstructorDescriptionJacocoTaskExtension(ObjectFactory objects, org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task) Creates a Jacoco task extension.
- 
Method SummaryModifier and TypeMethodDescriptionIP 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.Path to dump all class files the agent sees are dumped to.The 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.An 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(String address) voidsetClassDumpDir(File classDumpDir) Sets path to dump all class files the agent sees are dumped to.voidsetDestinationFile(File destinationFile) voidsetDestinationFile(Provider<File> destinationFile) Set the provider for calculating the destination file.voidsetDumpOnExit(boolean dumpOnExit) voidsetEnabled(boolean enabled) voidsetExcludeClassLoaders(List<String> excludeClassLoaders) voidsetExcludes(List<String> excludes) voidsetIncludeNoLocationClasses(boolean includeNoLocationClasses) voidsetIncludes(List<String> includes) voidsetJmx(boolean jmx) voidsetOutput(JacocoTaskExtension.Output output) voidsetPort(int port) voidsetSessionId(String sessionId) 
- 
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 factory
- agent- the agent JAR to use for analysis
- task- the task we extend
 
 
- 
- 
Method Details- 
isEnabledWhether or not the task should generate execution data. Defaults totrue.
- 
setEnabledpublic void setEnabled(boolean enabled) 
- 
getDestinationFileThe path for the execution data to be written to.
- 
setDestinationFileSet the provider for calculating the destination file.- Parameters:
- destinationFile- Destination file provider
- Since:
- 4.0
 
- 
setDestinationFile
- 
getIncludesList 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.
- 
setIncludes
- 
getExcludesList of class names that should be excluded from analysis. Names can use wildcard (* and ?). Defaults to an empty list.
- 
setExcludes
- 
getExcludeClassLoadersList of classloader names that should be excluded from analysis. Names can use wildcards (* and ?). Defaults to an empty list.
- 
setExcludeClassLoaders
- 
isIncludeNoLocationClassesWhether 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)
- 
setIncludeNoLocationClassespublic void setIncludeNoLocationClasses(boolean includeNoLocationClasses) 
- 
getSessionIdAn identifier for the session written to the execution data. Defaults to an auto-generated identifier.
- 
setSessionId
- 
isDumpOnExitWhether or not to dump the coverage data at VM shutdown. Defaults totrue.
- 
setDumpOnExitpublic void setDumpOnExit(boolean dumpOnExit) 
- 
getOutputThe type of output to generate. Defaults toJacocoTaskExtension.Output.FILE.
- 
setOutput
- 
getAddressIP address or hostname to use withJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT. Defaults to localhost.
- 
setAddress
- 
getPortPort to bind to forJacocoTaskExtension.Output.TCP_SERVERorJacocoTaskExtension.Output.TCP_CLIENT. Defaults to 6300.
- 
setPortpublic void setPort(int port) 
- 
getClassDumpDirPath to dump all class files the agent sees are dumped to. Defaults to no dumps.- Since:
- 3.4
 
- 
setClassDumpDirSets path to dump all class files the agent sees are dumped to. Defaults to no dumps.- Since:
- 3.4
 
- 
isJmxWhether 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)
- 
setJmxpublic void setJmx(boolean jmx) 
- 
getAgentClasspathThe Jacoco agent classpath. This contains only one file - the agent jar.- Since:
- 4.6
 
- 
getAsJvmArgGets all properties in the format expected of the agent JVM argument.- Returns:
- state of extension in a JVM argument
 
 
-