Skip to content

Commit 2e7891c

Browse files
committed
Add validation for missing JaCoCo test report tasks
1 parent ca927df commit 2e7891c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

jacocoaggregatecoverageplugin/src/main/kotlin/com/azizutku/jacocoaggregatecoverageplugin/JacocoAggregateCoveragePlugin.kt

+11
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ internal class JacocoAggregateCoveragePlugin : Plugin<Project> {
7070
project.layout.buildDirectory.dir(PLUGIN_OUTPUT_PATH)
7171
)
7272
val jacocoTestReportTasks = getJacocoTestReportTasks(project, pluginExtension)
73+
if (jacocoTestReportTasks.isEmpty()) {
74+
val jacocoTestReportTask = pluginExtension.jacocoTestReportTask.get()
75+
project.logger.error(
76+
"""
77+
There are no tasks named '$jacocoTestReportTask' in your project. Please
78+
ensure that you set the `jacocoTestReportTask` property in the plugin
79+
extension to the name of the task you use to generate JaCoCo test reports.
80+
""".trimIndent()
81+
)
82+
return@configure
83+
}
7384
copyReportsTaskProvider.get().mustRunAfter(jacocoTestReportTasks)
7485
dependsOn(copyReportsTaskProvider)
7586
dependsOn(jacocoTestReportTasks)

0 commit comments

Comments
 (0)