Package org.jacoco.ant
Class AbstractCoverageTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.jacoco.ant.AbstractCoverageTask
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AgentTask
,CoverageTask
public class AbstractCoverageTask
extends org.apache.tools.ant.Task
Base class for all coverage tasks that require agent options
-
Field Summary
FieldsFields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate File
protected String
Creates JVM argument to launch with the specified JaCoCo agent jar and the current optionsboolean
private AgentOptions
void
setAddress
(String address) Sets the IP address or hostname to bind to when output method is tcp server or connect to when the output method is tcp client.void
setAppend
(boolean append) Append execution coverage data if a coverage file is already present.void
setClassdumpdir
(File dir) Sets the directory where all class files seen by the agent should be dumped to.void
setDestfile
(File file) Sets the location to write coverage execution data to.void
setDumpOnExit
(boolean dumpOnExit) Dump coverage data on VM termination.void
setEnabled
(boolean enabled) Sets whether or not the current task is enabledvoid
setExclClassLoader
(String exclClassLoader) List of wildcard patterns for classloaders that JaCoCo will not instrument classes from.void
setExcludes
(String excludes) List of wildcard patterns classes to exclude from instrumentation.void
setInclBootstrapClasses
(boolean include) Sets whether classes from the bootstrap classloader should be instrumented.void
setInclNoLocationClasses
(boolean include) Sets whether classes without source location should be instrumented.void
setIncludes
(String includes) List of wildcard patterns classes to include for instrumentation.void
setJmx
(boolean jmx) Sets whether the agent should expose functionality via JMX.void
Sets the output method.void
setPort
(int port) Sets the Port to bind to when the output method is tcp server or connect to when the output method is tcp client.void
setSessionId
(String id) Sets the session identifier.Methods inherited from class org.apache.tools.ant.Task
bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
agentOptions
-
destfile
-
enabled
private boolean enabled
-
-
Constructor Details
-
AbstractCoverageTask
protected AbstractCoverageTask()Create default agent options
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Returns:
- Whether or not the current task is enabled
-
setEnabled
public void setEnabled(boolean enabled) Sets whether or not the current task is enabled- Parameters:
enabled
- Enablement state of the task
-
setDestfile
Sets the location to write coverage execution data to. Default isjacoco.exec
.- Parameters:
file
- Location to write coverage execution data to
-
setAppend
public void setAppend(boolean append) Append execution coverage data if a coverage file is already present. Default istrue
- Parameters:
append
-true
to append execution data to an existing file
-
setIncludes
List of wildcard patterns classes to include for instrumentation. Default is*
- Parameters:
includes
- Wildcard pattern of included classes
-
setExcludes
List of wildcard patterns classes to exclude from instrumentation. Default is the empty string, no classes excluded- Parameters:
excludes
- Wildcard pattern of excluded classes
-
setExclClassLoader
List of wildcard patterns for classloaders that JaCoCo will not instrument classes from. Default issun.reflect.DelegatingClassLoader
- Parameters:
exclClassLoader
- Wildcard pattern of class loaders to exclude
-
setInclBootstrapClasses
public void setInclBootstrapClasses(boolean include) Sets whether classes from the bootstrap classloader should be instrumented.- Parameters:
include
-true
if bootstrap classes should be instrumented
-
setInclNoLocationClasses
public void setInclNoLocationClasses(boolean include) Sets whether classes without source location should be instrumented.- Parameters:
include
-true
if classes without source location should be instrumented
-
setSessionId
Sets the session identifier. Default is a auto-generated id- Parameters:
id
- session identifier
-
setDumpOnExit
public void setDumpOnExit(boolean dumpOnExit) Dump coverage data on VM termination. Default istrue
- Parameters:
dumpOnExit
-true
to write coverage data on VM termination
-
setOutput
Sets the output method. Default isfile
- Parameters:
output
- Output method
-
setAddress
Sets the IP address or hostname to bind to when output method is tcp server or connect to when the output method is tcp client. Default islocalhost
- Parameters:
address
- Address to bind or connect to
-
setPort
public void setPort(int port) Sets the Port to bind to when the output method is tcp server or connect to when the output method is tcp client. Default is6300
- Parameters:
port
- port to bind to or connect to
-
setClassdumpdir
Sets the directory where all class files seen by the agent should be dumped to.- Parameters:
dir
- dump output location
-
setJmx
public void setJmx(boolean jmx) Sets whether the agent should expose functionality via JMX.- Parameters:
jmx
-true
if JMX should be enabled
-
getLaunchingArgument
Creates JVM argument to launch with the specified JaCoCo agent jar and the current options- Returns:
- JVM Argument to pass to new VM
-
prepareAgentOptions
-
getAgentFile
-