jacoco gradle Filtering

115 views
Skip to first unread message

sgo...@gmail.com

unread,
Apr 20, 2015, 6:30:53 PM4/20/15
to jac...@googlegroups.com
Hello,

I am using jacoco with gradle and I am able to generate reports, however when I try to use filters (Includes, Excludes) its not working as expected. Here's how my generate report task looks like:

task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/*.exec")

subprojects.each {
sourceSets it.sourceSets.main
}

reports {
xml.enabled true
html.enabled true
html.destination "${buildDir}/reports/jacoco"
csv.enabled false
}

classDirectories = fileTree(
dir: "/mnt/home/user1/src/repo/myclasses",
includes: ['**/com/blahblah/**/*'],
excludes: ['**/org/apache/**/*',
'**/com/google/**/*',
'HelloWorld*class',
'UT_*.class',
]
)
}

Iteration #1: First time I run this "codeCoverageReport" task without any filters (meaning clasDirectories override comented out). Jacoco tells me its writing bundle with 7000 classes.

[ant:jacocoReport] Writing bundle 'source' with 7000 classes

Iteration #2: This time I copied the class files to "myclasses" directory and my "classDirectories" override looks like this (no includes and excludes)

classDirectories = fileTree(
dir: "/mnt/home/user1/src/repo/myclasses",
)

Jacoco tells me its writing bundle with 14000 classes.

[ant:jacocoReport] Writing bundle 'source' with 14000 classes

Iteration #3: I apply filters with excludes (trying to exclude all class files to see what I get)

classDirectories = fileTree(
dir: "/mnt/home/user1/src/repo/myclasses",
excludes: ['*.class',
]
)

jacoco reports writing bundle with 7000 classes.

Bottom line I want filters to work, if I don't override classDirectories nothing seems to work, with overriding it kinda works but seems to be picking up the "default" classes as well.

Can someone help me here please.

Thanks,

Marc R. Hoffmann

unread,
Apr 21, 2015, 6:38:53 AM4/21/15
to jac...@googlegroups.com
Hi,

the Gradle integration is done by the Gradle project itself. I recommend also asking at their forum:

Regards,
-marc

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages