cosmicsilence / gradle-scalafix

Gradle plugin for Scalafix
BSD 3-Clause "New" or "Revised" License
27 stars 5 forks source link

Support gradle's configuration cache #83

Open tnielens opened 5 months ago

tnielens commented 5 months ago

When I try to enable the configuration cache, gradle fails on scalafix tasks. I've got several occurrences of these errors:

- Task `:apps:configSemanticDBMain` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: cannot deserialize object of type 'org.gradle.api.Project' as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.7/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:apps:configSemanticDBMain` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: cannot deserialize object of type 'org.gradle.api.Task' as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.7/userguide/configuration_cache.html#config_cache:requirements:task_access
- Task `:apps:configSemanticDBMain` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: cannot deserialize object of type 'org.gradle.api.tasks.SourceSet' as these are not supported with the configuration cache.
marcelocenerine commented 4 months ago

Thanks for reporting this. The issue seems to be caused by the fact that ScalaSourceSet is being passed as input to ConfigSemanticDbTask. I believe that could be avoided if the code is restructured a bit.

@fsanjuan is this something you would be interested in looking into?

marcelocenerine commented 4 months ago

Well, there's more to that than the serialization issues:

Configuration cache problems found in this build.

13 problems were found storing the configuration cache, 5 of which seem unique.
- Task `:scala-module:configSemanticDBCustomScalafixRule` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:scala-module:configSemanticDBMain` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:scala-module:configSemanticDBTest` of type `io.github.cosmicsilence.scalafix.ConfigSemanticDbTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:scala-module:scalafixCustomScalafixRule` of type `io.github.cosmicsilence.scalafix.ScalafixTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:scala-module:scalafixMain` of type `io.github.cosmicsilence.scalafix.ScalafixTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution