asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
286 stars 122 forks source link

Configuration cache improvements #558

Closed lptr closed 4 years ago

lptr commented 4 years ago

Changes to make the Asciidoctor plugin compatible with Gradle's configuration cache feature.

lptr commented 4 years ago

We are down from 57 errors reported by configuration cache to 36 at this point.

eskatos commented 4 years ago

This PR is based on master. It should be based on development-3.x instead as explained in this repository's README.

The changes in this PR make use of internal Gradle APIs.

I took a closer look at what it would take to make this plugin work with the configuration cache and the main issue is with accessing the project at execution time. It's done all over the place.

Many cases can simply be fixed by using injected services instead, working with files, executing java programs etc... Those are pretty simple to fix.

BUT, a lot of the tasks gather their configuration at runtime from task and project extensions using some helpers from the grolifant project. This not only makes it hard to detangle from the project because of the required dance between the two projects to fix things, but it's also a sign that the tasks do too much of configuration. If the plugin was responsible for wiring all the task inputs instead then things would be simpler, most probably with more complex inputs though.

Finally there's the usage of detached configurations created at runtime, dependency instances created at runtime etc... This simply can't be done with the configuration cache enabled. It could be modelled differently as proper input properties but it will require some work.

All in all I think this PR should be dropped in favor of a more sensible approach.

I opened https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/564