diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-03-19 13:32:06 +0100 |
---|---|---|
committer | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-03-19 15:58:03 +0100 |
commit | 8262a44875c2d82033e1f9e16639d7efbca58e77 (patch) | |
tree | 5e892be6f6f9502fb9717dbf2b17b85987417d17 /platform/android/gradle/jacoco-report.gradle | |
parent | c2fe532b9bbc9db9b2bbab109f0f47f7cc9584d7 (diff) | |
download | qtlocation-mapboxgl-8262a44875c2d82033e1f9e16639d7efbca58e77.tar.gz |
[android] unit and instrumentation tests code coverage reportupstream/lp-android-code-coverage
Diffstat (limited to 'platform/android/gradle/jacoco-report.gradle')
-rw-r--r-- | platform/android/gradle/jacoco-report.gradle | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/platform/android/gradle/jacoco-report.gradle b/platform/android/gradle/jacoco-report.gradle new file mode 100644 index 0000000000..e50facb683 --- /dev/null +++ b/platform/android/gradle/jacoco-report.gradle @@ -0,0 +1,33 @@ +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/compileDebugJavaWithJavac/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 = files([mainSrc]) + classDirectories = files([debugTree]) + executionData = files([ecSrc, execSrc]) +}
\ No newline at end of file |