ktlint-gradle
ktlint-gradle copied to clipboard
Intermediate output bin files contain full paths
Task org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask
uses intermediate bin files with errors and these files contain absolute file paths that are problematic.
Because of this the task input changes depending on where the project is checked out. This causes cache misses.

The cause of this difference to the inputs on the GenerateReportsTask
is that the KtLintCheck
which uses the KtLintWorkAction
is writing the fully qualified paths to the files in the KtLintClassesSerializer
.
In addition to the cache miss, the consequence of this is that since the KtLintCheck
task is relocateable, it can be consumed across workspaces by the GenerateReportsTask
with an incorrect fully qualified path to the error.
Are there any good ways to write a unit test for this bug? Suggestions welcome.
A cache relocateability test would be the best way. Here is an example (although outdated): https://github.com/gradle/kotlin-relocation-test
Here is such a relocation test inside the Android Cache fix plugin: https://github.com/gradle/android-cache-fix-gradle-plugin/blob/master/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy
I'm more than happy to review a PR that resolves this issue. I don't think that either @Tapchicoma nor I have time to tackle this at the moment.