Skip to content

Commit 6162eef

Browse files
committed
feat: allow proto_library as rb_library#dep
1 parent c5c3044 commit 6162eef

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

MODULE.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ bazel_dep(name = "platforms", version = "0.0.5")
1616
bazel_dep(name = "rules_cc", version = "0.0.9")
1717
bazel_dep(name = "rules_java", version = "7.2.0")
1818

19+
# NB: LOWER BOUND on earliest BCR release of protobuf module, to avoid upgrading the root module by accident
20+
bazel_dep(name = "protobuf", version = "3.19.6")
21+
1922
# Ruleset development dependencies.
2023
bazel_dep(name = "aspect_bazel_lib", version = "2.21.2", dev_dependency = True)
2124
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.8.2", dev_dependency = True)

ruby/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ toolchain_type(
99
visibility = ["//visibility:public"],
1010
)
1111

12+
toolchain_type(
13+
name = "ruby_grpc_protoc_plugin.toolchain_type",
14+
visibility = ["//visibility:public"],
15+
)
16+
1217
bzl_library(
1318
name = "defs",
1419
srcs = ["defs.bzl"],

ruby/private/library.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"Implementation details for rb_library"
22

3+
load("//ruby/private:proto.bzl", "ruby_proto_aspect")
34
load(
45
"//ruby/private:providers.bzl",
56
"BundlerInfo",
@@ -18,6 +19,8 @@ ATTRS = {
1819
),
1920
"deps": attr.label_list(
2021
doc = "List of other Ruby libraries the target depends on.",
22+
# Convert proto_library deps to provide RubyFilesInfo
23+
aspects = [ruby_proto_aspect],
2124
),
2225
"data": attr.label_list(
2326
allow_files = True,

ruby/private/providers.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ GemInfo = provider(
2929
},
3030
)
3131

32+
GrpcPluginInfo = provider(
33+
doc = "Provider for the gRPC plugin to use for proto services generation.",
34+
fields = {
35+
"grpc_plugin": "The gRPC plugin executable.",
36+
},
37+
)
38+
3239
# https://bazel.build/rules/depsets
3340

3441
def get_transitive_srcs(srcs, deps):

0 commit comments

Comments
 (0)