Class 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 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 
      Modifier Constructor Description
      protected AbstractCoverageTask()
      Create default agent options
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getLaunchingArgument()
      Creates JVM argument to launch with the specified JaCoCo agent jar and the current options
      boolean isEnabled()  
      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 enabled
      void 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
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractCoverageTask

        protected AbstractCoverageTask()
        Create default agent options
    • 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 is jacoco.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 is true
        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 is sun.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 is true
        Parameters:
        dumpOnExit - true to write coverage data on VM termination
      • setOutput

        public void setOutput​(java.lang.String output)
        Sets the output method. Default is file
        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 is localhost
        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 is 6300
        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