Skip to content

build(oss-licenses): upgrade to Gradle 9.4 and enable full build cache support#384

Merged
timothyfroehlich merged 7 commits intomainfrom
g94-build-cache
Mar 11, 2026
Merged

build(oss-licenses): upgrade to Gradle 9.4 and enable full build cache support#384
timothyfroehlich merged 7 commits intomainfrom
g94-build-cache

Conversation

@timothyfroehlich
Copy link
Member

@timothyfroehlich timothyfroehlich commented Mar 10, 2026

Description

This PR is stacked on top of #383. It upgrades the project to Gradle 9.4.0 and implements full build cache support for the oss-licenses-plugin.

Key Technical Changes

  1. Gradle 9.4.0 Upgrade: Upgraded the wrapper in the oss-licenses-plugin project to the latest stable release. Note that Gradle 9.4 now defaults to stricter plugin validation for all published plugins, which our tasks now fully satisfy.
  2. Build Cache Optimization:
    • Added @CacheableTask to DependencyTask and LicensesTask.
    • Applied @Nested and @PathSensitive(PathSensitivity.NONE) to all relevant inputs to ensure relocatability.
  3. Automated Relocatability Verification: Added a new testRelocatability() suite to EndToEndTest.kt that programmatically verifies the build cache is reused even when cloning the project into different directory locations.
  4. Modernized Test Matrix: Updated the E2E test matrix to follow the latest Stable, RC, and Alpha releases of the Android Gradle Plugin.
  5. Stability & Performance: Increased Gradle daemon memory limits (Xmx2048m, MaxMetaspaceSize1024m) to handle intensive parallel E2E tests on large machines.

Related Issues

Closes #356

Gradle 9.x identifies the custom LicensesCleanUpTask as a hard failure due to implicit dependency conflicts with generation tasks. Standard Gradle 'clean' (Delete) already handles the build directory idiomatically.

- Removed LicensesCleanUpTask.groovy and its corresponding test.
- Refactored EndToEndTest.kt to use a createRunner() helper with forwardOutput() and strict configuration cache validation.
- Optimized parallel test execution by isolating TestKit directories per test class.
- Updated build.gradle.kts with optimized heap settings and live test event logging.
- Added .kotlin/ to .gitignore to prevent tracking of local metadata.

Closes #356, #300, #299
…e support

This update modernizes the build environment and ensures task outputs are correctly cached and relocatable.

- Upgraded Gradle wrapper to 9.4.0 in oss-licenses-plugin.
- Added @CacheableTask, @nested, and @PathSensitive annotations to core tasks.
- Implemented an automated relocatability test in EndToEndTest.kt.
- Verified 100% parallel throughput with isolated TestKit directories.

Closes #356
…racks

Updated the E2E test matrix to cover the latest AGP tracks:
- Stable: AGP 9.0.1
- RC: AGP 9.1.0-rc01
- Alpha: AGP 9.2.0-alpha02

Also updated Kotlin version expectation logic to correctly handle AGP 9.1 and 9.2.
@timothyfroehlich timothyfroehlich self-assigned this Mar 10, 2026
@timothyfroehlich timothyfroehlich changed the base branch from main to remove-clean March 10, 2026 04:52
Increased Xmx to 2048m and MaxMetaspaceSize to 1024m to prevent daemon resets during intensive parallel E2E tests.
Refactored testRelocatability to use the setupProject helper, ensuring project structure consistency across cloned directories.
Modified populate() in testRelocatability() to explicitly skip build/ and .gradle/ directories during copying.
This guarantees that the relocated projects start from a pristine state, correctly verifying cache relocation instead of hitting UP-TO-DATE due to accidental output duplication.
xyarco
xyarco previously approved these changes Mar 10, 2026
@timothyfroehlich timothyfroehlich changed the base branch from remove-clean to main March 10, 2026 16:03
@timothyfroehlich timothyfroehlich dismissed xyarco’s stale review March 10, 2026 16:03

The base branch was changed.

Resolved conflicts in EndToEndTest.kt by preserving modernization and relocatability logic while integrating the clean task removal from main.
@timothyfroehlich timothyfroehlich requested a review from xyarco March 10, 2026 17:00
@timothyfroehlich timothyfroehlich merged commit a707e11 into main Mar 11, 2026
6 checks passed
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

3 participants