tbroyer / gradle-errorprone-plugin

Gradle plugin to use the error-prone compiler for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradle Error Prone Plugin breaks with Instant Execution

stephanenicolas opened this issue · comments

Using instant execution (a.k.a configuration caching), using following versions, I got :

  • AGP:4.1.0-alpha09
  • Kotlin:1.3.72
  • Gradle:6.5-20200519143217+0000
2 instant execution problems were found.
- field '$javacConfiguration' from type 'net.ltgt.gradle.errorprone.ErrorPronePlugin$apply$1': cannot deserialize object of type 'org.gradle.api.artifacts.Configuration' as these are not supported with instant execution.
  See https://docs.gradle.org/6.5-20200519143217+0000/userguide/configuration_cache.html#disallowed_types
- field '$javacConfiguration' from type 'net.ltgt.gradle.errorprone.ErrorPronePlugin$apply$1': value 'file collection' is not assignable to 'org.gradle.api.artifacts.Configuration'

For gradle command:
./gradlew -Dorg.gradle.unsafe.instant-execution.fail-on-problems=false -Dorg.gradle.unsafe.instant-execution=true -Dorg.gradle.unsafe.instant-execution.max-problems=655360 --no-scan :app:build

Basically: configurations are not allowed as inputs of task with instant execution. Solutions are:

  • replace it by an ArtifactView or a file collection. They are supported.
  • use any serializable class instead.

Here is an example of resolution for another plugin: square/wire#1560

Running preliminary tests (i.e. building the project and running the tests with -Ptest.gradle-version=6.5-20200522062645+0000, and JDK 8, and changing them to pass the new --configuration-cache=on), it looks like declaring the variable of type FileCollection (while still assigning a Configuration to it) would be enough (as documented here)
Note that using JDK 9+ wouldn't trigger the issue.

I tested ac12999 locally with the latest snapshot (and verified in the report that the test was actually run, and not ignored).
I'll wait for 6.5-rc-1 to be actually released (hopefully tomorrow) to cut a new release though (which also takes into account the com.android.dynamic-feature plugin)

In case you hadn't seen it, I released v1.2.0 a couple days ago, and added 6.5-rc-1 to the test matrix.