rules-proto-grpc / rules_proto_grpc

Bazel rules for building Protobuf and gRPC code and libraries from proto_library targets
https://rules-proto-grpc.com
Apache License 2.0
253 stars 160 forks source link

Is there any native support for rules_proto_grpc rule to work with bazel-gazelle? #220

Open teabuff opened 2 years ago

teabuff commented 2 years ago

Description

Hi,

I am using bazel-gazelle to automate the BUILD file generator and dependency management. But it seems gazelle does not natively work with the rules_proto_grpc. E.g. I have an example.proto which defines a simple the grpc service and runs gazelle by default generate the following BUILD file:

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
    name = "example_proto",
    srcs = ["example.proto"],
)

go_proto_library(
    name = "example_go_proto",
    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
    importpath = "github.com/<account>/<repo>/samples/proto/example",
    proto = ":example_proto",
)

go_library(
    name = "example",
    embed = [":example_go_proto"],
    importpath = "github.com/<account>/<repo>/samples/proto/example",
)

Looks like it is using the rules_proto rule instead of those rules defined in the rules_proto_grpc. Is there any support similar to https://github.com/stackb/rules_proto#gazelle-configuration that instruct gazelle to use the rules_proto_grpc correctly like the following:

load("@rules_proto_grpc//go:defs.bzl", "go_grpc_library")

go_grpc_library(
    name = "example_go_grpc",
    importpath = "github.com/<account>/<repo>/samples/proto/example",
    protos = [":example_proto"],
)

Thank you so much!

aaliddell commented 2 years ago

These rules have no Gazelle plugin, so unfortunately you won't get auto-generated rules for your proto library targets