Conversation
picklebento
left a comment
There was a problem hiding this comment.
Advantages over the current config are that there's no cross project configuration using
subprojects(which is discouraged), and that the generated HTML report now renders properly.
To paraphrase: If module B's test code covers module A's code, then module A's code would be counted as "covered" in jacoco. Is that correct?
Coverage report on my machine seems slightly improved with this config as well.
Would you mind sharing the jacoco output? (I assume our detekt-gradle-plugin code cannot be correctly calculated still)
| jacocoTestReport { | ||
| executionData.setFrom(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")) | ||
| dependencies { | ||
| implementation(project("custom-checks")) |
There was a problem hiding this comment.
Using the implementation configuration feels weird: Would that create unnecessary tasks by the plugins applied in this build.gradle?
I am wondering if we could use a different configuration, or move the jacoco to a separate module.
There was a problem hiding this comment.
Moving jacoco generation to a separate project/module makes sense to me. I believe a different configuration would work instead of implementation too. I can make those changes.
Would that create unnecessary tasks by the plugins applied in this build.gradle?
I don't believe so. But if there were unnecessary tasks, and they're not created during the configuration phase, there'll be no penalty to build performance. This is a jacocoTestReport build scan and a codeCoverageReport build scan for comparison. The only tasks created immediately or during configuration are from nexus-staging, binary-compatibility-validator, gradle.plugin-publish, github-release and sonarqube plugins.
The benefit of using configurations like this is it's more declarative so manually setting up task dependencies can be avoided, and only the tasks that need to be run are run. The disadvantage is the boilerplate.
There was a problem hiding this comment.
Can the following block of build script be removed
subprojects
.filterNot { it.name in examplesOrTestUtils }
.forEach {
this@jacocoTestReport.sourceSets(it.sourceSets.main.get())
this@jacocoTestReport.dependsOn(it.tasks.test)
}
I don't know jacoco enough to realize the actual benefit. The boilderplate might be fine since we do not add/change gradle modules often.
f4f4473 to
b0fc185
Compare
Codecov Report
@@ Coverage Diff @@
## main #3650 +/- ##
============================================
- Coverage 83.48% 78.75% -4.73%
+ Complexity 2914 2900 -14
============================================
Files 452 473 +21
Lines 8766 9336 +570
Branches 1664 1722 +58
============================================
+ Hits 7318 7353 +35
- Misses 544 1075 +531
- Partials 904 908 +4
Continue to review full report at Codecov.
|
I believe that's already happening - this change is just about getting the data from each subproject's JaCoCo output, source files and compiled classes in the "right" way. So instead of the merge task reaching into directories manually, the relevant files are packaged by the new configurations (like
I'm not sure if the line coverage differential in the JaCoCo HTML report run on my machine is actually consequential - now the report is picked up by Codecov you can see there's no difference in coverage reported when using the new task. |
fd38f08 to
1baa3b4
Compare
Advantages over the current config are that there's no cross project configuration using
subprojects(which is discouraged), and that the generated HTML report now renders properly from the merged JaCoCo task outputs.Although more advanced/technical than typical Gradle build scripts this technique is actually the recommended way to share outputs between projects.