You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "ribafish (via GitHub)" <gi...@apache.org> on 2026/03/19 09:20:53 UTC

[I] Gradle plugin: `logfile_enc` option breaks build cache relocatability [pekko-grpc]

ribafish opened a new issue, #660:
URL: https://github.com/apache/pekko-grpc/issues/660

   ## Problem
   
   The `PekkoGrpcPlugin` passes an absolute path as a protoc plugin option (`logfile_enc`), which breaks Gradle build cache relocatability.
   
   In [`PekkoGrpcPlugin.groovy` line 69](https://github.com/apache/pekko-grpc/blob/main/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy#L69):
   ```groovy
   Path logFile = project.buildDir.toPath().resolve("pekko-grpc-gradle-plugin.log")
   ```
   
   This absolute path is then URL-encoded and passed as a protoc plugin option at [line 132](https://github.com/apache/pekko-grpc/blob/main/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy#L132):
   ```groovy
   option "logfile_enc=${URLEncoder.encode(logFile.toString(), "utf-8")}"
   ```
   
   The `protobuf-gradle-plugin` registers protoc plugin options as task inputs for `GenerateProtoTask`. Since `logfile_enc` contains an absolute path that differs across machines/checkout directories, the `generateProto` task gets a cache miss even when all actual source inputs are identical.
   
   ## Observed behavior
   
   When running [Develocity build validation experiments](https://github.com/gradle/develocity-build-validation-scripts) (experiment 3 — same commit, different checkout directories), the `:core:scheduler:generateProto` task shows a cache miss due to the `pluginsForCaching.pekkoGrpc$0.options` input differing between builds.
   
   ## Suggested fix
   
   Use a path relative to the project directory instead of an absolute path:
   
   ```groovy
   Path logFile = project.projectDir.toPath().resolve("build/pekko-grpc-gradle-plugin.log")
   String logFileRelative = project.projectDir.toPath().relativize(logFile).toString()
   // ...
   option "logfile_enc=${URLEncoder.encode(logFileRelative, "utf-8")}"
   ```
   
   Or alternatively, exclude the log file path from cache key computation by not passing it as a plugin option and instead resolving it at execution time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Gradle plugin: `logfile_enc` option breaks build cache relocatability [pekko-grpc]

Posted by "raboof (via GitHub)" <gi...@apache.org>.
raboof commented on issue #660:
URL: https://github.com/apache/pekko-grpc/issues/660#issuecomment-4088828276

   Cool finding! Could you open a PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Gradle plugin: `logfile_enc` option breaks build cache relocatability [pekko-grpc]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning closed issue #660: Gradle plugin: `logfile_enc` option breaks build cache relocatability
URL: https://github.com/apache/pekko-grpc/issues/660


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org