ImFlog/schema-registry-plugin

downloadSchemasTask is always executed even when inputs don't change

filipblondeel opened this issue · 2 comments

As mentioned in discussion #178, the downloadSchemasTask is always executed even when the inputs don't change.

I have created https://github.com/filipblondeel/imflog-schema-registry-plugin_issue-179 with a minimal Gradle build that shows this behavior.

When I run ./gradlew downloadSchemasTask multiple times, the downloadSchemasTask is never marked as 'UP-TO-DATE'. However, since the inputs of the task don't change, I would expect it to be up-to-date after the first run.

I tried setting the outputs property of the downloadSchemasTask to make the incremental build work but that causes this error:

> Task :downloadSchemasTask FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':downloadSchemasTask'.
> Cannot fingerprint input property 'metadataConfig': value 'MetadataExtension(enabled=false, outputPath=null)' cannot be serialized.

See: https://github.com/filipblondeel/imflog-schema-registry-plugin_issue-179/blob/with-output-set/build.gradle.kts

Hey, sorry for the delay, found a couple minutes today to look at some issues of this project.
Looking quickly at your example I think It may be related to the fact that MetadataExtension and DownloadSubjects are Kotlin data classes, which are not Serializable and they are passed as Input of the Gradle task.

If we migrate those data classes to Classes that implement Serializable we might be able to use the task caching correclty.
Might want to not cache the cases where we pass -1 for version as it means we want to resolve the version at each run.

If you want to throw a PR starting only on the DownloadTask for instance to validate this, that would be great !
If not I will work on this next when I get the chance 😅