diktat icon indicating copy to clipboard operation
diktat copied to clipboard

diktat-gradle-plugin is not compatible with Gradle Configuration Cache

Open illarionov opened this issue 1 year ago • 3 comments

It would be nice to have Gradle Configuration Cache Support in diktat-gradle-plugin. Now I get this error when running the :diktatCheck task wih Gradle Configuration Cache enabled:

2 problems were found storing the configuration cache, 1 of which seems unique.
- Task `:diktatCheck` of type `org.cqfn.diktat.plugin.gradle.DiktatJavaExecTaskBase`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

Diktat version: 1.2.5

illarionov avatar Sep 15 '23 03:09 illarionov

hi @illarionov, we will look into it in scope of diktat 2.0

nulls avatar Sep 15 '23 06:09 nulls

For the time being, it is possible to add:

tasks.named("diktatFix") {
    notCompatibleWithConfigurationCache("https://github.com/saveourtool/diktat/issues/1732")
}

to your build.gradle. Which obviously doesn't provide support for configuration cache. But at least, allows gradle to run it

@nulls maybe you should consider this adding this as workaround for people with configuration cache enabled. As it stops from using diktat in some configurations. For example, in mine, I run formatter on every build

ForsHant avatar Jan 12 '24 10:01 ForsHant

For the time being, it is possible to add:

tasks.named("diktatFix") {
    notCompatibleWithConfigurationCache("https://github.com/saveourtool/diktat/issues/1732")
}

to your build.gradle. Which obviously doesn't provide support for configuration cache. But at least, allows gradle to run it

@nulls maybe you should consider this adding this as workaround for people with configuration cache enabled. As it stops from using diktat in some configurations. For example, in mine, I run formatter on every build

@ForsHant thanks for a tip. Will add it to README.md

nulls avatar Jan 15 '24 08:01 nulls