org.neotech.plugin.rootcoverage.CustomJacocoReportTask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-root-coverage-plugin Show documentation
Show all versions of android-root-coverage-plugin Show documentation
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
}
}