From 2e7891cc29c497105ac3d40cfd370dabf3a2d9fe Mon Sep 17 00:00:00 2001 From: Aziz Utku Kagitci Date: Wed, 8 Nov 2023 12:43:08 +0300 Subject: [PATCH] Add validation for missing JaCoCo test report tasks --- .../JacocoAggregateCoveragePlugin.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jacocoaggregatecoverageplugin/src/main/kotlin/com/azizutku/jacocoaggregatecoverageplugin/JacocoAggregateCoveragePlugin.kt b/jacocoaggregatecoverageplugin/src/main/kotlin/com/azizutku/jacocoaggregatecoverageplugin/JacocoAggregateCoveragePlugin.kt index 111d775..6e5fddf 100644 --- a/jacocoaggregatecoverageplugin/src/main/kotlin/com/azizutku/jacocoaggregatecoverageplugin/JacocoAggregateCoveragePlugin.kt +++ b/jacocoaggregatecoverageplugin/src/main/kotlin/com/azizutku/jacocoaggregatecoverageplugin/JacocoAggregateCoveragePlugin.kt @@ -70,6 +70,17 @@ internal class JacocoAggregateCoveragePlugin : Plugin { project.layout.buildDirectory.dir(PLUGIN_OUTPUT_PATH) ) val jacocoTestReportTasks = getJacocoTestReportTasks(project, pluginExtension) + if (jacocoTestReportTasks.isEmpty()) { + val jacocoTestReportTask = pluginExtension.jacocoTestReportTask.get() + project.logger.error( + """ + There are no tasks named '$jacocoTestReportTask' in your project. Please + ensure that you set the `jacocoTestReportTask` property in the plugin + extension to the name of the task you use to generate JaCoCo test reports. + """.trimIndent() + ) + return@configure + } copyReportsTaskProvider.get().mustRunAfter(jacocoTestReportTasks) dependsOn(copyReportsTaskProvider) dependsOn(jacocoTestReportTasks)