stevesaliman / gradle-cobertura-plugin

Gradle Cobertura Plugin
118 stars 50 forks source link

Instrumentation ignores `coverageSourceDirs` option #159

Closed eyalroth closed 5 years ago

eyalroth commented 5 years ago

Usage says:

coverageSourceDirs = <set of directories>: Tells the plugin where to look for source files to instrument and include in reports. By default, the plugin will include project.sourceSets.main.java.srcDirs, project.sourceSets.main.groovy.srcDirs, and project.sourceSets.main.scala.srcDirs

However, only the coverageDirs option seems to affect which directories will be instrumented. Looking at InstrumentTask.groovy's code reflects this behavior quite clearly.

stevesaliman commented 5 years ago

I think the problem here may be my documentation skills :-)

There is a subtle difference between coverageDirs and coverageSourceDirs. Each one is used to satisfy a different need in Cobertura itself.

coverageDirs is a set of compiled classes that are given to Cobertura to instrument via the InstrumentTask.

coverageSourceDirs is set to the uncompiled Java (and groovy and scala) source files, which are given to Cobertura when it generates reports via the GenerateReportTask. Cobertura uses these files to produce the marked up HTML showing your source code and which lines were executed by your tests.

I've modified the usage.md file. Hopefully the change clarifies the difference between the two.