vanniktech / gradle-android-apk-size-plugin

Gradle plugin that generates CSV files with apk size per output and variant of an apk
http://vanniktech.com
Apache License 2.0
84 stars 14 forks source link

Incompatibility issue with Gradle configuration cache #96

Open CristianGM opened 4 years ago

CristianGM commented 4 years ago

The configuration cache is a feature that significantly improves build performance by caching the result of the configuration phase and reusing this for subsequent builds.

Implementing support for the configuration cache in this plugin would improve users experience.

See https://docs.gradle.org/nightly/userguide/configuration_cache.html

The configuration cache will be introduced in Gradle 6.6. But this can already be tested using 6.6-milestone-2.

Running the last Gradle Nightly + Kotlin 14-M3 + AGP 4.1.0-beta03 everything is working fine until we enable this plugin.

When I run ./gradlew assembleRelease, and the configuration doesn't come from the cache, Gradle reports this warning:

⌄ task:app:assembleRelease📋 of type org.gradle.api.DefaultTask📋
⌄ fieldactions📋 of org.gradle.api.DefaultTask📋
⌄ bean of type org.gradle.api.internal.AbstractTask$ClosureTaskAction📋
⌄ fieldclosure📋 of org.gradle.api.internal.AbstractTask$ClosureTaskAction📋
⌄ bean of type com.vanniktech.android.apk.size.ApkSizePlugin$_applyAndroidProject_closure1$_closure2$_closure3📋
⌄ fieldtask📋 of com.vanniktech.android.apk.size.ApkSizePlugin$_applyAndroidProject_closure1$_closure2$_closure3📋
⌄ bean of type groovy.lang.Reference📋
⌄ fieldvalue📋 of groovy.lang.Reference📋
â–  cannot serialize object of type com.vanniktech.android.apk.size.ApkSizeTaskđź“‹, a subtype of org.gradle.api.Taskđź“‹, as these are not supported with the configuration cache.

as consequence of that, once it tries to run from a cached configuration the build fails with:

* What went wrong:
Execution failed for task ':Leboncoin:assembleRelease'.
> Cannot invoke method sizeApk() on null object
vanniktech commented 4 years ago

Mind creating a PR to fix this?

vanniktech commented 4 years ago

Being honest, I've entirely stopped using this plugin and I don't know if anyone is actually using it. (Probably they should not; and use the new proper 'public' API's from AGP 4.0/4.1)