This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
The following commit(s) were added to refs/heads/main by this push:
new 1efef5b3 Use relative path for logfile_enc protoc plugin option (#661)
1efef5b3 is described below
commit 1efef5b3b4ab7f679f286b860151895496e45f21
Author: Gašper Kojek <[email protected]>
AuthorDate: Mon Mar 30 15:12:49 2026 +0200
Use relative path for logfile_enc protoc plugin option (#661)
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.
---
.../main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy
b/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy
index bf2751c9..df3a2a1a 100644
---
a/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy
+++
b/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPlugin.groovy
@@ -67,6 +67,10 @@ class PekkoGrpcPlugin implements Plugin<Project> {
String assemblyClassifier = SystemUtils.IS_OS_WINDOWS ? "bat" :
"assembly"
Path logFile =
project.buildDir.toPath().resolve("pekko-grpc-gradle-plugin.log")
+ // Use a relative path for the protoc plugin option so it does not
break Gradle build cache relocatability.
+ // The protobuf-gradle-plugin registers plugin options as task inputs;
an absolute path causes cache misses
+ // when the same build is run from different checkout directories.
+ String logFileRelative =
project.projectDir.toPath().relativize(logFile).toString()
project.sourceSets {
main {
@@ -129,7 +133,7 @@ class PekkoGrpcPlugin implements Plugin<Project> {
option
"server_power_apis=${pekkoGrpcExt.serverPowerApis}"
option
"use_play_actions=${pekkoGrpcExt.usePlayActions}"
option
"extra_generators=${pekkoGrpcExt.extraGenerators.join(';')}"
- option
"logfile_enc=${URLEncoder.encode(logFile.toString(), "utf-8")}"
+ option
"logfile_enc=${URLEncoder.encode(logFileRelative, "utf-8")}"
if (pekkoGrpcExt.includeStdTypes) {
option "include_std_types=true"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]