Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

JaCoCo Integration #37

Closed
wants to merge 5 commits into from
Closed

JaCoCo Integration #37

wants to merge 5 commits into from

Conversation

cedrickcooke
Copy link

Closed and re-opened now that Code Climate was relaxed

Copy link
Member

@twyatt twyatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, but can you revert the moving of the files into the directory hierarchies?

Kotlin doesn't need .kt files to be in specific folders and I personally liked the flattened organization structure.

I modeled it after how the Kotlin Coroutines library does it.

.circleci/config.yml Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
@cedrickcooke
Copy link
Author

Looks great, but can you revert the moving of the files into the directory hierarchies?

Unfortunately, no I cannot. Kotlin doesn't need folders in those files, but Code Climate does. If you look at one of the CircleCI builds (such as this one) it "succeeds" but reports a bunch of errors that look like this:

ERRO[0000] failed to read file src/main/java/com/juul/able/experimental/messenger/GattCallback.kt
open src/main/java/com/juul/able/experimental/messenger/GattCallback.kt: no such file or directory 
WARN[0000] Couldn't find file for path "src/main/java/com/juul/able/experimental/messenger/GattCallback.kt" from build/reports/jacoco/jacocoTestDebugUnitTestReport/jacocoTestDebugUnitTestReport.xml coverage data. Ignore if the path doesn't correspond to an existent file in your repo. 

Their logic requires source files to be in the package-folders 😭.

@efueger
Copy link

efueger commented Sep 13, 2019

@cedrickcooke - Emily here with Code Climate Support. Thanks for the email about this.

I think this should do the trick:

Let me know if that covers your use case. 👌 Happy to help further.

@twyatt
Copy link
Member

twyatt commented Jan 30, 2020

Superseded by #42.

@twyatt twyatt closed this Jan 30, 2020
@jessecollier
Copy link

I was asked to look at why this couldn't work on code climate.

TL'DR: Codeclimate + jacoco depend on package name being where the files live. For example: com.juul.package => com/juul/package.kt.

Kotlin has slightly augmented this to not require the full package name when the whole package has a root prefix. For example the root is com.juul and therefore the file is just package.kt without the path prefix.

You can read more here:
https://kotlinlang.org/docs/reference/coding-conventions.html#source-code-organization

After looking into the cc-test-reporter, I found that it's making the assumption that the path name is the full package name (including the root). This obviously does not work with Kotlin best practices.
https://github.com/codeclimate/test-reporter/blob/master/formatters/jacoco/jacoco.go#L63

Therefore both jacoco and codeclimate need to support the root package name to omit that from the path structure.

Related: jacoco/jacoco#939

@yonigoldberg
Copy link

What about Cobertura?

@twyatt
Copy link
Member

twyatt commented Feb 4, 2020

What about Cobertura?

Cobertura fails with:

* Where:
Build file '/Users/travis/Projects/able/build.gradle' line: 59

* What went wrong:
A problem occurred evaluating root project 'able'.
> Failed to apply plugin [id 'net.saliman.cobertura']
   > Could not create an instance of type net.saliman.gradle.plugin.cobertura.CoberturaExtension_Decorated.
      > Failed to apply plugin [class 'org.gradle.language.base.plugins.LifecycleBasePlugin']
         > Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.

It also does not support the latest versions of Kotlin.

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

Successfully merging this pull request may close these issues.

5 participants