-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjacoco.gradle
44 lines (34 loc) · 1.38 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
apply plugin: 'jacoco'
apply plugin: 'com.github.dawnwords.jacoco.badge'
jacoco {
toolVersion = "$jacocoVersion"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
task jacocoTestReport(type: JacocoReport) {
group "Reporting"
description "Generate Jacoco coverage reports."
reports {
xml.enabled = true
html.enabled = true
}
def execution = []
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
additionalClassDirs fileTree(dir: "$project.buildDir/intermediates/javac/debug", excludes: fileFilter)
additionalClassDirs fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
additionalSourceDirs files("$project.projectDir/src/main/java")
execution << fileTree(dir: project.buildDir,
includes: ['jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/**/*.ec'])
print execution
executionData {
files(execution)
}
}
jacocoBadgeGenSetting {
jacocoReportPath "$buildDir/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
readmePath "$projectDir/../README.md"
// since v0.2.0, percentage limitation (0-100) for different type of coverage
limit = ['instruction': 0, 'branch': 0, 'line': 0, 'method': 0, 'class': 0]
}