-
-
Notifications
You must be signed in to change notification settings - Fork 133
Description
Plugin version
2.19.0
Gradle version
8.7
JDK version
Eclipse Temurin OpenJDK Runtime Environment 21.0.4+7-LTS
** Describe the bug **
Remote and local Gradle build cache misses occur for the findDeclarations task from the @autonomousapps/dependency-analysis-gradle-plugin, even when inputs, outputs, and code are unchanged. This prevents cache hits between CI and local, and between builds on different machines. The issue is traced to the use of object references (e.g., ModuleInfo@5f9863a7) in the task’s @input properties, resulting in non-deterministic cache keys.
** To Reproduce **
Apply the com.autonomousapps.dependency-analysis plugin with a custom dependencyAnalysis configuration.
Run a build for a subproject (e.g., ./gradlew findDeclarations).
Remove the build directory and run the build again.
Observe that the task uses the local cache only if the Gradle daemon remains alive and creates objects in the same order.
Remove the local build cache directory (~/.gradle/caches/build-cache-1/) and rerun the build.
Observe that the task both misses local and remote cache, and only stores the result locally.
Inspect the cache key inputs using a build scan or by printing declarationContainer.mapping; you will see object references with memory addresses that differ between builds.
Expected behavior
For identical project state and code, the findDeclarations task should produce the same cache key every time, resulting in consistent remote and local cache hits across machines and build environments.
Additional context
The input property declarationContainer.mapping contains object references (e.g., ModuleInfo@5f9863a7), whose hash codes or memory addresses differ between JVM executions.
This results in different cache keys for each build, making cache hits impossible across JVMs, machines, or CI systems.
Fixing this requires ensuring that all @Input/@nested properties for the task use stable, serializable, value-based data (e.g., strings, numbers, lists/sets/maps with deterministic ordering and values), not object references.
Build scan comparison between builds with no code changes shows different values for declarationContainer.mapping input.