-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjacoco.gradle
46 lines (43 loc) · 2.44 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
apply plugin: 'jacoco'
jacoco {
toolVersion = libs.versions.jacoco.get()
}
// A list of directories which should be included in coverage report
def coverageSourceDirs = ['src/main/java', 'src/main/kotlin']
// A list of files which should be excluded from coverage report since they are generated and/or framework code
def coverageExcludeFiles = ['**/R.class', '**/R$*.class', '**/com/android/**/*.*',
'**/BuildConfig.class', '**/*Activity*.class',
'**/*Fragment*.class', '**/*Receiver.class',
'**/*Manifest*.class', '**/*Application*.class',
'**/com/phicdy/mycuration/data/db/*.*',
'**/com/phicdy/mycuration/data/repository/*.*',
'**/com/phicdy/mycuration/di/*.*',
'**/com/phicdy/mycuration/domain/alarm/*.*',
'**/com/phicdy/mycuration/data/filter/Filter.class',
'**/com/phicdy/mycuration/data/filter/FilterFeedRegistration.class',
'**/com/phicdy/mycuration/data/rss/Article.class',
'**/com/phicdy/mycuration/data/rss/Curation.class',
'**/com/phicdy/mycuration/data/rss/CurationCondition.class',
'**/com/phicdy/mycuration/data/rss/CurationSelection.class',
'**/com/phicdy/mycuration/data/rss/Feed*',
'**/com/phicdy/mycuration/domain/task/GetFeedIconTask*',
'**/com/phicdy/mycuration/domain/task/HatenaBookmarkApi*',
'**/com/phicdy/mycuration/tracker/*.*']
tasks.register('jacocoTestReport', JacocoReport) {
dependsOn('testDebugUnitTest')
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.required = true
html.required = true
csv.required = false
getClassDirectories().setFrom(
fileTree(dir: "${buildDir}/intermediates/classes/debug",
exclude: coverageExcludeFiles) +
fileTree(dir: "$buildDir/tmp/kotlin-classes/debug",
excludes: coverageExcludeFiles)
)
}
getSourceDirectories().setFrom(files(coverageSourceDirs))
getExecutionData().setFrom(files("${buildDir}/jacoco/testDebugUnitTest.exec"))
}