Skip to content

Use relative path for logfile_enc to fix Gradle build cache relocatability#661

Open
ribafish wants to merge 1 commit intoapache:mainfrom
ribafish:fix/gradle-cache-relocatable-logfile
Open

Use relative path for logfile_enc to fix Gradle build cache relocatability#661
ribafish wants to merge 1 commit intoapache:mainfrom
ribafish:fix/gradle-cache-relocatable-logfile

Conversation

@ribafish
Copy link

Problem

The logfile_enc option passed to the pekko-grpc protoc plugin contains an absolute path (project.buildDir), which the protobuf-gradle-plugin registers as a task input for GenerateProtoTask. This breaks Gradle build cache relocatability: builds of the same commit from different checkout directories produce different cache keys, causing unnecessary cache misses.

Closes #660

Fix

Use a path relative to the project directory instead of an absolute path. The protoc plugin process runs with the project directory as its working directory, so the relative path (build/pekko-grpc-gradle-plugin.log) resolves to the same file.

The absolute Path used by printProtocLogs is unchanged — only the string passed as a protoc plugin option is affected.

The logfile_enc option passed to the pekko-grpc protoc plugin
contained an absolute path (project.buildDir), which the
protobuf-gradle-plugin registers as a task input for
GenerateProtoTask. This broke Gradle build cache relocatability:
builds of the same commit from different checkout directories
produced different cache keys.

Switch to a path relative to the project directory. The protoc
plugin process runs with the project directory as its working
directory, so the relative path resolves to the same file.

The absolute Path used by printProtocLogs is unchanged.
ribafish added a commit to gradle/develocity-oss-projects that referenced this pull request Mar 19, 2026
…hing

Replace infra-dependent test tasks (testCoverageLean, reportCoverage) with
compileScala/compileTestScala to exercise caching without Docker/CouchDB.

Add doNotCacheIf hook for GenerateProtoTask — pekko-grpc's logfile_enc
option contains an absolute path that breaks cache relocatability in exp3.

Upstream: apache/pekko-grpc#661

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

The CI issue is unrelated. TimonVS/pr-labeler-action seems like it is no working but I don't think we even get any benefit from that action.

@pjfanning pjfanning added this to the 2.0.0-M2 milestone Mar 19, 2026
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.

Gradle plugin: logfile_enc option breaks build cache relocatability

2 participants