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

Fixed Stream closed error when generating Kover HTML report #540

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

shanshin
Copy link
Collaborator

When generating an HTML report, errors sometimes occur when reading the freemarker template from resources. The exact cause of the error has not yet been determined (relates to the Gradle isolated class loaders), but it disappears when you try to read again. In some cases, it is necessary to increase the number of repetitions, so this setting was made in Kover Gradle plugin.

Fixes #510

When generating an HTML report, errors sometimes occur when reading the freemarker template from resources. The exact cause of the error has not yet been determined (relates to the Gradle isolated class loaders), but it disappears when you try to read again.
In some cases, it is necessary to increase the number of repetitions, so this setting was made in Kover Gradle plugin.

Fixes #510
@Option(name = "--title", usage = "title in the HTML report", metaVar = "<html-title>")
private var htmlTitle: String? = null
@Option(name = "--title", usage = "title in the HTML or XML report", metaVar = "<title>")
private var title: String? = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change related to the fix in any way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these changes, a compilation error occurs :)

@@ -69,6 +70,10 @@ internal abstract class HtmlReportAction : AbstractReportAction<HtmlReportParame
val files = parameters.files.get()
val filters = parameters.filters.get()

// repeat reading freemarker temple from resources if error occurred, see https://github.com/Kotlin/kotlinx-kover/issues/510
// the values are selected empirically so that the maximum report generation time is not much more than a second
ReportApi.setFreemarkerRetry(7, 150)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to keep the issue open and eventually add a proper fix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If, after this fix, the error will still be reproduced, then it will be necessary to understand more deeply

@shanshin shanshin merged commit 1d6f64a into main Feb 15, 2024
1 check passed
@shanshin shanshin deleted the report-repeat branch February 15, 2024 15:16
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 this pull request may close these issues.

Kover generates error stacktrace in HTML report file
2 participants