rules_proto_grpc_cpp-5.8.0/0000755000000000000000000000000000000000000014455 5ustar00rootrootrules_proto_grpc_cpp-5.8.0/BUILD.bazel0000644000000000000000000000124600000000000016336 0ustar00rootrootload("@rules_proto_grpc//:defs.bzl", "proto_plugin") proto_plugin( name = "proto_plugin", exclusions = [ "google/protobuf", ], outputs = [ "{protopath}.pb.h", "{protopath}.pb.cc", ], protoc_plugin_name = "cpp", visibility = ["//visibility:public"], ) proto_plugin( name = "grpc_plugin", exclusions = [ "google/protobuf", ], options = [ "generate_mock_code=true", ], outputs = [ "{protopath}.grpc.pb.h", "{protopath}.grpc.pb.cc", "{protopath}_mock.grpc.pb.h", ], tool = "@grpc//src/compiler:grpc_cpp_plugin", visibility = ["//visibility:public"], ) rules_proto_grpc_cpp-5.8.0/MODULE.bazel0000644000000000000000000000044700000000000016466 0ustar00rootrootmodule( name = "rules_proto_grpc_cpp", version = "5.8.0", compatibility_level = 1, ) bazel_dep(name = "grpc", version = "1.74.1") bazel_dep(name = "protobuf", version = "31.1") bazel_dep(name = "rules_cc", version = "0.2.11") bazel_dep(name = "rules_proto_grpc", version = "5.8.0") rules_proto_grpc_cpp-5.8.0/WORKSPACE0000644000000000000000000000000000000000000015724 0ustar00rootrootrules_proto_grpc_cpp-5.8.0/cpp_grpc_compile.bzl0000644000000000000000000000125000000000000020471 0ustar00rootroot"""Generated definition of cpp_grpc_compile.""" load( "@rules_proto_grpc//:defs.bzl", "ProtoPluginInfo", "proto_compile_attrs", "proto_compile_impl", "proto_compile_toolchains", ) # Create compile rule cpp_grpc_compile = rule( implementation = proto_compile_impl, attrs = dict( proto_compile_attrs, _plugins = attr.label_list( providers = [ProtoPluginInfo], default = [ Label("//:proto_plugin"), Label("//:grpc_plugin"), ], cfg = "exec", doc = "List of protoc plugins to apply", ), ), toolchains = proto_compile_toolchains, ) rules_proto_grpc_cpp-5.8.0/cpp_grpc_library.bzl0000644000000000000000000000342300000000000020511 0ustar00rootroot"""Generated definition of cpp_grpc_library.""" load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_proto_grpc//:defs.bzl", "bazel_build_rule_common_attrs", "filter_files", "proto_compile_attrs") load("//:cpp_grpc_compile.bzl", "cpp_grpc_compile") def cpp_grpc_library(name, **kwargs): # buildifier: disable=function-docstring # Compile protos name_pb = name + "_pb" cpp_grpc_compile( name = name_pb, **{ k: v for (k, v) in kwargs.items() if k in proto_compile_attrs.keys() or k in bazel_build_rule_common_attrs } # Forward args ) # Filter files to sources and headers filter_files( name = name_pb + "_srcs", target = name_pb, extensions = ["cc"], ) filter_files( name = name_pb + "_hdrs", target = name_pb, extensions = ["h"], ) # Create cpp library cc_library( name = name, srcs = [name_pb + "_srcs"], deps = GRPC_DEPS + kwargs.get("deps", []), hdrs = [name_pb + "_hdrs"], includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."], **{ k: v for (k, v) in kwargs.items() if k in bazel_build_rule_common_attrs + [ "alwayslink", "copts", "defines", "include_prefix", "linkopts", "linkstatic", "local_defines", "nocopts", "strip_include_prefix", ] } ) GRPC_DEPS = [ Label("@protobuf//:protobuf"), Label("@grpc//:grpc++"), # Label("@grpc//:grpc++_reflection"), # TODO: See https://github.com/bazelbuild/bazel-central-registry/issues/841 ] rules_proto_grpc_cpp-5.8.0/cpp_proto_compile.bzl0000644000000000000000000000120100000000000020675 0ustar00rootroot"""Generated definition of cpp_proto_compile.""" load( "@rules_proto_grpc//:defs.bzl", "ProtoPluginInfo", "proto_compile_attrs", "proto_compile_impl", "proto_compile_toolchains", ) # Create compile rule cpp_proto_compile = rule( implementation = proto_compile_impl, attrs = dict( proto_compile_attrs, _plugins = attr.label_list( providers = [ProtoPluginInfo], default = [ Label("//:proto_plugin"), ], cfg = "exec", doc = "List of protoc plugins to apply", ), ), toolchains = proto_compile_toolchains, ) rules_proto_grpc_cpp-5.8.0/cpp_proto_library.bzl0000644000000000000000000000320600000000000020720 0ustar00rootroot"""Generated definition of cpp_proto_library.""" load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_proto_grpc//:defs.bzl", "bazel_build_rule_common_attrs", "filter_files", "proto_compile_attrs") load("//:cpp_proto_compile.bzl", "cpp_proto_compile") def cpp_proto_library(name, **kwargs): # buildifier: disable=function-docstring # Compile protos name_pb = name + "_pb" cpp_proto_compile( name = name_pb, **{ k: v for (k, v) in kwargs.items() if k in proto_compile_attrs.keys() or k in bazel_build_rule_common_attrs } # Forward args ) # Filter files to sources and headers filter_files( name = name_pb + "_srcs", target = name_pb, extensions = ["cc"], ) filter_files( name = name_pb + "_hdrs", target = name_pb, extensions = ["h"], ) # Create cpp library cc_library( name = name, srcs = [name_pb + "_srcs"], deps = PROTO_DEPS + kwargs.get("deps", []), hdrs = [name_pb + "_hdrs"], includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."], **{ k: v for (k, v) in kwargs.items() if k in bazel_build_rule_common_attrs + [ "alwayslink", "copts", "defines", "include_prefix", "linkopts", "linkstatic", "local_defines", "nocopts", "strip_include_prefix", ] } ) PROTO_DEPS = [ Label("@protobuf//:protobuf"), ] rules_proto_grpc_cpp-5.8.0/defs.bzl0000644000000000000000000000121500000000000016106 0ustar00rootroot"""cpp protobuf and grpc rules.""" load(":cpp_grpc_compile.bzl", _cpp_grpc_compile = "cpp_grpc_compile") load(":cpp_grpc_library.bzl", _cpp_grpc_library = "cpp_grpc_library") load(":cpp_proto_compile.bzl", _cpp_proto_compile = "cpp_proto_compile") load(":cpp_proto_library.bzl", _cpp_proto_library = "cpp_proto_library") # Export cpp rules cpp_proto_compile = _cpp_proto_compile cpp_grpc_compile = _cpp_grpc_compile cpp_proto_library = _cpp_proto_library cpp_grpc_library = _cpp_grpc_library # Aliases cc_grpc_compile = _cpp_grpc_compile cc_grpc_library = _cpp_grpc_library cc_proto_compile = _cpp_proto_compile cc_proto_library = _cpp_proto_library