|
|
|
@ -1,5 +1,11 @@ |
|
|
|
|
load("@protobuf_bzl//:protobuf.bzl", "cc_proto_library", "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. |
|
|
|
|
def api_cc_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
|
|
@ -8,7 +14,7 @@ def api_cc_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
|
|
|
srcs = srcs, |
|
|
|
|
default_runtime = "//external:protobuf", |
|
|
|
|
protoc = "//external:protoc", |
|
|
|
|
deps = deps + [ |
|
|
|
|
deps = [_CcSuffix(d) for d in deps] + [ |
|
|
|
|
"@googleapis//:http_api_protos", |
|
|
|
|
"@protobuf_bzl//:cc_wkt_protos", |
|
|
|
|
], |
|
|
|
@ -23,10 +29,17 @@ def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
|
|
|
srcs = srcs, |
|
|
|
|
default_runtime = "//external:protobuf_python", |
|
|
|
|
protoc = "//external:protoc", |
|
|
|
|
deps = [d + "_py" for d in deps] + ["@googleapis//:http_api_protos_py"], |
|
|
|
|
deps = [_PySuffix(d) for d in deps] + ["@googleapis//:http_api_protos_py"], |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
def api_proto_library(name, srcs = [], deps = [], has_services = 0): |
|
|
|
|
api_cc_proto_library(name, srcs, deps, has_services) |
|
|
|
|
api_py_proto_library(name + "_py", srcs, deps, has_services) |
|
|
|
|
api_cc_proto_library(_CcSuffix(name), srcs, deps, has_services) |
|
|
|
|
api_py_proto_library(_PySuffix(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], |
|
|
|
|
) |
|
|
|
|