Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacoco Task taking forever #60

Open
bschnack opened this issue Feb 23, 2019 · 7 comments
Open

Jacoco Task taking forever #60

bschnack opened this issue Feb 23, 2019 · 7 comments

Comments

@bschnack
Copy link

The Jacoco Task sometimes takes forever to run. Sometimes, it runs immediately and other times, it just gets stuck doing the same task over and over again. You can see the gradle task in the picture below. The gradle file (slimmed down to important info) looks like:
build.gradle Project Level

buildscript {
    dependencies {
        classpath('com.dicedmelon.gradle:jacoco-android:0.1.3') { exclude group: 'org.codehaus.groovy', module: 'groovy-all' }
    }
}

build.gradle App Level

apply plugin: 'jacoco-android'

android {
    testOptions {
        animationsDisabled true
        unitTests {
            includeAndroidResources = true
        }
        unitTests.all {
            jvmArgs '-noverify'
            jacoco {
                includeNoLocationClasses = true
            }
        }
    }
}

jacocoAndroidUnitTestReport {
    csv.enabled true
    html.enabled false
    xml.enabled false
}

image

@arturdm
Copy link
Owner

arturdm commented Feb 27, 2019

@bschnack could you try again with 0.1.4?

@bschnack
Copy link
Author

bschnack commented Mar 1, 2019

So far that seems to have worked. However, we still see that the Jacoco task takes a while to run. Is there a way to only have it run with a certain command line argument or improve that time?

Thanks,
Brian

image

@hoda0013
Copy link

hoda0013 commented Nov 5, 2019

I am seeing similar behavior with 0.1.4. It only happens intermittently but occasionally I'll the jacocoDevDebug job running for 5 to 10 minutes.

@mochadwi
Copy link

mochadwi commented Mar 8, 2020

I've tried below approach:

  1. gradle.startParameter.excludedTaskNames += "jacocoDevelopDebug" in custom task, or overwriting it, e.g:
// kotlin gradle
task.replace("assemble[Flavour]Debug").doLast { 
   gradle.startParameter.excludedTaskNames += "jacoco[Flavour]Debug"
}

// groovy gradle
task jar(overwrite: true) {
   gradle.startParameter.excludedTaskNames += "jacoco[Flavour]Debug"
}

See original issue here & here (about kotlin gradle)


  1. Using parameter in command line, e.g:
./gradlew -PnoLint
// or
./gradlew -x lint

See original article here & here


  1. Flagging based on command line argument & separating jacoco task gradle file
if (System.getProperty("myJacocoArguments").toBoolean()) {
   apply: jacoco.gradle
}

See here for more detail


  1. Disable test coverage on local development, and run only on jenkins/CI server
        testCoverageEnabled (project.hasProperty('coverage') ? true : false)

Original article

@nateridderman-lilly
Copy link

This is happening to me, but I'm not even using this plugin. I'm using https://github.com/vanniktech/gradle-android-junit-jacoco-plugin

@pp-lucaal-sportsbet
Copy link

This is still happening for 50 per cent of the build. Any way to fix this or to get rid of the plugin all together?

@Sinapse87
Copy link

Unfortunately this issue is still happening. Has anyone been able to find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants