Skip to content

Improve task relocatability in Detekt and Protobuf plugins#49842

Open
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
erichaagdev:improve-build-relocatability
Open

Improve task relocatability in Detekt and Protobuf plugins#49842
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
erichaagdev:improve-build-relocatability

Conversation

@erichaagdev
Copy link
Copy Markdown
Contributor

Overview

This PR improves build cache relocatability by fixing cross-machine cache misses in the Detekt and Protobuf tasks. Previously, absolute paths were leaking into task inputs, causing unnecessary cache invalidation between different environments (e.g., CI servers vs. local developer machines).

Changes

Impact

Normalizing these inputs ensures both tasks are fully relocatable. This will maximize remote build cache hits and prevent duplicate work across environments.

References

Configures the `basePath` on Detekt tasks to use a relative path from
the root project. This prevents absolute paths from being used during
analysis, avoiding cross-machine build cache misses and ensuring the
task is fully relocatable.

See: detekt/detekt#7170

Signed-off-by: Eric Haag <ehaag@gradle.com>
Clears the `javaExecutablePath` on the Protobuf extension. This prevents
absolute Java installation paths from being tracked as task inputs,
avoiding cross-machine build cache misses and ensuring the task is fully
relocatable. This is safe because `protoc` and `grpc` are configured
to use native binaries rather than executable JARs.

See: google/protobuf-gradle-plugin#785

Signed-off-by: Eric Haag <ehaag@gradle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants