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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to