-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathreportings.gradle
51 lines (48 loc) · 1.87 KB
/
reportings.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
apply plugin: 'jacoco'
jacoco {
toolVersion '0.8.7'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
project.afterEvaluate {
tasks.create(name: "debugCoverage", type: JacocoReport, dependsOn: "testDebugUnitTest") {
group = "Reporting"
description = "Generate Jacoco coverage reports for the debug build."
reports {
html.required = true
xml.required = true
}
def excludes = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
'androidx/**/*.*',
'**/*$ViewInjector*.*',
'**/*Dagger*.*',
'**/*MembersInjector*.*',
'**/*_Factory.*',
'**/*_Provide*Factory*.*',
'**/*_ViewBinding*.*',
'**/AutoValue_*.*',
'**/R2.class',
'**/R2$*.class',
'**/*Directions$*',
'**/*Directions.*',
'**/*Binding.*'
]
def jClasses = "${project.buildDir}/intermediates/javac/debug/classes"
def kClasses = "${project.buildDir}/tmp/kotlin-classes/debug"
def javaClasses = fileTree(dir: jClasses, excludes: excludes)
def kotlinClasses = fileTree(dir: kClasses, excludes: excludes)
classDirectories.from = files([javaClasses, kotlinClasses])
def sourceDirs = ["${project.projectDir}/src/main/java", "${project.projectDir}/src/main/kotlin",
"${project.projectDir}/src/debug/java", "${project.projectDir}/src/debug/kotlin"]
sourceDirectories.from = files(sourceDirs)
executionData.from = files(["${project.buildDir}/jacoco/testDebugUnitTest.exec"])
}
}