Copilot commented on code in PR #5358:
URL: https://github.com/apache/texera/pull/5358#discussion_r3346474619
##########
amber/build.sbt:
##########
@@ -200,6 +200,26 @@ libraryDependencies += "com.thesamet.scalapb" %%
"scalapb-json4s" % "0.12.0"
// enable protobuf compilation in Test
Test / PB.protoSources += PB.externalSourcePath.value
+// Regenerate Python betterproto bindings on compile; skipped if protoc is
absent.
+val genPythonProto = taskKey[Unit]("Generate Python betterproto bindings from
.proto sources.")
+genPythonProto := {
+ val log = streams.value.log
+ val repoRoot = (ThisBuild / baseDirectory).value
+ val script = repoRoot / "bin" / "python-proto-gen.sh"
+ def onPath(bin: String): Boolean =
+ scala.sys.process.Process(Seq("bash", "-c", s"command -v $bin >/dev/null
2>&1")).! == 0
+ if (!onPath("protoc") || !onPath("protoc-gen-python_betterproto")) {
+ log.warn(
+ "protoc or protoc-gen-python_betterproto not found on PATH; skipping
Python proto generation. " +
+ "Install protoc and `pip install betterproto[compiler]` before
launching a Python worker or running pytest."
+ )
+ } else {
+ val exit = scala.sys.process.Process(Seq("bash", script.getAbsolutePath),
repoRoot).!(log)
Review Comment:
`scala.sys.process.Process(...).!(log)` passes an sbt `Logger` where
`scala.sys.process.!` expects a `ProcessLogger` (or `ProcessIO`). This is
likely to fail compilation of the build definition and/or silently not log
process output as intended. Wrap the sbt logger with a `ProcessLogger` so
stdout/stderr from the script are routed into sbt logs.
--
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]