Fix coverage reports

pull/360/head
Mattia Iavarone 6 years ago
parent 714d228168
commit 115df70b5c
  1. 44
      cameraview/build.gradle
  2. 2
      codecov.yml

@ -189,27 +189,41 @@ task mergedCoverageReport(type: JacocoReport) {
dependsOn "testDebugUnitTest" dependsOn "testDebugUnitTest"
dependsOn "connectedCheck" dependsOn "connectedCheck"
def testData = "jacoco/testDebugUnitTest.exec" // Merge unit tests and android tests data
def androidTestData = "outputs/code-coverage/connected/*coverage.ec" executionData = fileTree(dir: "$buildDir", includes: [
executionData = fileTree(dir: "$buildDir", includes: [testData, androidTestData]) "jacoco/testDebugUnitTest.exec", // Unit tests
"outputs/code-coverage/connected/*coverage.ec" // Android tests
// Sources. ])
sourceDirectories = android.sourceSets.main.java.sourceFiles
// Add BuildConfig and R. // Sources
additionalSourceDirs = files([ sourceDirectories = files(android.sourceSets.main.java.sourceFiles)
additionalSourceDirs = files([ // Add BuildConfig and R.
"$buildDir/generated/source/buildConfig/debug", "$buildDir/generated/source/buildConfig/debug",
"$buildDir/generated/source/r/debug" "$buildDir/generated/source/r/debug"
]) ])
// Classes. // Classes (.class files)
def debugDir = "$buildDir/intermediates/classes/debug" // Not everything in the filter relates to CameraView,
def filter = ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', // but let's keep a generic filter
'**/BuildConfig.*', '**/Manifest*.*'] def classDir = "$buildDir/intermediates/javac/debug"
classDirectories = fileTree(dir: debugDir, excludes: filter); def classFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'android/**',
'androidx/**',
'com/google/**',
'**/*$ViewInjector*.*',
'**/Dagger*Component.class',
'**/Dagger*Component$Builder.class',
'**/*Module_*Factory.class',
]
classDirectories = fileTree(dir: classDir, excludes: classFilter);
reports.xml.enabled = true
reports.html.enabled = true reports.html.enabled = true
reports.xml.destination = "$reportsDirectory/mergedCoverageReport/report.xml" reports.xml.enabled = true
reports.xml.destination file("$reportsDirectory/mergedCoverageReport/report.xml")
} }
//endregion //endregion

@ -6,7 +6,7 @@ coverage:
status: status:
project: project:
default: default:
target: 50% target: 45%
patch: patch:
default: default:
target: 70% target: 70%

Loading…
Cancel
Save