Android-Root-Coverage-Plugin icon indicating copy to clipboard operation
Android-Root-Coverage-Plugin copied to clipboard

Module specific report not generating report in build/report

Open AliAzaz opened this issue 9 months ago • 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 avatar May 02 '24 14:05 AliAzaz

@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?

Rolf-Smit avatar May 02 '24 15:05 Rolf-Smit

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.

AliAzaz avatar May 02 '24 15:05 AliAzaz

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

Rolf-Smit avatar May 02 '24 15:05 Rolf-Smit

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

AliAzaz avatar May 02 '24 16:05 AliAzaz

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).

Rolf-Smit avatar May 02 '24 16:05 Rolf-Smit

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.

AliAzaz avatar May 03 '24 10:05 AliAzaz

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.

Rolf-Smit avatar May 05 '24 21:05 Rolf-Smit

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

AliAzaz avatar May 06 '24 07:05 AliAzaz

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

AliAzaz avatar May 06 '24 09:05 AliAzaz