Aggregating multiproject testReport with some test disabled

Hi!

I want to aggregate the testreports on my multiproject build. I have a project structure where I have disabled some tests. I have already looked at the gradle sample code, which works fine with default settings, but as soon as I disable the test task on a subproject it stops working. (It looks for the testresult/*.bin file which is obviously not there…)

My project layout looks like this:

root
  +--- ProjectA
 |
  \--- ProjectA.gradle
 +--- ProjectB
 |
  \--- ProjectB.gradle
 \--- build.gradle

ProjectA.gradle looks like this:

test {
   enabled = false
}

The rootprojects build.gradle has the testReport task.

As I said before the task fails on ProjectA. I tried to modify the sample code like this:

task testReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/allTests")
    reportOn subprojects*.test.findAll { test ->
        test.getEnabled()
    }
}

Still not works because test.enabled is true when the task configures.

How can I make this task work?

(Maybe TestReport should look the existence of the testReport output file?)