You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.8 KiB
52 lines
1.8 KiB
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") |
|
|
|
def _CcSuffix(d): |
|
return d + "_cc" |
|
|
|
def _PySuffix(d): |
|
return d + "_py" |
|
|
|
# TODO(htuch): has_services is currently ignored but will in future support |
|
# gRPC stub generation. |
|
# TOOD(htuch): Convert this to native py_proto_library once |
|
# https://github.com/bazelbuild/bazel/issues/3935 and/or |
|
# https://github.com/bazelbuild/bazel/issues/2626 are resolved. |
|
def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
py_proto_library( |
|
name = _PySuffix(name), |
|
srcs = srcs, |
|
default_runtime = "@com_google_protobuf//:protobuf_python", |
|
protoc = "@com_google_protobuf//:protoc", |
|
deps = [_PySuffix(d) for d in deps] + ["@googleapis//:http_api_protos_py"], |
|
visibility = ["//visibility:public"], |
|
) |
|
|
|
# TODO(htuch): has_services is currently ignored but will in future support |
|
# gRPC stub generation. |
|
def api_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
native.proto_library( |
|
name = name, |
|
srcs = srcs, |
|
deps = deps + [ |
|
"@com_google_protobuf//:any_proto", |
|
"@com_google_protobuf//:descriptor_proto", |
|
"@com_google_protobuf//:duration_proto", |
|
"@com_google_protobuf//:struct_proto", |
|
"@com_google_protobuf//:wrappers_proto", |
|
"@googleapis//:http_api_protos_lib", |
|
], |
|
visibility = ["//visibility:public"], |
|
) |
|
native.cc_proto_library( |
|
name = _CcSuffix(name), |
|
deps = [name], |
|
visibility = ["//visibility:public"], |
|
) |
|
api_py_proto_library(name, srcs, deps, has_services) |
|
|
|
def api_cc_test(name, srcs, proto_deps): |
|
native.cc_test( |
|
name = name, |
|
srcs = srcs, |
|
deps = [_CcSuffix(d) for d in proto_deps], |
|
)
|
|
|