-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathunit_testing.gradle
39 lines (30 loc) · 1.05 KB
/
unit_testing.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
repositories {
jcenter()
}
//这个是用来代码覆盖率统计的
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.7.1.201405082137"
}
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
group = "Reporting"
description = "Generate Jacoco coverage reports"
//1. 这里是一些不需要统计的类,比如说自动生成的一些类,可以根据需要,在这里添加
def excludedSources = ['**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/*$ViewInjector*.*',
'**/*MembersInjector.*',
'**/dagger/*',
'**/Manifest*.*']
classDirectories = fileTree(
dir: 'build/intermediates/classes/debug',
excludes: excludedSources
)
sourceDirectories = files(['src/main/java'])
executionData = files('build/jacoco/testDebugUnitTest.exec')
reports {
xml.enabled = true
html.enabled = true
}
}