gradle-lint-plugin icon indicating copy to clipboard operation
gradle-lint-plugin copied to clipboard

Add partial Configuration Cache compatibility

Open Nouran-11 opened this issue 5 months ago • 0 comments

Fixes #309

This pull request introduces the foundational work toward making the Nebula Lint plugin compatible with Gradle's Configuration Cache. The changes here are part of my Google Summer of Code 2025 project with Gradle.

The Problem The plugin currently accesses the Project model directly during the task execution phase . This behavior is a direct violation of Configuration Cache rules and prevents Gradle from caching the task graph, leading to slower builds.

The Solution This PR adopts the Data Projection Pattern to decouple linting logic from the live Gradle model and introduces partial Configuration Cache support:

ProjectInfo & ProjectTree: New serializable data classes that act as snapshots of the project state, created at configuration time and injected into tasks as Inputs.

Refactored LintGradleTask and Services: The task logic and supporting services now operate on the projected data instead of directly accessing Project.

Introduced a Supplier<Project> for use in rules that still require access to the live model (e.g., subclasses of ModelAwareGradleLintRule). Calling .get() on this supplier at execution time will break Configuration Cache for that run. It's intended as a temporary measure to support ongoing refactoring.

Next Steps This PR is not the final solution—it introduces partial compatibility. To achieve full compliance, the following work remains:

Refactor Rules Using Project.configurations Move dependency-based rules to consume data via the ProjectInfo or another serializable projection.

Update ModelAwareGradleLintRule Implementations The Supplier<Project> is a transitional mechanism. The rules using it should be rewritten to operate on static snapshots, removing the need for live model access.

Nouran-11 avatar Jul 17 '25 19:07 Nouran-11