Explorar o código

add jacoco plugin for calculate code coverage
setup needed instruction in jacoco.gradle

MrOzOn %!s(int64=5) %!d(string=hai) anos
pai
achega
6383fd5938
Modificáronse 3 ficheiros con 47 adicións e 1 borrados
  1. 1 0
      build.gradle
  2. 5 1
      feature_auth/build.gradle
  3. 41 0
      jacoco.gradle

+ 1 - 0
build.gradle

@@ -17,6 +17,7 @@ buildscript {
         classpath 'com.android.tools.build:gradle:3.6.4'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.10.0"
+        classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
     }
 }
 

+ 5 - 1
feature_auth/build.gradle

@@ -3,6 +3,8 @@ apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 apply plugin: 'kotlin-kapt'
 
+apply from: "$project.rootDir/jacoco.gradle"
+
 android {
     compileSdkVersion rootProject.compileSdkVersion
     buildToolsVersion "29.0.3"
@@ -18,6 +20,9 @@ android {
     }
 
     buildTypes {
+        debug {
+            testCoverageEnabled true
+        }
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@@ -69,5 +74,4 @@ dependencies {
     androidTestImplementation espressoCore
     androidTestImplementation androidXFragmentTest
     kaptAndroidTest daggerCompiler
-
 }

+ 41 - 0
jacoco.gradle

@@ -0,0 +1,41 @@
+apply plugin: 'jacoco-android'
+
+jacoco {
+    toolVersion = "0.8.5"
+}
+
+tasks.withType(Test) {
+    jacoco.includeNoLocationClasses = true
+}
+
+jacocoAndroidUnitTestReport {
+    excludes += [
+            '**/R.class',
+            '**/R$*.class',
+            '**/BuildConfig.*',
+            '**/Manifest*.*',
+            '**/*Test*.*',
+            '**/*Fragment*.*',
+            '**/android/databinding/*',
+            '**/androidx/databinding/*',
+            '**/*Binding*.*',
+            '**/di/module/*',
+            '**/*MapperImpl*.*',
+            '**/*$ViewInjector*.*',
+            '**/*$ViewBinder*.*',
+            '**/BuildConfig.*',
+            '**/*Component*.*',
+            '**/*BR*.*',
+            '**/Manifest*.*',
+            '**/*$Lambda$*.*',
+            '**/*Companion*.*',
+            '**/*Module.*',
+            '**/*Dagger*.*',
+            '**/*MembersInjector*.*',
+            '**/*_Factory*.*',
+            '**/*_Provide*Factory*.*',
+            '**/*Extensions*.*',
+            '**/*$Result.*', /* filtering `sealed` and `data` classes */
+            '**/*$Result$*.*'/* filtering `sealed` and `data` classes */
+    ]
+}