Skip to content

[Question] Does buf.dependency support schemas with multiple packages? #76

Closed
@veganafro

Description

I'm running into errors when trying to depend on well-known-types from the Buf Schema Registry.

The trimmed error message looks like:

gazelle: /private/var/tmp.../external/rules_buf~~buf~buf_deps/google/protobuf: directory contains multiple proto packages. Gazelle can only generate a proto_library for one package.
ERROR: /private/var/tmp/.../external/protobuf~/BUILD.bazel:351:14: in proto_library rule @@protobuf~//:descriptor_proto:
Traceback (most recent call last):
	File "/virtual_builtins_bzl/common/proto/proto_library.bzl", line 88, column 26, in _proto_library_impl
	File "/virtual_builtins_bzl/common/proto/proto_library.bzl", line 212, column 17, in _write_descriptor_set

Does the buf.dependency extension support specifying that I only want to depend on the google.protobuf package?

  • MODULE.bazel:
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_buf", version = "0.3.0")

buf = use_extension("@rules_buf//buf:extensions.bzl", "buf")
buf.toolchains(version = "v1.32.2", sha256 = "90fc6d90d4b777f6f21fc73258d4c2bcbcbd750bb77f14eeaae125c68a2931cc")
buf.dependency(module = "buf.build/envoyproxy/protoc-gen-validate:89818263b32b46d39c9ecb5984bd2850")
buf.dependency(module = "buf.build/protocolbuffers/wellknowntypes:409ee3f23673455597f9fe23d75eb7a1")
use_repo(buf, "buf_deps")

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions