-
Notifications
You must be signed in to change notification settings - Fork 6
/
jacoco.gradle
50 lines (47 loc) · 1.53 KB
/
jacoco.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.8'
}
tasks.withType(Test).configureEach {
jacoco {
enabled = true
// Needed for the Robolectric runners to be covered
includeNoLocationClasses = true
// Needed for the includeNoLocationClasses to not cause the tests to fail.
excludes = ['jdk.internal.*']
}
// Launches the tests with coverage enabled
finalizedBy jacocoTestReportBitmovinTesting
}
/**
* This task generates the Jacoco report that is used by SonarQube.
*/
tasks.register('jacocoTestReportBitmovinTesting', JacocoReport) {
dependsOn 'test'
def coverageSourceDirs = ["src/main/java"]
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*'
]
def javaClasses = fileTree(
dir: "$buildDir/intermediates/javac/debug/classes/com",
excludes: fileFilter
)
def kotlinClasses = fileTree(
dir: "$buildDir/tmp/kotlin-classes/debug/com",
excludes: fileFilter
)
classDirectories.setFrom(files([javaClasses, kotlinClasses]))
additionalSourceDirs.setFrom(files(coverageSourceDirs))
sourceDirectories.setFrom(files(coverageSourceDirs))
executionData.setFrom(fileTree(dir: "$buildDir/outputs/unit_test_code_coverage/debugUnitTest/", include: ['*.exec']))
reports {
xml.required = true
html.required = true
csv.required = false
}
}