arturdm / jacoco-android-gradle-plugin

Gradle plugin that creates JaCoCo test reports for Android unit tests
Apache License 2.0
563 stars 111 forks source link

Does not support Java libraries right? #22

Open spirosoik opened 8 years ago

spirosoik commented 8 years ago

I can't use this plugin for a java library module in android.

arturdm commented 8 years ago

Hi @spirosoik ,

you probably do not need to use this plugin in pure java project in the first place. It's enough to just apply plugin: 'jacoco'.

If you want to configure which report types should be generated you can try the code below.

apply plugin: 'jacoco'

jacocoTestReport {
  reports {
    xml.enabled true
    html.enabled false
  }
}

You can read more about it in Integrating Android project with Codecov article and JaCoCo gradle plugin documentation.

Hope it helps.

Drjacky commented 5 years ago

@arturdm But your solution didn't work. I have an Android project, which following Clean Architecture. And your plugin doesn't generate any reports for Domain module which is a java library:

apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'

tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
}

jacocoTestReport {
    reports {
        xml.enabled true
        html.enabled false
    }
}

dependencies {