vanniktech/gradle-android-junit-jacoco-plugin

Coverage doesn't work when flag missing

chris-feist opened this issue · 5 comments

When using newer versions of jacoco, such as 0.7.6.201602180812, the coverage report show's no coverage unless the includeNoLocationClasses flag is set to true, see snippet below. If this library can be updated to automatically specify it for jacoco versions > 0.7.2, then you can probably remove defining it to 0.7.2.201409121644 in JunitJacocoExtension and use the default in gradle.

android {
    testOptions {
        unitTests.all {
            jacoco {
                includeNoLocationClasses = true
            }
        }
    }
}

See related bugs:
robolectric/robolectric#2230
jacoco/jacoco#288

The includeNoLocationClasses could also live in the extension from this plugin right? So regardless of the version you can set it manually as a consumer

Yes, that is true. I guess this would more be a feature request. It would be nice if it was automatic, then you could remove the hard coded legacy jacoco version, and use the default version provided by gradle. Unless someone explicitly changes the version of course.

I'd prefer to be able to configure it yourself and not do any magic internally. Mind opening a PR for an extension for includeNoLocationClasses?

No problem. I can look into it 👍

There's now a new extension entry point for this one. Thanks