1
1
apply plugin : ' com.android.application'
2
2
apply plugin : ' jacoco'
3
3
4
- task jacocoTestReport (type : JacocoReport , dependsOn : ' testDebugUnitTest' ) {
4
+ task jacocoTestReport (type : JacocoReport , dependsOn : [ ' testDebugUnitTest' , ' createDebugCoverageReport ' ] ) {
5
5
6
6
reports {
7
7
xml. enabled = true
8
8
html. enabled = true
9
9
}
10
10
11
- jacocoClasspath = configurations[' androidJacocoAnt' ]
12
-
13
11
def fileFilter = [' **/R.class' , ' **/R$*.class' , ' **/BuildConfig.*' , ' **/Manifest*.*' , ' **/*Test*.*' , ' android/**/*.*' ]
14
12
def debugTree = fileTree(dir : " ${ buildDir} /intermediates/classes/debug" , excludes : fileFilter)
15
13
def mainSrc = " ${ project.projectDir} /src/main/java"
16
14
17
15
sourceDirectories = files([mainSrc])
18
16
classDirectories = files([debugTree])
19
- executionData = files([ " ${ buildDir} /jacoco/testDebugUnitTest.exec " ,
20
- " ${ buildDir } / outputs/code-coverage/connected/coverage.ec"
17
+ executionData = fileTree( dir : " $ buildDir " , includes : [
18
+ " jacoco/testDebugUnitTest.exec " , " outputs/code-coverage/connected/* coverage.ec"
21
19
])
22
20
}
23
21
24
- jacoco {
25
-
26
- }
27
-
28
22
android {
29
- compileSdkVersion 23
30
- buildToolsVersion ' 23 .0.3 '
23
+ compileSdkVersion 25
24
+ buildToolsVersion ' 25 .0.0 '
31
25
32
26
defaultConfig {
33
27
applicationId ' net.rafaeltoledo.coverage'
34
28
minSdkVersion 15
35
- targetSdkVersion 23
29
+ targetSdkVersion 25
36
30
versionCode 1
37
31
versionName ' 1.0'
38
32
39
33
testInstrumentationRunner ' android.support.test.runner.AndroidJUnitRunner'
40
34
}
35
+
41
36
buildTypes {
42
37
debug {
43
38
testCoverageEnabled true
@@ -47,15 +42,22 @@ android {
47
42
proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
48
43
}
49
44
}
45
+
46
+ testOptions {
47
+ unitTests. all {
48
+ jacoco {
49
+ includeNoLocationClasses = true
50
+ }
51
+ }
52
+ }
50
53
}
51
54
52
55
dependencies {
53
- compile ' com.android.support:appcompat-v7:23.3 .0'
56
+ compile ' com.android.support:appcompat-v7:25.0 .0'
54
57
55
58
androidTestCompile ' com.android.support.test.espresso:espresso-core:2.2.2'
56
- androidTestCompile ' com.android.support:support-annotations:23.3.0'
57
- androidTestCompile ' com.android.support.test:runner:0.5'
59
+ androidTestCompile ' com.android.support:support-annotations:25.0.0'
58
60
59
61
testCompile ' junit:junit:4.12'
60
- testCompile ' org.robolectric:robolectric:3.0 '
62
+ testCompile ' org.robolectric:robolectric:3.1.4 '
61
63
}
0 commit comments