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

How to generate a merge report? #707

Closed
bsarias opened this issue Nov 21, 2024 · 6 comments
Closed

How to generate a merge report? #707

bsarias opened this issue Nov 21, 2024 · 6 comments
Assignees
Labels
Question Support request issue type S: waiting for clarification Status: additional information required to proceed

Comments

@bsarias
Copy link

bsarias commented Nov 21, 2024

I have an Android project with several modules but I'm facing an issue, when I execute kover all modules that include generate the report (that's ok) but I want to know if there is a way to generate a merged report of all my modules

this is my current kover config (it is in the root build.gradle.kts)

tasks.register("koverXmlReportDebug") {
    // Configure the report file
    kover {
        currentProject {
            createVariant("custom") {
                add("debug")
            }
        }
        reports {
            filters {
                includes {
                    packages("...")
                    projects = listOf(...)
                }
                excludes {
                    androidGeneratedClasses()
                    // exclusion rules - classes to exclude from report
                   ...
                }
            }
        }
    }
}
@bsarias bsarias added Question Support request issue type S: untriaged Status: issue reported but unprocessed labels Nov 21, 2024
@bsarias
Copy link
Author

bsarias commented Nov 22, 2024

I found part of the issue, if i execute koverXmlReportDebug generates each report per module but not a general module, but if I execute koverXmlReport it does execute the general report but it executes all debug and release tasks but I need just one of them (debug or release) which config can I apply to generate a report but executing just one type of task debug or release, either way it will take double of the time

@shanshin
Copy link
Collaborator

Hi,
generating merged reports for Android projects requires additional configuration, have you reffered the documentation in the relevant section?

@shanshin shanshin added S: waiting for clarification Status: additional information required to proceed and removed S: untriaged Status: issue reported but unprocessed labels Nov 22, 2024
@bsarias
Copy link
Author

bsarias commented Nov 22, 2024

Yes I do, this is my current configuration and still not working:

in the root build gradle:

plugins {
    alias(libs.plugins.kover)
}

dependencies {
    kover(projects.moduleA)
    kover(projects.moduleB)
    kover(projects.moduleC)
    kover(projects.moduleDl)
}

kover {
    reports {
        filters {
            includes {
                packages("com.myapp")
            }
            excludes {
                androidGeneratedClasses()
                // exclusion rules - classes to exclude from report
                packages(
                   ...
                )
                files(
                  ...
                )
                annotatedBy(
                   ...
                )
                classes(
                   ...
                )
            }
        }
    }
}

And in each module I have applied the alias(libs.plugins.kover)

Do I need another special configuration to generate the merged report?

@bsarias
Copy link
Author

bsarias commented Nov 22, 2024

Just to clarify, koverXmlReport works but executes both release and debug unit tests and tasks, which takes the double of time, but I if run koverXmlReportDebug the general report is not generated, only a report per module

@shanshin
Copy link
Collaborator

Pay attention to the section Create custom Report Variants.
You should add

kover {
    currentProject {
        createVariant("custom") {
            add("debug", optional = true)
        }
    }
}

in each module where Kover plugin is applied (including root project).

After that, the :koverXmlReportCustom task must be completed to generate the report.
Important! It is mandatory to specify a colon at the beginning (running task in root project). if the koverXmlReportCustom task is running, it generates individual reports on modules

@bsarias
Copy link
Author

bsarias commented Nov 22, 2024

It worked with the createVariant configuration, thanks!

@bsarias bsarias closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Support request issue type S: waiting for clarification Status: additional information required to proceed
Projects
None yet
Development

No branches or pull requests

2 participants