Skip to content

Commit 546c0f5

Browse files
make jacoco.excludes auto scan
1 parent 00b624f commit 546c0f5

File tree

3 files changed

+20
-89
lines changed

3 files changed

+20
-89
lines changed

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ allprojects {
22
version = "1.0.0"
33
apply plugin: "java-library"
44
}
5-
apply from : "config.gradle"
65

76
subprojects {
87
apply plugin: "jacoco"
@@ -89,3 +88,7 @@ gradle.buildFinished {
8988
}
9089
}
9190
}
91+
92+
ext {
93+
ext.jacocoVersion = "0.8.8"
94+
}

config.gradle

Lines changed: 0 additions & 87 deletions
This file was deleted.

framework/build.gradle

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,22 @@ jacoco {
2222
}
2323

2424
tasks.withType(Test) {
25-
jacoco.excludes = rootProject.ext.jacocoNeedFilterClasses
25+
jacoco {
26+
def excludesOut = [];
27+
fileTree(project(':framework').buildDir).files.collect { file ->
28+
file.absolutePath.replace(project.buildDir.absolutePath + '/', '')
29+
}.findAll { it.endsWith('.class') }.forEach {
30+
if (it.indexOf("/test/")==-1
31+
&& it.indexOf("classes/")!=-1
32+
&& it.indexOf("classes-instrumented/")==-1
33+
) {
34+
def start = it.indexOf("org");
35+
def end = it.indexOf("\$") == -1 ? it.indexOf(".") : it.indexOf("\$")
36+
excludesOut.add(it.substring(start, end) + "*")
37+
}
38+
}
39+
excludes = excludesOut
40+
}
2641
}
2742

2843
configurations {

0 commit comments

Comments
 (0)