👋 Hello, I'm an engineer at Gradle and I came across your project in the scope of another project opentelemetry-java-instrumentation.
The Gradle Configuration Cache enables faster build times by caching task configuration on the local file system. This pull request does makes the JFlex task compatible with the configuration cache by changing the structure of the task so that it is better understood by Gradle at configuration time. This includes:
Adding a test to verify the task is compatible with the configuration task
Modifying the JFlexPlugin to not rely on afterEvaluate
Extract usage of SourceSet from the JFlexTask at execution time per recommendations here
Remove usage of project invocations at project execution time. This required re-wiring the task inputs into a slightly more idiomatic way. Tasks aren't supposed to reference extensions directly but rather plugins have the responsibility of mapping extension properties to task inputs.
A slightly more idiomatic approach would be to remove the JFlexExtension altogether and instead have users configure the JFlexTask directly using the following code:
tasks.withType<org.xbib.gradle.plugin.JFlexTask>() {
// configuration here with sensible defaults defined in `JFlexTask`
}
but that would cause a breaking change for users who currently configure this plugin via the extension, which isn't ideal. I think the current approach is reasonable.
👋 Hello, I'm an engineer at Gradle and I came across your project in the scope of another project opentelemetry-java-instrumentation.
The Gradle Configuration Cache enables faster build times by caching task configuration on the local file system. This pull request does makes the JFlex task compatible with the configuration cache by changing the structure of the task so that it is better understood by Gradle at configuration time. This includes:
JFlexPlugin
to not rely onafterEvaluate
SourceSet
from theJFlexTask
at execution time per recommendations hereproject
invocations at project execution time. This required re-wiring the task inputs into a slightly more idiomatic way. Tasks aren't supposed to reference extensions directly but rather plugins have the responsibility of mapping extension properties to task inputs.A slightly more idiomatic approach would be to remove the
JFlexExtension
altogether and instead have users configure theJFlexTask
directly using the following code:but that would cause a breaking change for users who currently configure this plugin via the extension, which isn't ideal. I think the current approach is reasonable.