[ 
https://issues.apache.org/jira/browse/GROOVY-12019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King updated GROOVY-12019:
-------------------------------
    Description: 
h2. Summary

Enables Gradle's configuration cache by default (with CC problems downgraded to 
warnings) and refactors the build to be CC-safe. Targets 
[GROOVY-12019|https://issues.apache.org/jira/browse/GROOVY-12019].

h2. Motivation

Gradle's configuration cache (CC) skips the configuration phase on repeat 
builds, giving a substantial speed-up — especially on incremental compile/test 
cycles. The Groovy build currently breaks CC in several ways:

* {{gradle.taskGraph.whenReady}} hooks (CC cannot serialize the task graph).
* Direct {{System.properties\[...\]}} reads (CC cannot track invalidation).
* Execution-time access to {{Project}} / {{configurations}} from task actions.
* Gradle's legacy OSGi DSL ({{osgi.osgiManifest \{\}}}) captures 
non-serializable state.
* The asciidoctor-gradle-jvm 4.0.5 plugin captures dependency-management state 
in its extension.

This PR removes all of those for the common compile/test paths and gates the 
still-incompatible doc plugins behind opt-in flags so they only apply when 
documentation tasks are requested.

h2. Changes

h3. Build configuration
* {{gradle.properties}}: {{org.gradle.configuration-cache=true}}, 
{{org.gradle.configuration-cache.problems=warn}}.
* Replace {{gradle.taskGraph.whenReady}} usages with 
{{startParameter.taskNames}} introspection ({{SharedConfiguration}}, root 
{{build.gradle}}, {{org.apache.groovy-published-library.gradle}}, 
{{org.apache.groovy-tested.gradle}}).
* Replace {{System.properties\[k\]}} with {{providers.systemProperty(k)}} / 
{{providers.systemPropertiesPrefixedBy(...)}} so CC invalidation tracks {{-D}} 
flag changes.
* Capture {{project.version}}, {{configurations.xxx}}, and other Project state 
at configuration time rather than inside {{doFirst}}/{{doLast}}.
* {{PerformanceTestsExtension}}: model JavaExec args as a 
{{CommandLineArgumentProvider}} with tracked inputs.

h3. OSGi manifest generation ({{JarJarTask}})

Migrated from Gradle's legacy OSGi DSL to BND {{Analyzer}} directly:
* Adds {{biz.aQute.bnd:biz.aQute.bndlib:6.4.1}}.
* New {{bndInstruction(key, value)}} API on {{JarJarTask}}; multiple calls for 
the same key accumulate with comma-separators (correct BND syntax for 
multi-value headers such as {{Require-Capability}}).
* New {{bndClasspath}} input feeds the analyzer for {{Import-Package}} 
resolution.
* {{-removeheaders}} strips BND housekeeping headers ({{Bnd-LastModified}}, 
{{Tool}}, {{Created-By}}, ...) so released jars don't pick up new manifest 
entries.
* Updated call-sites: {{org.apache.groovy-base.gradle}}, 
{{org.apache.groovy-core.gradle}}, {{org.apache.groovy-library.gradle}}.

h3. Documentation plugins (still not CC-compatible upstream)

* {{org.apache.groovy-asciidoctor}} and {{org.asciidoctor.jvm.pdf}} are now 
applied *only* when the requested tasks look like a doc/dist build *and* 
{{src/spec/doc}} exists.
* Asciidoctor tasks are marked {{notCompatibleWithConfigurationCache(...)}} so 
the CC fail-on-store path doesn't trip when docs are built.
* New {{asciidocElements}} consumable variant on the base plugin means non-doc 
consumers still wire correctly (empty artifact when docs aren't built).

h3. Signing
* {{Signing.shouldSign()}} no longer takes a {{TaskExecutionGraph}}; instead 
{{SharedConfiguration}} eagerly inspects {{startParameter.taskNames}} for 
{{artifactoryPublish}} / {{publishAllPublicationsToApacheRepository}}.

h3. Minor
* {{me.champeau.jmh:jmh-gradle-plugin}} 0.7.2 -> 0.7.3.
* {{GroovydocAntPlugin}}: replaces {{project.ant}} with a fresh {{AntBuilder}}, 
models source dirs as task inputs.
* {{verification-metadata.xml}}: updates for the bumped/added build 
dependencies.

h2. Test plan

* Full test suite green (71,219 tests, all 56 checks).
* SonarQube quality gate: 0 new issues.
* Codecov: no regressions (+0.005%).

h2. Notes for reviewers

* {{org.gradle.configuration-cache.problems=warn}} is intentional — the 
documentation plugins still emit CC problems, so {{fail}} would break 
dist/publish builds. Compile/test builds have zero CC problems and benefit from 
the cache as normal.
* Several inline comments explain *why* a particular refactor was needed 
(search for "configuration cache" in the diff) so the constraints survive 
future edits.
* The {{notCompatibleWithConfigurationCache}} call in 
{{org.apache.groovy-asciidoctor.gradle}} should be removed once 
asciidoctor-gradle-jvm ships a CC-compatible release.

> Enable gradle configuration cache
> ---------------------------------
>
>                 Key: GROOVY-12019
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12019
>             Project: Groovy
>          Issue Type: Improvement
>          Components: build
>            Reporter: Daniel Sun
>            Priority: Major
>
> h2. Summary
> Enables Gradle's configuration cache by default (with CC problems downgraded 
> to warnings) and refactors the build to be CC-safe. Targets 
> [GROOVY-12019|https://issues.apache.org/jira/browse/GROOVY-12019].
> h2. Motivation
> Gradle's configuration cache (CC) skips the configuration phase on repeat 
> builds, giving a substantial speed-up — especially on incremental 
> compile/test cycles. The Groovy build currently breaks CC in several ways:
> * {{gradle.taskGraph.whenReady}} hooks (CC cannot serialize the task graph).
> * Direct {{System.properties\[...\]}} reads (CC cannot track invalidation).
> * Execution-time access to {{Project}} / {{configurations}} from task actions.
> * Gradle's legacy OSGi DSL ({{osgi.osgiManifest \{\}}}) captures 
> non-serializable state.
> * The asciidoctor-gradle-jvm 4.0.5 plugin captures dependency-management 
> state in its extension.
> This PR removes all of those for the common compile/test paths and gates the 
> still-incompatible doc plugins behind opt-in flags so they only apply when 
> documentation tasks are requested.
> h2. Changes
> h3. Build configuration
> * {{gradle.properties}}: {{org.gradle.configuration-cache=true}}, 
> {{org.gradle.configuration-cache.problems=warn}}.
> * Replace {{gradle.taskGraph.whenReady}} usages with 
> {{startParameter.taskNames}} introspection ({{SharedConfiguration}}, root 
> {{build.gradle}}, {{org.apache.groovy-published-library.gradle}}, 
> {{org.apache.groovy-tested.gradle}}).
> * Replace {{System.properties\[k\]}} with {{providers.systemProperty(k)}} / 
> {{providers.systemPropertiesPrefixedBy(...)}} so CC invalidation tracks 
> {{-D}} flag changes.
> * Capture {{project.version}}, {{configurations.xxx}}, and other Project 
> state at configuration time rather than inside {{doFirst}}/{{doLast}}.
> * {{PerformanceTestsExtension}}: model JavaExec args as a 
> {{CommandLineArgumentProvider}} with tracked inputs.
> h3. OSGi manifest generation ({{JarJarTask}})
> Migrated from Gradle's legacy OSGi DSL to BND {{Analyzer}} directly:
> * Adds {{biz.aQute.bnd:biz.aQute.bndlib:6.4.1}}.
> * New {{bndInstruction(key, value)}} API on {{JarJarTask}}; multiple calls 
> for the same key accumulate with comma-separators (correct BND syntax for 
> multi-value headers such as {{Require-Capability}}).
> * New {{bndClasspath}} input feeds the analyzer for {{Import-Package}} 
> resolution.
> * {{-removeheaders}} strips BND housekeeping headers ({{Bnd-LastModified}}, 
> {{Tool}}, {{Created-By}}, ...) so released jars don't pick up new manifest 
> entries.
> * Updated call-sites: {{org.apache.groovy-base.gradle}}, 
> {{org.apache.groovy-core.gradle}}, {{org.apache.groovy-library.gradle}}.
> h3. Documentation plugins (still not CC-compatible upstream)
> * {{org.apache.groovy-asciidoctor}} and {{org.asciidoctor.jvm.pdf}} are now 
> applied *only* when the requested tasks look like a doc/dist build *and* 
> {{src/spec/doc}} exists.
> * Asciidoctor tasks are marked {{notCompatibleWithConfigurationCache(...)}} 
> so the CC fail-on-store path doesn't trip when docs are built.
> * New {{asciidocElements}} consumable variant on the base plugin means 
> non-doc consumers still wire correctly (empty artifact when docs aren't 
> built).
> h3. Signing
> * {{Signing.shouldSign()}} no longer takes a {{TaskExecutionGraph}}; instead 
> {{SharedConfiguration}} eagerly inspects {{startParameter.taskNames}} for 
> {{artifactoryPublish}} / {{publishAllPublicationsToApacheRepository}}.
> h3. Minor
> * {{me.champeau.jmh:jmh-gradle-plugin}} 0.7.2 -> 0.7.3.
> * {{GroovydocAntPlugin}}: replaces {{project.ant}} with a fresh 
> {{AntBuilder}}, models source dirs as task inputs.
> * {{verification-metadata.xml}}: updates for the bumped/added build 
> dependencies.
> h2. Test plan
> * Full test suite green (71,219 tests, all 56 checks).
> * SonarQube quality gate: 0 new issues.
> * Codecov: no regressions (+0.005%).
> h2. Notes for reviewers
> * {{org.gradle.configuration-cache.problems=warn}} is intentional — the 
> documentation plugins still emit CC problems, so {{fail}} would break 
> dist/publish builds. Compile/test builds have zero CC problems and benefit 
> from the cache as normal.
> * Several inline comments explain *why* a particular refactor was needed 
> (search for "configuration cache" in the diff) so the constraints survive 
> future edits.
> * The {{notCompatibleWithConfigurationCache}} call in 
> {{org.apache.groovy-asciidoctor.gradle}} should be removed once 
> asciidoctor-gradle-jvm ships a CC-compatible release.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to