Skip to content

Modernization, Phase 4: Configuration avoidance (lazy APIs)#292

Merged
OdysseusLives merged 3 commits intomainfrom
modernization
Feb 6, 2026
Merged

Modernization, Phase 4: Configuration avoidance (lazy APIs)#292
OdysseusLives merged 3 commits intomainfrom
modernization

Conversation

@OdysseusLives
Copy link
Copy Markdown
Member

Purpose

Replace eager configuration APIs with Gradle’s lazy, configuration-avoidance APIs so that:

  • Build performance: Only configurations and tasks that are actually used get configured.
  • Configuration cache compatibility: Eager .all() and .getByName() force full configuration; lazy APIs avoid that and support the configuration cache.
  • Consistency: The plugin uses the same patterns Gradle recommends for modern builds.

Breaking changes

None. Configuration avoidance does not change plugin behavior or public API. Build scripts and existing usage continue to work as before; the plugin simply configures only what is needed.

Replace eager configuration.all() with lazy configureEach:
- Line 164: Configuration locking logic
- Line 178: Cache disabling for generateLock

Benefits:
- Lazy configuration (only configures when accessed)
- Improves build performance (avoids configuring unused configurations)
- Required for configuration cache compatibility
Replace eager APIs with lazy configuration avoidance APIs:

CoreLockingHelper.groovy:
- Line 145: configurations.all() → configureEach

GenerateLockTask.groovy:
- Line 134: configurations.getByName() → named().get()

PathAwareDiffReportGenerator.kt:
- Line 58: configurations.getByName() → named().get()

Benefits:
- Lazy configuration (only when accessed)
- Better build performance
- Configuration cache compatible
Convert final two .all patterns to configureEach:
- CoreLockingHelper.groovy Line 102: matching { }.all → configureEach
- DependencyResolutionVerifier.kt Line 170: matching { }.all → configureEach
- Fix return@all labels → return@configureEach
@OdysseusLives OdysseusLives merged commit 31868ce into main Feb 6, 2026
3 checks passed
@OdysseusLives OdysseusLives deleted the modernization branch February 6, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant