Skip to content

build: upgrade to Gradle 9.4.0 and optimize build performance#382

Closed
timothyfroehlich wants to merge 1 commit intomainfrom
modernize-gradle-9.4
Closed

build: upgrade to Gradle 9.4.0 and optimize build performance#382
timothyfroehlich wants to merge 1 commit intomainfrom
modernize-gradle-9.4

Conversation

@timothyfroehlich
Copy link
Member

@timothyfroehlich timothyfroehlich commented Mar 10, 2026

This PR modernizes the oss-licenses-plugin for Gradle 9.4 compatibility and enables full support for the Gradle Build Cache.

Key Technical Improvements:

  1. Resolved Implicit Dependency Failures:
    Gradle 9.x promotes 'Implicit Dependencies' to a hard failure. We identified a conflict where the custom LicensesCleanUpTask and the generation tasks were fighting over the build directory. Since the generated files reside within the build/ directory, the standard Gradle clean task (which deletes the entire folder) already handles this idiomatically. This PR removes the redundant cleanup logic, resolving the validation error (fixing oss-licenses-plugin fails clean build #356, Plugin com.google.android.gms.oss-licenses-plugin is not compatible with Gradle's configuration cache #300, and OSS Licences Plugin fails with Gradle 8.8 #299).

  2. Full Build Cache Support:
    Formally opted-in to @CacheableTask for DependencyTask and LicensesTask. We implemented strict property normalization using @PathSensitive(PathSensitivity.NONE) and @Nested annotations to ensure the tasks are pure, relocatable functions (completing Support for Configuration cache #246).

  3. Refactored for Laziness:
    Refactored artifact resolution to use the Gradle Provider API. This moves away from eager configuration and addresses technical debt identified in previous reviews, improving configuration phase performance.

  4. Modernized E2E Test Matrix:
    Expanded the test suite to include AGP 9.0 (Stable), 9.1 (RC), and 9.2 (Alpha). Enabled strict configuration cache validation (problems=fail) across the entire 88-test matrix to ensure long-term stability.

Closes #356, #300, #299, #246.

This commit modernizes the oss-licenses-plugin for Gradle 9.4 compatibility and enables full support for the Gradle Build Cache.

Key issues resolved:
- Implicit Dependency Failures: Gradle 9.x enforces strict task graph validation. The redundant LicensesCleanUpTask was removed because it conflicted with generation tasks over the build directory. Standard 'clean' now handles this idiomatically.
- Plugin Validation Errors: Modernized tasks to pass 'validatePlugins' by opting into @CacheableTask and implementing property normalization with @PathSensitive.
- Technical Debt: Refactored artifact resolution to use the Lazy Provider API, addressing feedback from PR #365 and improving configuration phase performance.
- Test Matrix: Modernized E2E tests to include AGP 9.0/9.1/9.2 and enabled strict configuration cache validation across the matrix.

Closes #356, #300, #299, #246.
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.

oss-licenses-plugin fails clean build

1 participant