Class JacocoPluginExtension


  • @Incubating
    public class JacocoPluginExtension
    extends Object
    Extension including common properties and methods for Jacoco.
    • Constructor Detail

      • JacocoPluginExtension

        public JacocoPluginExtension​(Project project,
                                     org.gradle.internal.jacoco.JacocoAgentJar agent)
        Creates a Jacoco plugin extension.
        Parameters:
        project - the project the extension is attached to
        agent - the agent JAR to be used by Jacoco
    • Method Detail

      • getToolVersion

        public String getToolVersion()
        Version of Jacoco JARs to use.
      • setToolVersion

        public void setToolVersion​(String toolVersion)
      • getReportsDir

        public File getReportsDir()
        The directory where reports will be generated.
      • setReportsDir

        public void setReportsDir​(Provider<File> reportsDir)
        Set the provider for calculating the report directory.
        Parameters:
        reportsDir - Reports directory provider
        Since:
        4.0
      • setReportsDir

        public void setReportsDir​(File reportsDir)
      • applyTo

        public <T extends Task & JavaForkOptions> void applyTo​(T task)
        Applies Jacoco to the given task. Configuration options will be provided on a task extension named 'jacoco'. Jacoco will be run as an agent during the execution of the task.
        Parameters:
        task - the task to apply Jacoco to.
        See Also:
        TASK_EXTENSION_NAME
      • applyTo

        public <T extends Task & JavaForkOptions> void applyTo​(TaskCollection<T> tasks)
        Applies Jacoco to all of the given tasks.
        Parameters:
        tasks - the tasks to apply Jacoco to