public class JacocoTaskExtension
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
JacocoTaskExtension.Output |
The types of output that the agent can use for execution data.
|
Constructor | Description |
---|---|
JacocoTaskExtension(Project project,
org.gradle.internal.jacoco.JacocoAgentJar agent,
JavaForkOptions task) |
Creates a Jacoco task extension.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
getAddress() |
IP address or hostname to use with
JacocoTaskExtension.Output.TCP_SERVER or JacocoTaskExtension.Output.TCP_CLIENT . |
FileCollection |
getAgentClasspath() |
The Jacoco agent classpath.
|
java.lang.String |
getAsJvmArg() |
Gets all properties in the format expected of the agent JVM argument.
|
java.io.File |
getClassDumpDir() |
Path to dump all class files the agent sees are dumped to.
|
java.io.File |
getDestinationFile() |
The path for the execution data to be written to.
|
java.util.List<java.lang.String> |
getExcludeClassLoaders() |
List of classloader names that should be excluded from analysis.
|
java.util.List<java.lang.String> |
getExcludes() |
List of class names that should be excluded from analysis.
|
java.util.List<java.lang.String> |
getIncludes() |
List of class names that should be included in analysis.
|
JacocoTaskExtension.Output |
getOutput() |
The type of output to generate.
|
int |
getPort() |
Port to bind to for
JacocoTaskExtension.Output.TCP_SERVER or JacocoTaskExtension.Output.TCP_CLIENT . |
java.lang.String |
getSessionId() |
An identifier for the session written to the execution data.
|
boolean |
isAppend() |
Deprecated.
The Jacoco plugin now deletes the old coverage file before task execution, so the data will never be appended to an existing coverage file from another task.
Use
JacocoMerge to merge different execution files or use JacocoReportBase.setExecutionData(FileCollection) to generate a report from multiple execution files at once.
Append is set to true for the agent since this allows multiple JVMs spawned by one task to write to the same destinationFile . |
boolean |
isDumpOnExit() |
Whether or not to dump the coverage data at VM shutdown.
|
boolean |
isEnabled() |
Whether or not the task should generate execution data.
|
boolean |
isIncludeNoLocationClasses() |
Whether or not classes without source location should be instrumented.
|
boolean |
isJmx() |
Whether or not to expose functionality via JMX under
org.jacoco:type=Runtime . |
void |
setAddress(java.lang.String address) |
|
void |
setAppend(boolean append) |
Deprecated.
|
void |
setClassDumpDir(java.io.File classDumpDir) |
Sets path to dump all class files the agent sees are dumped to.
|
void |
setDestinationFile(java.io.File destinationFile) |
|
void |
setDestinationFile(Provider<java.io.File> destinationFile) |
Set the provider for calculating the destination file.
|
void |
setDumpOnExit(boolean dumpOnExit) |
|
void |
setEnabled(boolean enabled) |
|
void |
setExcludeClassLoaders(java.util.List<java.lang.String> excludeClassLoaders) |
|
void |
setExcludes(java.util.List<java.lang.String> excludes) |
|
void |
setIncludeNoLocationClasses(boolean includeNoLocationClasses) |
|
void |
setIncludes(java.util.List<java.lang.String> includes) |
|
void |
setJmx(boolean jmx) |
|
void |
setOutput(JacocoTaskExtension.Output output) |
|
void |
setPort(int port) |
|
void |
setSessionId(java.lang.String sessionId) |
public JacocoTaskExtension(Project project, org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task)
project
- the projectagent
- the agent JAR to use for analysistask
- the task we extend@Input public boolean isEnabled()
true
.public void setEnabled(boolean enabled)
@Nullable @Optional @OutputFile public java.io.File getDestinationFile()
@Incubating public void setDestinationFile(Provider<java.io.File> destinationFile)
destinationFile
- Destination file providerpublic void setDestinationFile(java.io.File destinationFile)
@Deprecated @Input public boolean isAppend()
JacocoMerge
to merge different execution files or use JacocoReportBase.setExecutionData(FileCollection)
to generate a report from multiple execution files at once.
Append is set to true for the agent since this allows multiple JVMs spawned by one task to write to the same destinationFile
.destinationFile
already exists. Defaults to true
.@Deprecated public void setAppend(boolean append)
@Nullable @Optional @Input public java.util.List<java.lang.String> getIncludes()
public void setIncludes(@Nullable java.util.List<java.lang.String> includes)
@Nullable @Optional @Input public java.util.List<java.lang.String> getExcludes()
public void setExcludes(@Nullable java.util.List<java.lang.String> excludes)
@Nullable @Optional @Input public java.util.List<java.lang.String> getExcludeClassLoaders()
public void setExcludeClassLoaders(@Nullable java.util.List<java.lang.String> excludeClassLoaders)
@Input public boolean isIncludeNoLocationClasses()
false
.
This property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.7.6)public void setIncludeNoLocationClasses(boolean includeNoLocationClasses)
@Nullable @Optional @Input public java.lang.String getSessionId()
public void setSessionId(@Nullable java.lang.String sessionId)
@Input public boolean isDumpOnExit()
true
.public void setDumpOnExit(boolean dumpOnExit)
@Input public JacocoTaskExtension.Output getOutput()
JacocoTaskExtension.Output.FILE
.public void setOutput(JacocoTaskExtension.Output output)
@Nullable @Optional @Input public java.lang.String getAddress()
JacocoTaskExtension.Output.TCP_SERVER
or JacocoTaskExtension.Output.TCP_CLIENT
. Defaults to localhost.public void setAddress(@Nullable java.lang.String address)
@Input public int getPort()
JacocoTaskExtension.Output.TCP_SERVER
or JacocoTaskExtension.Output.TCP_CLIENT
. Defaults to 6300.public void setPort(int port)
@Nullable @Optional @LocalState public java.io.File getClassDumpDir()
public void setClassDumpDir(@Nullable java.io.File classDumpDir)
@Input public boolean isJmx()
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)public void setJmx(boolean jmx)
@Incubating @Classpath public FileCollection getAgentClasspath()
@Internal public java.lang.String getAsJvmArg()