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

Module specific report not generating report in build/report #103

Open
AliAzaz opened this issue May 2, 2024 · 9 comments
Open

Module specific report not generating report in build/report #103

AliAzaz opened this issue May 2, 2024 · 9 comments

Comments

@AliAzaz
Copy link

AliAzaz commented May 2, 2024

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 AliAzaz changed the title Module specific report not generating report in build/gralde Module specific report not generating report in build/report May 2, 2024
@Rolf-Smit
Copy link
Contributor

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

@AliAzaz
Copy link
Author

AliAzaz commented May 2, 2024

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.

@Rolf-Smit
Copy link
Contributor

Rolf-Smit commented May 2, 2024

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

@AliAzaz
Copy link
Author

AliAzaz commented May 2, 2024

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

@Rolf-Smit
Copy link
Contributor

Rolf-Smit commented May 2, 2024

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

@AliAzaz
Copy link
Author

AliAzaz commented May 3, 2024

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.

@Rolf-Smit
Copy link
Contributor

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.

@AliAzaz
Copy link
Author

AliAzaz commented May 6, 2024

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

@AliAzaz
Copy link
Author

AliAzaz commented May 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants