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

Allow filtering/choosing which variants are aggregated in a root report #599

Open
gmazzo opened this issue Apr 18, 2024 · 2 comments
Open
Assignees
Labels
Feature Feature request issue type S: in progress Status: implementing or design in process

Comments

@gmazzo
Copy link

gmazzo commented Apr 18, 2024

What is your use-case and why do you need this feature?
Since 0.8.0-Beta2, Kover successfully aggregates Android modules.

Given the following setup at the root project:

dependencies {
    kover(":app")
    kover(":lib-android")
    kover(":lib-jvm")
}

Will produce correctly an aggregated report, taking main variant on JVM modules, and all variants (usually debug and release) on Android ones.

However, this is a problem (at least for us) in large-scale projects, with either complex variants (by using productFlavors for instance) or a large number of modules, as it will cause tall tests to run (testDebug and testRelease for instance), increasing the overall CI time exponentially.

We'd like to have granular control on which variants are aggregated.
image
https://scans.gradle.com/s/2nb3nedv4ntsm/timeline?details=txc6dqjkewdsm&expanded=WyIwLjEiXQ&show=predecessors

Describe the solution you'd like
Having some kind of DSL to choose which variants are aggregated.

With the current DSL approach (which I'll probably suggest improvements in another ticket) it would be something like this:

// app's build.gradle.kts
kover.currentProject {
    providedVariant("release") {
        aggregate = false
    }
}
@gmazzo gmazzo added Feature Feature request issue type S: untriaged Status: issue reported but unprocessed labels Apr 18, 2024
@shanshin shanshin added S: in progress Status: implementing or design in process and removed S: untriaged Status: issue reported but unprocessed labels Apr 23, 2024
@shanshin
Copy link
Collaborator

shanshin commented May 6, 2024

Sorry for delayed answer.

This is a shortcoming of the current documentation: it is not recommended to use the total reports for Android projects.
It is for this purpose that custom options are designed.

The expected usage algorithm is as follows:

  • a custom variant with the same name is created in all measured projects (eg main)
  • in each project, only those Android build variants that should be included in the merged report are added
kover {
   currentProject {
       createVariant("main") {
           add("debug") // or add("jvm") in JVM-only subproject
       }
   }
}
  • choose the merging project, and add kover dependencies to all measured projects (in case of root project)
dependencies {
    kover(":app")
    kover(":lib-android")
    kover(":lib-jvm")
}
  • use task :koverHtmlReportMain to generate HTML report

Custom variants allow to create different report slices by adding a variety of project sets and Android build variants to them - this way you can create different reports for different needs without changing of buildscripts

@shanshin
Copy link
Collaborator

shanshin commented May 6, 2024

kover.currentProject {
    providedVariant("release") {
        aggregate = false
    }
}

this approach is less flexible, it does not involve the simultaneous creation of alternative combinations of Android build variants for reports, however, as well as custom variant, it requires changes in each Android subproject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature request issue type S: in progress Status: implementing or design in process
Projects
None yet
Development

No branches or pull requests

2 participants