Skip to content

Commit

Permalink
make jacoco.excludes auto scan
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosuper123321 committed Nov 21, 2024
1 parent c1bc633 commit 8287872
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@ jacoco {
}

tasks.withType(Test) {
jacoco {
def excludesOut = [];
fileTree(project(':framework').buildDir).files.collect { file ->
file.absolutePath.replace(project.buildDir.absolutePath + '/', '')
}.findAll { it.endsWith('.class') }.forEach {
if (it.indexOf("/test/")==-1
&& it.indexOf("classes-instrumented/")==-1
&& it.indexOf("classes/")!=-1
&& it.indexOf("org/")!=-1
) {
def start = it.indexOf("org");
def end = it.indexOf("\$") == -1 ? it.indexOf(".") : it.indexOf("\$")
excludesOut.add(it.substring(start, end) + "*")
}
def excludesOut = [];
doFirst {
fileTree(project(':framework').buildDir.toString()+ "/classes/java/main").files.collect {
file -> file.absolutePath
}.forEach {
def start = it.indexOf("org/")
def dollarIndex = it.indexOf("\$")
def end = dollarIndex == -1 ? it.indexOf(".") : dollarIndex
excludesOut.add(it.substring(start, end) + "*")
}
}
jacoco {
excludes = excludesOut
}
}
Expand Down

0 comments on commit 8287872

Please sign in to comment.