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:
java.lang.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
Fields Modifier and Type Field Description private AgentOptions
agentOptions
private java.io.File
destfile
private boolean
enabled
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCoverageTask()
Create default agent options
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.io.File
getAgentFile()
protected java.lang.String
getLaunchingArgument()
Creates JVM argument to launch with the specified JaCoCo agent jar and the current optionsboolean
isEnabled()
private AgentOptions
prepareAgentOptions()
void
setAddress(java.lang.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(java.io.File dir)
Sets the directory where all class files seen by the agent should be dumped to.void
setDestfile(java.io.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(java.lang.String exclClassLoader)
List of wildcard patterns for classloaders that JaCoCo will not instrument classes from.void
setExcludes(java.lang.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(java.lang.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
setOutput(java.lang.String output)
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(java.lang.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
-
-
-
-
Field Detail
-
agentOptions
private final AgentOptions agentOptions
-
destfile
private java.io.File destfile
-
enabled
private boolean enabled
-
-
Method Detail
-
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
public void setDestfile(java.io.File file)
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
public void setIncludes(java.lang.String includes)
List of wildcard patterns classes to include for instrumentation. Default is*
- Parameters:
includes
- Wildcard pattern of included classes
-
setExcludes
public void setExcludes(java.lang.String excludes)
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
public void setExclClassLoader(java.lang.String exclClassLoader)
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
public void setSessionId(java.lang.String id)
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
public void setOutput(java.lang.String output)
Sets the output method. Default isfile
- Parameters:
output
- Output method
-
setAddress
public void setAddress(java.lang.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. 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
public void setClassdumpdir(java.io.File dir)
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
protected java.lang.String 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
private AgentOptions prepareAgentOptions()
-
getAgentFile
private java.io.File getAgentFile()
-
-