Dodałem do projektu zestaw źródeł, które nie mają testów i nie chcę, aby zepsuły one moje statystyki zasięgu testów. I skonfigurowany Jacoco w następnym sposób:Gradle Jacoco - raporty dotyczące zasięgu obejmują klasy wykluczone w konfiguracji
test {
jacoco{
excludes = ['org/bla/**']
includes = ['com/bla/**']
append = false
}
}
jacocoTestReport {
dependsOn test
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled true
html.enabled true
}
classDirectories = fileTree(dir: 'build/classes/main', include: 'com/bla/**')
sourceDirectories = fileTree(dir: 'scr/main/java', include: 'com/bla/**')
}
Ale tak czy inaczej, podczas generowania raportu Jacoco obejmuje również zajęcia z org.bla
Czy ktoś może mi pomóc?
EDIT
Po pewnym debugowania, wydaje się, że wszystkie wyjścia domyślne są dodawane do org.gradle.testing.jacoco.tasks.JacocoReport#classDirectories
w prywatnej metodzie org.gradle.testing.jacoco.plugins.JacocoPlugin#addDefaultReportTasks
to widoczne podczas korzystania z takiego kodu:
jacocoTestReport {
classDirectories = files('build/classes/main/com/bla')
println("-----------------------------------------------------------")
getAllClassDirs().each { File file ->
println(file.absolutePath)
}
println("-----------------------------------------------------------")
getAdditionalClassDirs().each{ File file ->
println(file.absolutePath)
}
}
jacocoTestReport << {
println("-----------------------------------------------------------")
getAllClassDirs().each { File file ->
println(file.absolutePath)
}
println("-----------------------------------------------------------")
getAdditionalClassDirs().each{ File file ->
println(file.absolutePath)
}
}
Output
-----------------------------------------------------------
<path_here>\build\classes\main\com\bla
-----------------------------------------------------------
....more text here
-----------------------------------------------------------
<path_here>\build\classes\main\com\bla
<path_here>\build\classes\main
<path_here>\build\resources\main
-----------------------------------------------------------
So - pytanie brzmi: czy można zastąpić w jakiś sposób metodę org.gradle.testing.jacoco.plugins.JacocoPlugin#addDefaultReportTasks
, czy zastąpić całkowicie klasą org.gradle.testing.jacoco.plugins.JacocoPlugin
?
Czy to w tym tylko tho se 'classDirectories'? –
Niestety, to było dawno temu, nie jestem na bieżąco z najnowszym stanem projektu. – StKiller
Skończyło się, że zadałem własne pytanie tutaj: http://stackoverflow.com/questions/29887805/filter-jacoco-coverage-reports-with-gradle. –