Bazel Gazelle adding strange dependencies to proto libraries

Viewed 162

When generating BUILD files with gazelle, bazel run //:gazelle, I'm getting strange dependencies within the protobuf package. I've added comments where the weird deps are in the generated output. Without these deps the build seems to be okay.

go.mod
proto/
  BUILD.bazel
  user.proto
  command.proto
  core.proto
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 = "api_proto",
    srcs = [
        "command.proto",
        "core.proto",
        "user.proto",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//:root_proto", # THIS DOESN'T EXIST
        "@com_google_protobuf//:any_proto",
    ],
)

go_proto_library(
    name = "api_go_proto",
    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
    importpath = "kubelt.com/kubelt/api",
    proto = ":api_proto",
    visibility = ["//visibility:public"],
    deps = [ # THESE ARE NOT GO DEPS
        "//:command.proto",
        "//:core.proto",
        "//:user.proto",
    ],
)

go_library(
    name = "api",
    embed = [":api_go_proto"],
    importpath = "kubelt.com/kubelt/api",
    visibility = ["//visibility:public"],
)

0 Answers
Related