vlsi / vlsi-release-plugins

A set of plugins to simplify Gradle release tasks
Apache License 2.0
41 stars 13 forks source link

Adopt jandex plugin for Gradle configuration cache #52

Closed snazy closed 2 years ago

snazy commented 2 years ago

Gradle configuration cache has been introduced with Gradle 6.5 and recently improved.

When using the jandex-plugin with

org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache-problems=warn

Gradle complains in the generated configuration cache report (usually under build/reports/configuration-cache in the root project) about JandexTask and JandexProcessResources keeping references to "certain object types" that break the configuration cache - in this case JandexTask and DefaultSourceSet.

This change moves those types out of the serialized state of JandexTask and JandexProcessResources and lets the JandexPlugin push the relevant information using allowed types into the tasks.

Screen shot of such a config cache report without this change: image

vlsi commented 2 years ago

Thanks for looking into this

vlsi commented 2 years ago

For reference, I recently added a configuration-cache test: https://github.com/burrunan/gradle-s3-build-cache/blob/7f6d51f97cd5d80110a514ec007b3e10cbe60752/src/test/kotlin/com/github/burrunan/s3cache/RemoteCacheTest.kt#L198

vlsi commented 2 years ago

@snazy , could you please check https://github.com/vlsi/vlsi-release-plugins/commit/e1e2a23bba660e1bd60168b9e12aa827dbed1efb?

It looks like only onlyIf was impacted so I went with a smaller changeset.

snazy commented 2 years ago

@vlsi just tried it with v1.80 (with your commit) and couldn't reproduce the configuration-cache-warning anymore. Looks like it's fixed now :)