Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Jacoco configuration ignores sourcesets of buildFlavors #682

Open
3 tasks done
saihemanth121 opened this issue Apr 25, 2023 · 2 comments
Open
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@saihemanth121
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is there a StackOverflow question about this issue?

  • I have searched StackOverflow

What happened?

The sourceDirectories configuration in Jacoco.kt seems to be simply setting it from main sourceset and ignores other flavors: sourceDirectories.setFrom(files("$projectDir/src/main/java", "$projectDir/src/main/kotlin"))

Instead I think it should be including all sources of the current variant. This can be done in groovy by variant.sourceSets.java.srcDirs.collect { it.path }.flatten() but I'm not sure how this can be done in Kotlin which is using a different variant class. I came across this trying to migrate my own project scripts from groovy to kotlin, so any help is appreciated!

Relevant logcat output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@saihemanth121 saihemanth121 added the bug Something isn't working label Apr 25, 2023
@alexvanyo alexvanyo self-assigned this Apr 25, 2023
@zameelpichen
Copy link

try this gradle plugin for jacoco. very easy to use.

https://github.com/gmazzo/gradle-android-test-aggregation-plugin

@alexvanyo what do you think about the plugin? any limitations to it compared to what we have here?

@alexvanyo
Copy link
Contributor

I think there's two parts here:

  • For fixing the initial issue of this bug, we should be able to rely on the built-in Jacoco setup provided by the Android Gradle Plugin. When initially set up in this project I think it had some issues, but now it should be working properly.

  • For creating a single merged report across all modules we don't have any solution at the moment, where an external plugin might be useful.

So to solve this issue, we likely shouldn't need to add an external plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@alexvanyo @zameelpichen @saihemanth121 and others