Open johnskopis opened 6 years ago
After a little bit more thought it probably makes more sense to allow caller to override the implementation of go_proto_library or go_rpc_library instead
At the moment go_grpc_library
is just a wrapper for go_proto_library
with a specific compiler. I'd like to make Gazelle migrate existing instances of go_grpc_library
to go_proto_library
(see #8).
I think it's reasonable to have an option that explicitly sets the compiler
attribute on generated go_proto_library
rules though.
FYI, you can use buildozer to make bulk changes like this to rules. Should be easier than forking and modifying Gazelle.
It would be nice if this could also be defined for the go_repository
, so e.g. I could specify
go_repository(
name = ".....",
commit = "....",
importpath = "...",
build_file_proto_compiler = "@io_bazel_rules_go//proto:gogofaster_grpc",
)
But I suppose that is more specific to the rules_go repo. So opened an issue there for it.
Not sure if this belongs here or in rules_go. I recently migrated from pubref rules (gogo) to a recent go_rules using this example: https://github.com/weaveworks/cortex/compare/bazel-0.5.4...ianthehat:bazel-0.5.4
I had to make made gazelle generate go_proto_library rules with the compiler attribute set to my gogo_proto compiler. I ran gazelle with -external=vendored -proto=default.
The only issue was in vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/BUILD.bazel: The hacked up gazelle didn't set a different compiler for go_rpc_library but I think that would have fixed it. I just removed compiler and marked the file gazelle: ignore
My compiler had to use external @targets (those didn't specify the compiler attribute)
In order for the above to work I depend on external @targets. It's unclear if those targets are maintained by gazelle running with external=vendor. I think I would like gazelle to generate rules for external @targets using external=external mode and everything else using external=vendored mode.
Does that make sense?
Does it make sense to add args to gazelle: --proto_compiler: default proto compiler to use when generating go_proto_library rules (default: @io_bazel_rules_go//proto:go_proto) --rpc_proto_compiler: default proto compiler to use when generating go_rpc_library rules (default: @io_bazel_rules_go//proto:go_grpc)
Thanks