kt3k / coveralls-gradle-plugin

👨‍🔧 gradle plugin for coveralls
https://plugins.gradle.org/plugin/com.github.kt3k.coveralls
MIT License
253 stars 54 forks source link

Multi-module project and no source file found #13

Closed igr closed 10 years ago

igr commented 10 years ago

Hi there, I have multi-module project. Each modules test is covered by JaCoCo, but I am still using an ant task, since gradle plugin is not doing all for me. Anyway, each module creates a 'exec' binary file (with stored coverage data); and no report is generated for modules. Instead, single, aggregated report is generated for whole project, based on all input modules execution result. This way single jacoco XML file is generated.

However, when I start your plugins task, it does not find the sources. I think it is because of this (from JacocoSourceReportFactory)

    project.plugins.withType(JavaPlugin) {
        targetSrcDirs += project.sourceSets.main.java.srcDirs
    }

Here we do collect projets source dirs, and I need source dirs of all modules.

Since I already have a collection of source dirs of my modules, the simples fix would be to add an optional flag, so I can override default behavior and simply provide my source sets.

Would this make sense?

kt3k commented 10 years ago

Hi, @igorspasic,

Thanks for reporting the issue.

OK. I think I understand the situation and the solution you suggests seems correct. So I will create the version in a few days in which you can override srcDirs to search with.

Thanks,

igr commented 10 years ago

Thank you. There is another problem with multi-modules: the generated XML file contains another tag, group that wraps each module, so you need to do something like this:

report.group.each { grp ->
    grp.package.each { pkg ->
...

instead of just iterating report.package.

kt3k commented 10 years ago

hmm... that seems a little bit problematic.

Can you show me an example repository and an example xml for the above situation?

igr commented 10 years ago

yeah, you can play with https://github.com/oblac/jodd although it is not small. an example xml is too big for this (eg 4+Mb); but you can build smaller example. At the end I had to do all manually, with few methods from your code, thank you!

kt3k commented 10 years ago

Thank you! I'll try it.

kt3k commented 10 years ago

I'm so sorry for being toooooooo late to reply. (Recently I only have very short time to work on my own project.)

I think I've done the first part:

the simples fix would be to add an optional flag, so I can override default behavior and simply provide my source sets.

and I'm trying to solve the second part:

There is another problem with multi-modules: the generated XML file contains another tag, group

It may take some more time. please wait...

igr commented 10 years ago

No problem, take your time. I have a work-around, so its not hurry ;)

kt3k commented 10 years ago

Hi, @igorspasic

I think I've finished the multi-project support for jacoco reports (with v0.6.0 release).

So could you check it in your repository when you have time?

My attempt in my fork is as follows:

change travis-build coveralls

(In it, I've skipped some of the projects because I don't find out how to pass them.)

Thanks,

igr commented 10 years ago

sure, but when I return from a trip, have a limited resources here :)

kt3k commented 10 years ago

it's ok, of course. I'm not in a hurry :)