-
Notifications
You must be signed in to change notification settings - Fork 16
/
jacoco-report.gradle
48 lines (42 loc) · 2.01 KB
/
jacoco-report.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
apply plugin: 'jacoco' //加载代码覆盖库jacoco
jacoco {
toolVersion = "0.7.9" //代码覆盖库jacoco版本号
}
//代码覆盖率相关配置 start
def coverageSourceDirs = [
'../wallet/src/main/java'
]
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
//检测覆盖率的class所在目录(以项目class所在目录为准)
dir: './build/intermediates/javac/GooglePlayDebug/classes', //gradle2.3 class所在目录
//gradle3.2 class所在目录 dir: './build/intermediates/javac/debug/compileDebugJavaWithJavac/classes',
//增加以上目录中不需要检测的文件列表
excludes: ['**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class',
'com/platon/aton/component/ui/view/**.*',
'com/platon/aton/component/widget/*'
// 'com/platon/aton/component/ui/view/**.*'
// 'com/platon/aton/component/ui/dialog/*',
// 'com/platon/aton/component/ui/contract/**.*',
// 'com/platon/aton/component/ui/**.*',
// 'com/platon/aton/component/adapter/*',
// 'com/platon/aton/component/service/*',
// 'com/platon/aton/component/widget/*',
// 'com/platon/aton/component/netlistener/**.*',
// 'com/platon/aton/app/*',
// 'com/platon/aton/event/*'
]
)
sourceDirectories = files(coverageSourceDirs) //设置需要检测覆盖率的目录
executionData = files("$buildDir/outputs/code-coverage/connected/coverage.ec") //存储APP运行时产生报告的路径
}
//代码覆盖率相关配置 end