JacocoTaskExtension (Gradle API 2.14.1)

org.gradle.testing.jacoco.plugins

## Class JacocoTaskExtension

- java.lang.Object
- - groovy.lang.GroovyObjectSupport
  - - org.gradle.testing.jacoco.plugins.JacocoTaskExtension

- All Implemented Interfaces:
    GroovyObject

      @Incubating
      public class JacocoTaskExtension
      extends GroovyObjectSupport

  Extension for tasks that should run with a Jacoco agent to generate coverage execution data.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JacocoTaskExtension.Output` The types of output that the agent can use for execution data.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JacocoTaskExtension(org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task)` Creates a Jacoco task extension.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAddress()` IP address or hostname to use with `JacocoTaskExtension.Output.TCP_SERVER` or `JacocoTaskExtension.Output.TCP_CLIENT`.
    `org.gradle.internal.jacoco.JacocoAgentJar` | `getAgent()` Deprecated. Agent should be considered final.
    `boolean` | `getAppend()` Whether or not data should be appended if the `destinationFile` already exists.
    `String` | `getAsJvmArg()` Gets all properties in the format expected of the agent JVM argument.
    `File` | `getClassDumpFile()` Path to dump all class files the agent sees are dumped to.
    `File` | `getDestinationFile()` The path for the execution data to be written to.
    `boolean` | `getDumpOnExit()` Whether or not to dump the coverage data at VM shutdown.
    `boolean` | `getEnabled()` Whether or not the task should generate execution data.
    `List<String>` | `getExcludeClassLoaders()` List of classloader names that should be excluded from analysis.
    `List<String>` | `getExcludes()` List of class names that should be excluded from analysis.
    `boolean` | `getIncludeNoLocationClasses()` Whether or not classes without source location should be instrumented.
    `List<String>` | `getIncludes()` List of class names that should be included in analysis.
    `boolean` | `getJmx()` Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`.
    `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`.
    `String` | `getSessionId()` An identifier for the session written to the execution data.
    `boolean` | `isAppend()`
    `boolean` | `isDumpOnExit()`
    `boolean` | `isEnabled()`
    `boolean` | `isIncludeNoLocationClasses()`
    `boolean` | `isJmx()`
    `void` | `setAddress(String address)`
    `void` | `setAgent(org.gradle.internal.jacoco.JacocoAgentJar agent)` Deprecated. Agent should be considered final.
    `void` | `setAppend(boolean append)`
    `void` | `setClassDumpFile(File classDumpFile)`
    `void` | `setDestinationFile(File destinationFile)`
    `void` | `setDumpOnExit(boolean dumpOnExit)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setExcludeClassLoaders(List<String> excludeClassLoaders)`
    `void` | `setExcludes(List<String> excludes)`
    `void` | `setIncludeNoLocationClasses(boolean includeNoLocationClasses)`
    `void` | `setIncludes(List<String> includes)`
    `void` | `setJmx(boolean jmx)`
    `void` | `setOutput(JacocoTaskExtension.Output output)`
    `void` | `setPort(int port)`
    `void` | `setSessionId(String sessionId)`

    - ### Methods inherited from class groovy.lang.GroovyObjectSupport

      `getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JacocoTaskExtension

          public JacocoTaskExtension(org.gradle.internal.jacoco.JacocoAgentJar agent,
                             JavaForkOptions task)

      Creates a Jacoco task extension.
      Parameters:
        `agent` - the agent JAR to use for analysis
        `task` - the task we extend

  - ### Method Detail

    - #### isEnabled

          public boolean isEnabled()

    - #### getEnabled

          public boolean getEnabled()

      Whether or not the task should generate execution data. Defaults to `true`.

    - #### setEnabled

          public void setEnabled(boolean enabled)

    - #### getDestinationFile

          public File getDestinationFile()

      The path for the execution data to be written to.

    - #### setDestinationFile

          public void setDestinationFile(File destinationFile)

    - #### isAppend

          public boolean isAppend()

    - #### getAppend

          public boolean getAppend()

      Whether or not data should be appended if the `destinationFile` already exists. Defaults to `true`.

    - #### setAppend

          public void setAppend(boolean append)

    - #### getIncludes

          public List<String> getIncludes()

      List 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

          public void setIncludes(List<String> includes)

    - #### getExcludes

          public List<String> getExcludes()

      List of class names that should be excluded from analysis. Names can use wildcard (* and ?). Defaults to an empty list.

    - #### setExcludes

          public void setExcludes(List<String> excludes)

    - #### getExcludeClassLoaders

          public List<String> getExcludeClassLoaders()

      List of classloader names that should be excluded from analysis. Names can use wildcards (* and ?). Defaults to an empty list.

    - #### setExcludeClassLoaders

          public void setExcludeClassLoaders(List<String> excludeClassLoaders)

    - #### isIncludeNoLocationClasses

          public boolean isIncludeNoLocationClasses()

    - #### getIncludeNoLocationClasses

          public boolean getIncludeNoLocationClasses()

      Whether or not classes without source location should be instrumented. Defaults to `false`. This property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.7.6)

    - #### setIncludeNoLocationClasses

          public void setIncludeNoLocationClasses(boolean includeNoLocationClasses)

    - #### getSessionId

          public String getSessionId()

      An identifier for the session written to the execution data. Defaults to an auto-generated identifier.

    - #### setSessionId

          public void setSessionId(String sessionId)

    - #### isDumpOnExit

          public boolean isDumpOnExit()

    - #### getDumpOnExit

          public boolean getDumpOnExit()

      Whether or not to dump the coverage data at VM shutdown. Defaults to `true`.

    - #### setDumpOnExit

          public void setDumpOnExit(boolean dumpOnExit)

    - #### getOutput

          public JacocoTaskExtension.Output getOutput()

      The type of output to generate. Defaults to `JacocoTaskExtension.Output.FILE`.

    - #### setOutput

          public void setOutput(JacocoTaskExtension.Output output)

    - #### getAddress

          public String getAddress()

      IP address or hostname to use with `JacocoTaskExtension.Output.TCP_SERVER` or `JacocoTaskExtension.Output.TCP_CLIENT`. Defaults to localhost.

    - #### setAddress

          public void setAddress(String address)

    - #### getPort

          public int getPort()

      Port to bind to for `JacocoTaskExtension.Output.TCP_SERVER` or `JacocoTaskExtension.Output.TCP_CLIENT`. Defaults to 6300.

    - #### setPort

          public void setPort(int port)

    - #### getClassDumpFile

          public File getClassDumpFile()

      Path to dump all class files the agent sees are dumped to. Defaults to no dumps.

    - #### setClassDumpFile

          public void setClassDumpFile(File classDumpFile)

    - #### isJmx

          public boolean isJmx()

    - #### getJmx

          public boolean getJmx()

      Whether or not to expose functionality via JMX under `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)

    - #### setJmx

          public void setJmx(boolean jmx)

    - #### getAgent

          @Deprecated
          public org.gradle.internal.jacoco.JacocoAgentJar getAgent()

      Deprecated. Agent should be considered final.
      agent

    - #### setAgent

          @Deprecated
          public void setAgent(org.gradle.internal.jacoco.JacocoAgentJar agent)

      Deprecated. Agent should be considered final.
      agent

    - #### getAsJvmArg

          public String getAsJvmArg()

      Gets all properties in the format expected of the agent JVM argument.
      Returns:
        state of extension in a JVM argument