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

koverXmlReport task is not launched with check task when both verify and koverXmlReport are onCheck.set(true) #209

Closed
AleksDanil opened this issue Aug 17, 2022 · 3 comments · Fixed by #216

Comments

@AleksDanil
Copy link

Simple project is configured like this:

plugins {
    kotlin("jvm") version "1.7.10"
    id("org.jetbrains.kotlinx.kover") version "0.6.0-Beta"
}

kover {
    xmlReport {
        onCheck.set(true)
    }

        verify {
            onCheck.set(true)
            rule { 
                isEnabled = true 
                name = null 
                target =
                    kotlinx.kover.api.VerificationTarget.ALL

                bound {
                    minValue = 10
                    maxValue = 20
                    counter =
                        kotlinx.kover.api.CounterType.LINE
                    valueType =
                        kotlinx.kover.api.VerificationValueType.COVERED_PERCENTAGE 
                }
            }
        }
    }
}

Run check task. koverXmlReport task is not launched, xml report is not generated.
With onCheck.set(false) for verify task is launched and report is generated.

No such issue for htmlReport. Also could not reproduce on 0.5.1 with similar setup.

@shanshin
Copy link
Collaborator

Hi,
I was unable to reproduce the problem locally, do you have a full reproducer project?
It was also useful to find out exactly what commands and in what sequence you run.

@AleksDanil
Copy link
Author

It seems that it happens only when verify task fails, if it succeeds then xml report is created.
Also attaching the project
beta-try.zip

@shanshin
Copy link
Collaborator

This is because report generation is performed in a different task than verification.

In some cases, Gradle can execute koverXmlReport after koverVerify, so if there is an error in koverVerify, the build stops and the report is not generated.

If it is necessary that the report is still generated, even if verification does not pass, you must explicitly add ordering:

tasks.withType<KoverVerificationTask> {
    shouldRunAfter(tasks.withType<KoverXmlTask>())
    shouldRunAfter(tasks.withType<KoverHtmlTask>())
}

This is not implemented in the plugin because there is no certainty that someone will need a report for an unverified project, if they need it, then you can explicitly call the task koverXmlReport.

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

Successfully merging a pull request may close this issue.

2 participants