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

net.twisterrob.gradle.quality.gather.TaskReportGatherer.kt Maven / Gradle / Ivy

The newest version!
package net.twisterrob.gradle.quality.gather

import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskCollection
import se.bjurr.violations.lib.model.Violation
import java.io.File

abstract class TaskReportGatherer(
	private val taskType: Class
) where T : Task {

	abstract fun getParsableReportLocation(task: T): File

	abstract fun getHumanReportLocation(task: T): File

	abstract fun getName(task: T): String

	abstract fun getDisplayName(task: T): String

	fun getViolations(task: T): List? {
		val report = getParsableReportLocation(task)
		return if (report.exists()) {
			findViolations(report)
		} else {
			//println("${this} > report '${report}' does not exist.")
			null
		}
	}

	abstract fun findViolations(report: File): List

	open fun allTasksFrom(project: Project): TaskCollection =
		project.tasks.withType(taskType)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy