All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.neotech.plugin.rootcoverage.CustomJacocoReportTask.kt Maven / Gradle / Ivy

Go to download

A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.

The newest version!
package org.neotech.plugin.rootcoverage

import org.gradle.api.file.ConfigurableFileTree
import org.gradle.api.file.Directory
import org.gradle.api.file.FileTree
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.util.PatternSet
import org.gradle.testing.jacoco.tasks.JacocoReport
import org.neotech.plugin.rootcoverage.utilities.fileTree

abstract class CustomJacocoReportTask : JacocoReport() {

    @get:InputFiles
    abstract val allJars: ListProperty

    @get:Input
    abstract val excludePatterns: ListProperty

    fun allDirectories(): ListProperty {
        val files = project.objects.listProperty(Directory::class.java)

        val filteredFiles: Provider> = files.map {
            val patternSet = PatternSet()
            patternSet.exclude(excludePatterns.get())
            it.map { directory ->
                directory.asFileTree.matching(patternSet)
            }
        }
        classDirectories.from(filteredFiles)
        return files
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy