Improve task relocatability in Detekt and Protobuf plugins#49842
Open
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
Open
Improve task relocatability in Detekt and Protobuf plugins#49842erichaagdev wants to merge 2 commits intospring-projects:mainfrom
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
basePathon Detekt tasks to use a relative path from the root project. This prevents absolute paths from being used during analysis.javaExecutablePathon the Protobuf extension. This prevents absolute Java installation paths from being tracked as task inputs. (Note: This is safe becauseprotocandgrpcare configured to use native binaries rather than executable JARs).Impact
Normalizing these inputs ensures both tasks are fully relocatable. This will maximize remote build cache hits and prevent duplicate work across environments.
References
GenerateProtoTaskcaused by inputjavaExecutablePathgoogle/protobuf-gradle-plugin#785