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 Coverage for root src missing After Upgrading to >= 0.37.0 #433

Closed
choweiyuan opened this issue Dec 23, 2020 · 5 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@choweiyuan
Copy link

choweiyuan commented Dec 23, 2020

Hi

My project has been on org.kordamp.gradle.jacoco 0.29.0 for a long time, and I tried upgrading to 0.42.1

Our aggregateJacocoReport reports that the total coverage has dropped from 86.7% to 73.7%.
I tried upgrading version by version, and noticed that the version that start causing issue is 0.37.0.

Would like to know if anything fundamentally has changed from that version onwards that may cause coverage report changes?

Our project is structured as follows ( root folder has src/test, src/main, and have multiple submodules in project1/project2/project3 subfolders)


├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── src
        ├── integrationTest
       ├── main
       └── test
├── settings.gradle
└── project1
        ├── build.gradle.kts
        └── src
            └── main
            └── test
└── project2
        ├── build.gradle.kts
        └── src
            └── main
            └── test
└── project3
        ├── build.gradle.kts
        └── src
            └── main
            └── test

Another info but not sure if it's relevant. We also have integration tests, but without using the org.kordamp.gradle.integration-test module at the moment. I'm unsure if integration test is run after the upgrade

We have something like this

task integrationTest(type: Test) { Test task ->
  task.useJUnitPlatform { JUnitPlatformOptions options ->
    options.includeTags 'integration'
  }
}

I tried using org.kordamp.gradle.integration-test but not sure if the aggregateJacocoReport task is aggregating build/jacoco/integrationTest.exec.

Happy to provide more info where possible/required. Thanks in advance

@choweiyuan choweiyuan changed the title Different Jacoco Coverage Result After Upgrading to > 0.37.0 Different Jacoco Coverage Result After Upgrading to >= 0.37.0 Dec 23, 2020
@aalmiray
Copy link
Collaborator

We may have upgraded to a newer release of JaCoCo between the versions you mentioned. Have you tried setting a different version for JaCoCo?

@choweiyuan
Copy link
Author

choweiyuan commented Dec 23, 2020

So I tried

plugins {
    id 'org.kordamp.gradle.jacoco' version '0.36.0'
}

config {
  coverage {
    jacoco {
      toolVersion = "0.8.6"
    }
  }
}

The above (0.36.0 gradle plugin with 0.8.6 jacoco) gives correct (86.7%) coverage whereas org.kordamp.gradle.jacoco 0.37.0 with 0.8.5 and 0.8.6 Jacoco gives lower coverage (73.7%)

plugins {
    id 'org.kordamp.gradle.jacoco' version '0.37.0'
}

config {
  coverage {
    jacoco {
      toolVersion = "0.8.5" // Tried with 0.8.6 too
    }
  }
}

@aalmiray
Copy link
Collaborator

Looking at the diff between 0.36.0 and 0.37.0 I can see there was bug in JacocoPlugin where additional classDirectories was left commented out. This code is back to normal in the latest release.

Could you do me a favor an inspect the settings of the aggregate tasks by running with both 0.36.0 and 0.37.0?

$ gradle aggregateJacocoMergeTaskSettings
$ gradle aggregateJacocoReportTaskSettings

I'm hopeful this can tell us which settings have been configured differently.

@choweiyuan
Copy link
Author

Hi @aalmiray , happy new year to you.

0.36.0 output
0.37.0 output

One difference I've spotted is that 0.36.0 detects root-project/src/main/kotlin as source, 0.37.0 onwards doesn't.

0.36.0

aggregateJacocoReport:
    actions:
        org.gradle.api.internal.project.taskfactory.StandardTaskAction@7b6ce19d
    additionalSourceDirs:
        /Users/myUserName/IdeaProjects/root-project/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/src/main/java
        /Users/myUserName/IdeaProjects/root-project/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/java
    allClassDirs:
        /Users/myUserName/IdeaProjects/root-project/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-f/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/module-f/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-d/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/module-d/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-e/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/module-e/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-g/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/module-g/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-a/build/classes/java/main
        /Users/myUserName/IdeaProjects/root-project/module-a/build/classes/kotlin/main
        /Users/myUserName/IdeaProjects/root-project/module-h/build/classes/java/main
    allSourceDirs:
        /Users/myUserName/IdeaProjects/root-project/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/src/main/java
        /Users/myUserName/IdeaProjects/root-project/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/java

0.37.0

aggregateJacocoReport:
    actions:
        org.gradle.api.internal.project.taskfactory.StandardTaskAction@7da1cc3a
    additionalSourceDirs:
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/java
    allSourceDirs:
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-f/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-d/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-e/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-g/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/java
        /Users/myUserName/IdeaProjects/root-project/module-a/src/main/kotlin
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/resources
        /Users/myUserName/IdeaProjects/root-project/module-h/src/main/java

@aalmiray
Copy link
Collaborator

aalmiray commented Jan 4, 2021

Happy New Year to you as well, @choweiyuan 😄

Thank you for the feedback. So it seems the root source is missing, as well as allClassDirs since 0.37.0. This should not be that difficult to fix (famous last words).

@choweiyuan choweiyuan changed the title Different Jacoco Coverage Result After Upgrading to >= 0.37.0 Jacoco Coverage for root src missing After Upgrading to >= 0.37.0 Jan 4, 2021
@aalmiray aalmiray self-assigned this Jan 4, 2021
@aalmiray aalmiray added the bug Something isn't working label Jan 4, 2021
@aalmiray aalmiray added this to the 0.43.0 milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants