[
https://issues.apache.org/jira/browse/KAFKA-13922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17540157#comment-17540157
]
Patrik Nagy commented on KAFKA-13922:
-------------------------------------
There is a reportCoverage task in each module that runs jacoco or scoverage
report (scoverage for the core module and jacoco for any other). This works
well and needed for coverage generation.
There is also a reportCoverage task configured outside of subprojects scope
that depends on jacocoRootReport and the reportCoverage task of the core
module.
The jacocoRootReport depends on all java related project's test task.
I don't think this jacocoRootReport is needed in the project because:
* You can have the coverage data generated for all modules without it
* If you need something like a report to summarize everything that is what
sonar is much better for than an html/xml file
* I don't think jacoco aggregated report would include the core module's
scoverage report (I am sure it can be implemented with additional work, but I
am not sure it is worth instead of using simply a sonar), so even if the
aggregated report would work, it still would not be complete for the project,
core module would be missing
* It seems to me that Gradle advises to create another module for aggregated
reports that would be responsible to collect everything and generate the
report, not like the current one:
[https://docs.gradle.org/7.3.3/samples/sample_jvm_multi_project_with_code_coverage.html]
* I doubt that it is used by anyone because it is not working for a really
long time (tested in 2.5 and 3.2)
I think the jacocoRootReport should be considered to be deleted along with the
reportCoverage task outside of subprojects scope:
{code:java}
if (userEnableTestCoverage) {
task reportCoverage(dependsOn: ['jacocoRootReport', 'core:reportCoverage'])
} {code}
Without them, it would be easy to generate coverage for all modules as it is
documented.
> Unable to generate coverage reports for the whole project
> ---------------------------------------------------------
>
> Key: KAFKA-13922
> URL: https://issues.apache.org/jira/browse/KAFKA-13922
> Project: Kafka
> Issue Type: Bug
> Components: build
> Affects Versions: 2.5.0
> Reporter: Patrik Nagy
> Priority: Minor
>
> It is documented in the project that if we need code coverage reports for the
> whole project, we need to run something like this where we enabled the test
> coverage flag and run the reportCoverage task:
> {code:java}
> ./gradlew reportCoverage -PenableTestCoverage=true -Dorg.gradle.parallel=false
> {code}
> If I run it, the build will fail in the end because of jacocoRootReport:
> {code:java}
> 14:34:41 > Task :jacocoRootReport FAILED
> 14:34:41
> 14:34:41 FAILURE: Build failed with an exception.
> 14:34:41
> 14:34:41 * What went wrong:
> 14:34:41 Some problems were found with the configuration of task
> ':jacocoRootReport' (type 'JacocoReport').
> 14:34:41 - Type 'org.gradle.testing.jacoco.tasks.JacocoReport' property
> 'jacocoClasspath' doesn't have a configured value.
> 14:34:41
> 14:34:41 Reason: This property isn't marked as optional and no value has
> been configured.
> 14:34:41
> 14:34:41 Possible solutions:
> 14:34:41 1. Assign a value to 'jacocoClasspath'.
> 14:34:41 2. Mark property 'jacocoClasspath' as optional.
> 14:34:41
> 14:34:41 Please refer to
> https://docs.gradle.org/7.3.3/userguide/validation_problems.html#value_not_set
> for more details about this problem.
> 14:34:41 - Type 'org.gradle.testing.jacoco.tasks.JacocoReport' property
> 'reports.enabledReports.html.outputLocation' doesn't have a configured value.
> 14:34:41
> 14:34:41 Reason: This property isn't marked as optional and no value has
> been configured.
> 14:34:41
> 14:34:41 Possible solutions:
> 14:34:41 1. Assign a value to
> 'reports.enabledReports.html.outputLocation'.
> 14:34:41 2. Mark property 'reports.enabledReports.html.outputLocation'
> as optional.
> 14:34:41
> 14:34:41 Please refer to
> https://docs.gradle.org/7.3.3/userguide/validation_problems.html#value_not_set
> for more details about this problem.
> 14:34:41 - Type 'org.gradle.testing.jacoco.tasks.JacocoReport' property
> 'reports.enabledReports.xml.outputLocation' doesn't have a configured value.
> 14:34:41
> 14:34:41 Reason: This property isn't marked as optional and no value has
> been configured.
> 14:34:41
> 14:34:41 Possible solutions:
> 14:34:41 1. Assign a value to
> 'reports.enabledReports.xml.outputLocation'.
> 14:34:41 2. Mark property 'reports.enabledReports.xml.outputLocation'
> as optional. {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)