@@ -6,6 +6,7 @@ import org.gradle.api.Project
6
6
import org.gradle.api.Task
7
7
import org.gradle.api.invocation.Gradle
8
8
import org.gradle.api.plugins.PluginAware
9
+ import org.gradle.api.plugins.scala.ScalaPlugin
9
10
import org.gradle.api.tasks.SourceSet
10
11
import org.gradle.api.tasks.scala.ScalaCompile
11
12
import org.gradle.api.tasks.testing.Test
@@ -281,14 +282,23 @@ class ScoveragePlugin implements Plugin<PluginAware> {
281
282
}
282
283
283
284
// define aggregation task
284
- if (project. childProjects . size() > 0 ) {
285
+ if (! project. subprojects . empty ) {
285
286
project. gradle. projectsEvaluated {
286
- def allReportTasks = project. getAllprojects(). findResults {
287
+ project. subprojects. each {
288
+ if (it. plugins. hasPlugin(ScalaPlugin ) && ! it. plugins. hasPlugin(ScoveragePlugin )) {
289
+ it. logger. warn(" Scala sub-project '${ it.name} ' doesn't have Scoverage applied and will be ignored in parent project aggregation" )
290
+ }
291
+ }
292
+ def childReportTasks = project. subprojects. findResults {
287
293
it. tasks. find { task ->
288
294
task. name == REPORT_NAME && task instanceof ScoverageAggregate
289
295
}
290
296
}
297
+ def allReportTasks = childReportTasks + globalReportTask
291
298
def aggregationTask = project. tasks. create(AGGREGATE_NAME , ScoverageAggregate ) {
299
+ onlyIf {
300
+ ! childReportTasks. empty
301
+ }
292
302
dependsOn(allReportTasks)
293
303
group = ' verification'
294
304
runner = scoverageRunner
0 commit comments