Other places like This Other Question will have a jacocoTestReport task that depends on testDebug. Which works.
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
...
}
However, in my case, I need to also depend on the android tasks compileDebugSources and compileDebugTestSources in addition to the testDebug. So I was hoping that the following would work
task jacocoTestReport(type: JacocoReport, dependsOn: ["compileDebugSources", "compileDebugTestSources", "testDebug"]) {
...
}
However, when I use the dependsOn property or method, the order of these dependencies aren't guaranteed as stated by Gradle. So I wanted to do something like the following outside of the task
testDebug.mustRunAfter compileDebugSources
testDebug.mustRunAfter compileDebugTestSources
but I get a compilation problem with the above is that testDebug or compileDebugSources or compileDebugTestSources gets marked as being "Could not find property 'testDebug/compileDebugSources/compileDebugTestSources'" on project :app
I'm wondering what I need to do in order to add the order of these tasks for my existing jacocoTestReport task in gradle.