33 lines
1.1 KiB
Groovy
33 lines
1.1 KiB
Groovy
apply plugin: 'jacoco'
|
|
apply from: "${rootDir}/gradle/dependencies.gradle"
|
|
|
|
jacoco {
|
|
toolVersion = versions.jacoco
|
|
}
|
|
|
|
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
|
|
group = "Reporting"
|
|
description = "Combine code coverage to unified report."
|
|
|
|
reports {
|
|
xml.enabled = true
|
|
html.enabled = true
|
|
}
|
|
|
|
def fileExcludes = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
|
|
def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/debug/classes", excludes: fileExcludes)
|
|
def mainSrc = "${project.projectDir}/src/main/java"
|
|
println(mainSrc)
|
|
def ecSrc = fileTree(dir: "$project.buildDir", include: "**/*.ec")
|
|
def execSrc = fileTree(dir: "$project.buildDir", include: "**/*.exec")
|
|
|
|
doFirst {
|
|
def files = files([ecSrc, execSrc]).files
|
|
println "Creating Jacoco Report for ${files.size()} coverage files"
|
|
files.each { file -> println file }
|
|
}
|
|
|
|
sourceDirectories.from = files([mainSrc])
|
|
classDirectories.from = files([debugTree])
|
|
executionData.from = files([ecSrc, execSrc])
|
|
} |