-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathjacoco.gradle
executable file
·66 lines (60 loc) · 2.29 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.8"
reportsDirectory = layout.buildDirectory.dir('JacocoReports')
}
/**
* The correct path of the report is $rootProjectDir/app/build/reports/jacoco/index.html
* to run this task use: ./gradlew clean jacocoTestReport
*/
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
group = "reporting"
description = "Generate Jacoco code coverage report"
reports {
xml.required = true
csv.required = true
html.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
'**/auth**',
'**/*CrowdinContextWrapper*.*',
'**/*CrowdinLayoutInflater*.*',
'**/*CrowdinResources*.*',
'**/*Attributes*.*',
'**/*ThreadUtils*.*',
'**/*Extensions*.*',
'**/*ScreenshotService*.*',
'**/*Connectivity*.*',
'**/*NetworkType*.*',
'**/api**',
'**/*XmlParserUtils*.*',
'**/*BaseNavigationViewTransformer*.*',
'**/*BaseToolbarTransformer*.*',
'**/*BaseTransformer*.*',
'**/*BottomNavigationViewTransformer*.*',
'**/*NavigationViewTransformer*.*',
'**/*SpinnerTransformer*.*',
'**/*SupportToolbarTransformer*.*',
'**/*TextViewTransformer*.*',
'**/*ToolbarTransformer*.*',
'**/*ScreenshotUtils*.*',
'**/*ResourcesData*.*',
'**/*UiUtil*.*'
]
def javaDebugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug", excludes: fileFilter)
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([javaDebugTree, kotlinDebugTree])
executionData.from = fileTree(dir: "$buildDir", includes: [
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
}