NeoTech-Software/Android-Root-Coverage-Plugin

Module specific report not generating report in build/report

AliAzaz opened this issue · 9 comments

While running the plugin for specific module report:

gradle :yourModule:coverageReport

the report folder is not generating on this path /build/reports/, however, it is generating in yourModule/build/reports/.

@AliAzaz this is by design.

it is considered good practice that module specific Gradle tasks use the module specific build/output folder for artifacts (compiled resources, class files, execution data etc.) that are generated.

Is there a reason why you would want a module specific task to output data in a non-module specific root folder instead?

Basically I have more then one app module in a project and have many library module and I'm using sonar to pull this report and show it on my sonar cloud dashboard. That is why I want to build specific app module that can also includes all library modules in it to generate a report.

I think what you are looking for is one aggregated report for all your modules at once?

In that case it may make more sense to just use :rootCodeCoverage task, which creates a combined report for all your modules (in /build/reports/).

If you do require separated reports per module, then you will have to tell Sonar Cloud about them individually (using a pattern potentially, since xmlReportPaths supports wildcards).

xmlReportPaths=*/build/reports/someXmlFile.xml

Any way to create report for specific app module? Because the solution you defined above can create all modules report including multiple app modules.

Any way to create report for specific app module? Because the solution you defined above can create all modules report including multiple app modules.

Yes, you already did this:

':yourModule:coverageReport'

This is all outlined in the README.md (section 2).

Ok let me clarify it again:
Suppose I have a project that contains two app modules called App-01 & App-02 and also has a few library modules like Lib-01, Lib-02, & Lib-03. Now, I need to create a report coverage for App-01 so all of the library modules also have to be included in this report coverage.

Ah that is a clearer picture.

Unfortunately a scenario like this is currently not supported, it is either coverage separate per module, or your whole project combined.

To support a scenario like this would require the plugin to figure out dependencies on it's own and generate reports for each module and it's dependencies. Maybe something I can work on in the future.

That's great. Please do work on it and update or I will try to add this and create PR.

Currently, I am using this to tackle my issue:

task runMainAppGradleCoverageReport(
        dependsOn:
                [
                        ':core:coverageReport', ':storage:coverageReport', ':app:coverageReport'
                ]
) {

    description 'Running coverage report for App module'
}


task runMainApp02GradleCoverageReport(
        dependsOn:
                [
                        ':core:coverageReport', ':storage:coverageReport', ':app-02:coverageReport'
                ]
) {

    description 'Running coverage report for App-02 module'
}

and run command:

gradle runMainAppGradleCoverageReport

And

gradle runMainApp02GradleCoverageReport