Skip to content

Commit

Permalink
NTV-415 :Jacoco code coverage only looking throw Java classes (#1550)
Browse files Browse the repository at this point in the history
* Fix JaCoCo

* Fix JaCoCo

* Fix JaCoCo path

* Fix kotlin JaCoCo path

* test Kover

* rest branch

* add kover

* add kover

* add kover

* add Circle ci

* add jacoco.gradle remove exclude

* remove kover

* update jacoco report

* update autoGenerated exclude files

* update jacoco depend

* update jacoco depend

* remove kover depend

* update jacoco kotlin path

* update jacoco for adpaters
  • Loading branch information
hadia authored Feb 28, 2022
1 parent 94934a9 commit a376990
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'jacoco'
jacoco {
toolVersion = "$jacoco_version"
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
Expand Down Expand Up @@ -37,6 +38,9 @@ android.applicationVariants.all { variant ->
'**/*Dialog*.*',
'**/ui/*.*',
'**/ui/views/*.*',
'**/ui/adapters/*.*',
'**/ui/adapters/data/*.*',
'**/ui/adapters/projectcampaign/*.*',
'**/databinding/*.*',
'**/mock/*.*',
'**/services/*.*',
Expand All @@ -51,15 +55,22 @@ android.applicationVariants.all { variant ->
description "Generate ${variantName} Jacoco coverage reports."

reports {
xml.enabled = true
html.enabled = true
xml.enabled( true)
html.enabled( true)
}

// variant.javaCompile.source does not work
// traverses from starting point
sourceDirectories.from = files(android.sourceSets.main.java.srcDirs)
def debugTree = fileTree(dir: variant.javaCompileProvider.get().destinationDir, excludes: autoGenerated)
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/${variant.name}", excludes: autoGenerated)

sourceDirectories.from = [
android.sourceSets.main.java.srcDirs,
"src/main/java/com/kickstarter/"
]
classDirectories.from = files([debugTree], [kotlinDebugTree])
executionData.from = files("${buildDir}/jacoco/test${variantName}UnitTest.exec")
classDirectories.from = fileTree(dir: variant.javaCompileProvider.get().destinationDir, excludes: autoGenerated)

}

}

0 comments on commit a376990

Please sign in to comment.