-
Notifications
You must be signed in to change notification settings - Fork 9
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
PrintCoverage with multi-module gradle project #1
Comments
Ou, It looks like that your print functionality depends on XML report, hmmm. Might worth to extend implementation for printcoverage() and catch subprojects reports with some math/aggregation involved for coverage result. |
Hi @yurii-polishchuk |
Cool Thnx, For now, I did a trick and just merged all the results to root project level. overall looks good. build.gradle (root one)
As a result: As a result in console:
|
@jansauer though, it would be very helpfull, if in: File jacocoTestReport = new File("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml") it would be much easier to make it configurable and tell your task to parse any XML |
I agree with @yurii-polishchuk . It would be very helpful if we could configure where/which xml report to parse. I maintain a lot of projects and almost all of them are Multi module Gradle projects. I needed an overall coverage report. So, I also ended up doing the same thing. In my root project's task combinedCoverageReport(type: JacocoReport) {
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
doFirst {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: [
'**/some/package/to/be/excluded/if/needed/*'
])
})
executionData = files(executionData.findAll { it.exists() })
}
} The above task will generate the combined xml report under I then added another task copyRootCoverageReport(type: Copy) {
from (combinedCoverageReport) {
include "combinedCoverageReport.xml"
}
rename ("combinedCoverageReport.xml", "jacocoTestReport.xml")
into "$buildDir/reports/jacoco/test"
} |
@amimas Your message is from a long time ago but ...
in your |
Hi @jansauer,
Nice and lightweight plugin for Jacoco coverage console output. Appreciate your work.
I've tried your plugin in my pet multi-module Gradle project, but it looks like I've missed something. Does plugin support it? I didn't have a chance to look at your code, but when I run printCoverage on a root level, I have error, though running command per individual subproject works well.
settings.gradle:
build gradle root:
I would appreciate feedback from you!
Thanks,
Yurii
The text was updated successfully, but these errors were encountered: