proguard icon indicating copy to clipboard operation
proguard copied to clipboard

ProguardTask is incompatible with the configuration cache

Open autonomousapps opened this issue 3 years ago • 2 comments

See https://docs.gradle.org/7.5-rc-1/userguide/configuration_cache.html

Running an instance of ProguardTask with the configuration cache on results in a failure. For example:

$ ./gradlew :mdx:minify --configuration-cache

* What went wrong:
Configuration cache problems found in this build.

4 problems were found storing the configuration cache, 1 of which seems unique.
- Task `:mdx:minify` of type `proguard.gradle.ProGuardTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.5-rc-1/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

See the complete report at file:///.../build/reports/configuration-cache/4vg2suoj0m28s61f63oq9jfjf/7ofh75cdtqvk23hhkaw5evrfh/configuration-cache-report.html
> Invocation of 'Task.project' by task ':mdx:minify' at execution time is unsupported.

And here are the usages, extracted from the stacktraces in the HTML report:

  1. at proguard.gradle.ProGuardTask.extendClassPath(ProGuardTask.java:1591)
  2. at proguard.gradle.ProGuardTask.getConfiguration(ProGuardTask.java:1486)

These usages are basically

ConfigurableFileCollection fileCollection = getProject().files(files)

Where it is getProject() that is "illegal" to call, at execution time, with configuration cache on.

I am open to PRing a fix for this, but I wanted to open an issue first to see what the appetite would be for an external contribution.

autonomousapps avatar Jun 01 '22 19:06 autonomousapps

Hi @autonomousapps ! Thanks for the report. We'd be very happy to accept a PR that fixes this!

mrjameshamilton avatar Jun 02 '22 07:06 mrjameshamilton

@mrjameshamilton have you had a chance to take a look at the PR I filed 11 days ago?

autonomousapps avatar Jun 25 '22 18:06 autonomousapps

It seems this was released. Which version was it included in? (Looks like 7.3.0) Can this issue be closed?

runningcode avatar May 11 '23 12:05 runningcode

Hi @runningcode ! #258 doesn't add support for configuration cache, it simply marks the task with notCompatibleWithConfigurationCache. So the issue is not really fully solved yet.

mrjameshamilton avatar May 12 '23 11:05 mrjameshamilton