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

Adam Saghy updated FINERACT-2853:
---------------------------------
    Description: 
h2. Description

Enables the Gradle configuration cache 
({{{}org.gradle.configuration-cache=true{}}}) for local builds. It had been 
disabled with a "temporarily disabled until we fix compatibility" note. CI 
keeps it off, because fresh runners using {{{}--no-daemon{}}}gain nothing from 
it.

Local development loops (compiling, module tests, the client modules, the 
quality checks, {{{}bootRun{}}}/{{{}devRun{}}}) now store the configuration 
cache and reuse it, including from a fresh daemon. A warm rebuild of 
{{:fineract-provider:compileJava}} goes from about 19s to about 1s.
h3. Build-script fixes for the configuration cache
 * {{{}static-weaving.gradle{}}}: the managed-class lookup is now a lazy 
provider, and the helpers moved into a plain class. The old code called 
{{Task.project}} and script methods from {{{}doLast{}}}.
 * {{{}fineract-provider{}}}, {{{}fineract-client{}}}, 
{{{}fineract-client-feign{}}}: {{{}copy{}}}/{{{}delete{}}}/{{{}fileTree{}}} in 
task actions now go through the injected {{{}FileSystemOperations{}}}.
 * {{fineract-doc}} {{{}doc{}}}, and {{{}checkBreakingChanges.onlyIf{}}}: 
values are captured at configuration time.
 * {{{}aggregateLicenseReport{}}}: the {{rename}} closure no longer captures a 
{{{}Project{}}}.

h3. Plugins that cannot support it are marked 
{{notCompatibleWithConfigurationCache}}
 * jk1 license report, jib, asciidoctor, the 
{{{}fineractRelease*{}}}/{{{}fineractDocPublish{}}} tasks, and the database 
admin tasks ({{{}createDB{}}}, {{{}createPGDB{}}}, …).
 * Builds that include these tasks fall back to running without the cache 
instead of failing. A full {{./gradlew build}} still includes jk1 and 
asciidoctor, through the binary distribution.

h3. Plugin replacements and upgrades
 * *git-versioning replaced with {{GitVersionValueSource}} (buildSrc).* The old 
plugin spawns git processes while the build configures. The new class ports its 
logic for our configuration: release/maintenance branch and tag rules, the 
ancestor walk and tag ordering, CI branch detection, {{-Dgit.*}} and 
{{VERSIONING_*}} overrides, and linked worktrees. The plugin's unused 
{{version}} task is gone.
 * *Spotless 6.25.0 → 8.10.2.* 6.x fails with "JVM-local cache is stale" when 
the cache is reused from a new daemon. The formatters are pinned to 4.29, the 
versions 6.25 used by default on JDK 25, so no code is reformatted. 
{{indentWithSpaces}} is replaced by {{{}leadingTabsToSpaces{}}}, which behaves 
identically.
 * *{{com.github.hierynomus.license}} (unmaintained since 2021) replaced with 
Spotless license headers.*
 ** Headers are still generated from {{{}APACHE_LICENSETEXT.md{}}}, for Java, 
XML, properties, Velocity and JSP. That's the same set of files hierynomus 
enforced, plus 287 files that already had correct headers.
 ** {{spotlessApply}} adds a missing header and never rewrites anything below 
one. A malformed header fails {{{}spotlessCheck{}}}.
 ** Also removed: the plugin's no-op {{licenseFormatMain}} wiring, and the 
{{spring-core:6.2.18}} buildscript pin that existed only for it.
 ** 8 Java files had a stray blank line before the header, or a malformed one. 
Each is fixed with a one-line deletion.
 * *jk1 dependency-license-report 2.9 → 3.1.4* (2.x is end-of-life).
 ** The bundled license texts are identical.
 ** The per-module index pages show manifest-declared licenses more cleanly; no 
dependency's license changes.
 ** {{generateLicenseReport}} now depends on the jars it reads, which fixes an 
intermittent {{ZipException: zip END header not found}} in parallel builds.

h3. CI
 * {{.github/scripts/gradle-memory-budget.sh}} writes 
{{{}org.gradle.configuration-cache=false{}}}.
 * The two workflows that don't use it pass {{{}--no-configuration-cache{}}}.

h3. Notes for reviewers
 * To opt out locally, pass {{{}--no-configuration-cache{}}}.
 * {{{}licenseFormat{}}}/{{{}licenseMain{}}} no longer exist. Use 
{{{}spotlessApply{}}}/{{{}spotlessCheck{}}} instead.
 * {{git.properties}} (actuator git info) is unaffected. It comes from 
gradle-git-properties.

h3. Verification
 * *Versions:* {{GitVersionValueSource}} matched the old plugin's output in 34 
git scenarios, run side by side in a scratch clone. They cover develop, 
release/maintenance branches, tags, commits with several tags, 
GitHub/GitLab/Jenkins environments, overrides, worktrees, and shallow, empty 
and missing repositories.
 * *Outputs:* generated outputs are identical to develop: {{persistence.xml}} 
(15 modules), the swagger input YAML, the generated clients, and the bundled 
license texts.
 * *Spotless:* repo-wide {{spotlessCheck}} passes with no changes. Throwaway 
files confirmed that missing and malformed headers are detected and fixed, and 
that nothing after a header is ever changed.
 * *CI task groups, with and without the cache:* quality checks, 
package/war/shadowJar, unit tests, license report/CycloneDX, doc, jib 
({{{}jibBuildTar{}}}), cucumber, {{{}checkBreakingChanges{}}}, and 
{{{}devRun{}}}/{{{}bootRun{}}} (dry run).
 * *Not tested:* sonar, pushing a jib image, tasks that need a database 
(integration tests, e2e cucumber, {{{}createPGDB{}}}), and the release steps.

  was:TODO


> Enable Gradle configuration cache for local builds
> --------------------------------------------------
>
>                 Key: FINERACT-2853
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2853
>             Project: Apache Fineract
>          Issue Type: Improvement
>    Affects Versions: 1.15.0
>            Reporter: Adam Saghy
>            Assignee: Adam Saghy
>            Priority: Major
>
> h2. Description
> Enables the Gradle configuration cache 
> ({{{}org.gradle.configuration-cache=true{}}}) for local builds. It had been 
> disabled with a "temporarily disabled until we fix compatibility" note. CI 
> keeps it off, because fresh runners using {{{}--no-daemon{}}}gain nothing 
> from it.
> Local development loops (compiling, module tests, the client modules, the 
> quality checks, {{{}bootRun{}}}/{{{}devRun{}}}) now store the configuration 
> cache and reuse it, including from a fresh daemon. A warm rebuild of 
> {{:fineract-provider:compileJava}} goes from about 19s to about 1s.
> h3. Build-script fixes for the configuration cache
>  * {{{}static-weaving.gradle{}}}: the managed-class lookup is now a lazy 
> provider, and the helpers moved into a plain class. The old code called 
> {{Task.project}} and script methods from {{{}doLast{}}}.
>  * {{{}fineract-provider{}}}, {{{}fineract-client{}}}, 
> {{{}fineract-client-feign{}}}: {{{}copy{}}}/{{{}delete{}}}/{{{}fileTree{}}} 
> in task actions now go through the injected {{{}FileSystemOperations{}}}.
>  * {{fineract-doc}} {{{}doc{}}}, and {{{}checkBreakingChanges.onlyIf{}}}: 
> values are captured at configuration time.
>  * {{{}aggregateLicenseReport{}}}: the {{rename}} closure no longer captures 
> a {{{}Project{}}}.
> h3. Plugins that cannot support it are marked 
> {{notCompatibleWithConfigurationCache}}
>  * jk1 license report, jib, asciidoctor, the 
> {{{}fineractRelease*{}}}/{{{}fineractDocPublish{}}} tasks, and the database 
> admin tasks ({{{}createDB{}}}, {{{}createPGDB{}}}, …).
>  * Builds that include these tasks fall back to running without the cache 
> instead of failing. A full {{./gradlew build}} still includes jk1 and 
> asciidoctor, through the binary distribution.
> h3. Plugin replacements and upgrades
>  * *git-versioning replaced with {{GitVersionValueSource}} (buildSrc).* The 
> old plugin spawns git processes while the build configures. The new class 
> ports its logic for our configuration: release/maintenance branch and tag 
> rules, the ancestor walk and tag ordering, CI branch detection, {{-Dgit.*}} 
> and {{VERSIONING_*}} overrides, and linked worktrees. The plugin's unused 
> {{version}} task is gone.
>  * *Spotless 6.25.0 → 8.10.2.* 6.x fails with "JVM-local cache is stale" when 
> the cache is reused from a new daemon. The formatters are pinned to 4.29, the 
> versions 6.25 used by default on JDK 25, so no code is reformatted. 
> {{indentWithSpaces}} is replaced by {{{}leadingTabsToSpaces{}}}, which 
> behaves identically.
>  * *{{com.github.hierynomus.license}} (unmaintained since 2021) replaced with 
> Spotless license headers.*
>  ** Headers are still generated from {{{}APACHE_LICENSETEXT.md{}}}, for Java, 
> XML, properties, Velocity and JSP. That's the same set of files hierynomus 
> enforced, plus 287 files that already had correct headers.
>  ** {{spotlessApply}} adds a missing header and never rewrites anything below 
> one. A malformed header fails {{{}spotlessCheck{}}}.
>  ** Also removed: the plugin's no-op {{licenseFormatMain}} wiring, and the 
> {{spring-core:6.2.18}} buildscript pin that existed only for it.
>  ** 8 Java files had a stray blank line before the header, or a malformed 
> one. Each is fixed with a one-line deletion.
>  * *jk1 dependency-license-report 2.9 → 3.1.4* (2.x is end-of-life).
>  ** The bundled license texts are identical.
>  ** The per-module index pages show manifest-declared licenses more cleanly; 
> no dependency's license changes.
>  ** {{generateLicenseReport}} now depends on the jars it reads, which fixes 
> an intermittent {{ZipException: zip END header not found}} in parallel builds.
> h3. CI
>  * {{.github/scripts/gradle-memory-budget.sh}} writes 
> {{{}org.gradle.configuration-cache=false{}}}.
>  * The two workflows that don't use it pass {{{}--no-configuration-cache{}}}.
> h3. Notes for reviewers
>  * To opt out locally, pass {{{}--no-configuration-cache{}}}.
>  * {{{}licenseFormat{}}}/{{{}licenseMain{}}} no longer exist. Use 
> {{{}spotlessApply{}}}/{{{}spotlessCheck{}}} instead.
>  * {{git.properties}} (actuator git info) is unaffected. It comes from 
> gradle-git-properties.
> h3. Verification
>  * *Versions:* {{GitVersionValueSource}} matched the old plugin's output in 
> 34 git scenarios, run side by side in a scratch clone. They cover develop, 
> release/maintenance branches, tags, commits with several tags, 
> GitHub/GitLab/Jenkins environments, overrides, worktrees, and shallow, empty 
> and missing repositories.
>  * *Outputs:* generated outputs are identical to develop: {{persistence.xml}} 
> (15 modules), the swagger input YAML, the generated clients, and the bundled 
> license texts.
>  * *Spotless:* repo-wide {{spotlessCheck}} passes with no changes. Throwaway 
> files confirmed that missing and malformed headers are detected and fixed, 
> and that nothing after a header is ever changed.
>  * *CI task groups, with and without the cache:* quality checks, 
> package/war/shadowJar, unit tests, license report/CycloneDX, doc, jib 
> ({{{}jibBuildTar{}}}), cucumber, {{{}checkBreakingChanges{}}}, and 
> {{{}devRun{}}}/{{{}bootRun{}}} (dry run).
>  * *Not tested:* sonar, pushing a jib image, tasks that need a database 
> (integration tests, e2e cucumber, {{{}createPGDB{}}}), and the release steps.



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

Reply via email to