Source release 15.0.0
This commit is contained in:
29
third_party/protobuf/protobuf.bzl
vendored
29
third_party/protobuf/protobuf.bzl
vendored
@@ -45,8 +45,11 @@ def _CcSrcs(srcs, use_grpc_plugin=False):
|
||||
def _CcOuts(srcs, use_grpc_plugin=False):
|
||||
return _CcHdrs(srcs, use_grpc_plugin) + _CcSrcs(srcs, use_grpc_plugin)
|
||||
|
||||
def _PyOuts(srcs):
|
||||
return [s[:-len(".proto")] + "_pb2.py" for s in srcs]
|
||||
def _PyOuts(srcs, use_grpc_plugin=False):
|
||||
ret = [s[:-len(".proto")] + "_pb2.py" for s in srcs]
|
||||
if use_grpc_plugin:
|
||||
ret += [s[:-len(".proto")] + "_pb2_grpc.py" for s in srcs]
|
||||
return ret
|
||||
|
||||
def _RelativeOutputPath(path, include, dest=""):
|
||||
if include == None:
|
||||
@@ -171,10 +174,10 @@ def cc_proto_library(
|
||||
deps=[],
|
||||
cc_libs=[],
|
||||
include=None,
|
||||
protoc="//:protoc",
|
||||
protoc="@com_google_protobuf//:protoc",
|
||||
internal_bootstrap_hack=False,
|
||||
use_grpc_plugin=False,
|
||||
default_runtime="//:protobuf",
|
||||
default_runtime="@com_google_protobuf//:protobuf",
|
||||
**kargs):
|
||||
"""Bazel rule to create a C++ protobuf library from proto source files
|
||||
|
||||
@@ -317,8 +320,8 @@ def py_proto_library(
|
||||
py_libs=[],
|
||||
py_extra_srcs=[],
|
||||
include=None,
|
||||
default_runtime="//:protobuf_python",
|
||||
protoc="//:protoc",
|
||||
default_runtime="@com_google_protobuf//:protobuf_python",
|
||||
protoc="@com_google_protobuf//:protoc",
|
||||
use_grpc_plugin=False,
|
||||
**kargs):
|
||||
"""Bazel rule to create a Python protobuf library from proto source files
|
||||
@@ -344,7 +347,7 @@ def py_proto_library(
|
||||
**kargs: other keyword arguments that are passed to cc_library.
|
||||
|
||||
"""
|
||||
outs = _PyOuts(srcs)
|
||||
outs = _PyOuts(srcs, use_grpc_plugin)
|
||||
|
||||
includes = []
|
||||
if include != None:
|
||||
@@ -400,3 +403,15 @@ def internal_protobuf_py_tests(
|
||||
srcs=[s],
|
||||
main=s,
|
||||
**kargs)
|
||||
|
||||
|
||||
def check_protobuf_required_bazel_version():
|
||||
"""For WORKSPACE files, to check the installed version of bazel.
|
||||
|
||||
This ensures bazel supports our approach to proto_library() depending on a
|
||||
copied filegroup. (Fixed in bazel 0.5.4)
|
||||
"""
|
||||
expected = apple_common.dotted_version("0.5.4")
|
||||
current = apple_common.dotted_version(native.bazel_version)
|
||||
if current.compare_to(expected) < 0:
|
||||
fail("Bazel must be newer than 0.5.4")
|
||||
|
||||
Reference in New Issue
Block a user