Merging Android unit test and connected test code coverage data is broken

前端 未结 1 843
盖世英雄少女心
盖世英雄少女心 2021-01-15 01:14

Version 2.3.3 of the Android Gradle Plugin was able to provide merged unit test and connected test code coverage data. In version 3.0.0, this capability is broken because e

相关标签:
1条回答
  • 2021-01-15 01:24

    According to Android Plugin DSL Reference that contributes Android specific things:

    To specify the version of JaCoCo you want to use, you now need to include it as a buildscript dependency in your project-level build.gradle file, as follows:

    buildscript {
          dependencies {
            classpath "org.jacoco:org.jacoco.core:<jacoco-version>"
            ...
        }
    }
    

    Previously Android Plugin had

    android {
        jacoco {
            version = "<jacoco-version>"
        }
    }
    

    According to Gradle JaCoCo Plugin documentation that contributes task of type JacocoReport:

    The JaCoCo plugin adds a project extension named jacoco of type JacocoPluginExtension, which allows configuring defaults for JaCoCo usage in your build.

    jacoco {
        toolVersion = "<jacoco-version>"
    }
    

    And so here is modification for your https://github.com/pajato/acc that allows to align versions so that execution of ./gradlew clean jacocoTestReport succeeds:

    buildscript {
        dependencies {
            classpath "org.jacoco:org.jacoco.core:0.7.9"
        }
    }
    
    allprojects {
        apply plugin: "jacoco"
        jacoco {
            toolVersion = "0.7.9"
        }
    }
    
    0 讨论(0)
提交回复
热议问题