-
-
Notifications
You must be signed in to change notification settings - Fork 286
Closed
Description
Hi,
what is the reason/rationale for proto rules being implemented with Worker/Processor and protoc-bridge/protoc-jar
From my understanding current implementation has few "drawbacks"
@com_google_protobuf//:protocis ignored. It's used byproto_librarybutscalapb_proto_libraryuses one of the https://github.com/os72/protoc-jar/tree/master/bin
a. it requires extra work/care to keep both protoc at same version- it requires extra hops to generate scala code
a. bazel invokes scala viaWorker/Processor
b. protoc_bridge is invoked which
i. extracts ownprotocto temp directory https://github.com/os72/protoc-jar/blob/master/src/main/java/com/github/os72/protocjar/Protoc.java#L197
ii. starts newprotocprocess https://github.com/os72/protoc-jar/blob/master/src/main/java/com/github/os72/protocjar/Protoc.java#L125
c. protoc calls scala plugin to generate code - to use custom plugin we had to copy
WorkerandProcessorto supply it
As I know there is an aim to use persistent worker. But I guess because new process is spawned benefits of persistent worker cannot be used (my knowledge is limited on this topic).
I have a POC https://github.com/simuons/rules_scala/blob/scala-proto-gen/scala_proto/scala_proto.bzl#L595 which
- uses
@com_google_protobuf//:protocfrom bazel (the same asproto_libraryuses) - calls
protocdirectly with supplied plugin and is based on descriptor sets to avoid--proto_pathconstruction (mentioned here https://blog.bazel.build/2017/02/27/protocol-buffers.html # Descriptor Sets) - needs less code to supply own plugin https://github.com/simuons/rules_scala/blob/scala-proto-gen/src/scala/scripts/ScalaPBPlugin.scala to a rule https://github.com/simuons/rules_scala/blob/scala-proto-gen/test/proto/BUILD#L124
What do you think? If all I wrote makes any sense I'd like to proceed with that.
Metadata
Metadata
Assignees
Labels
No labels