Merge branch 'master' into rust-prost-tonic

This commit is contained in:
Adam Liddell 2023-09-08 11:44:10 +01:00 committed by GitHub
commit 6d0eadd0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 88 additions and 6 deletions

View File

@ -36,7 +36,7 @@ def cpp_grpc_library(name, **kwargs): # buildifier: disable=function-docstring
srcs = [name_pb + "_srcs"],
deps = GRPC_DEPS + kwargs.get("deps", []),
hdrs = [name_pb + "_hdrs"],
includes = [name_pb],
includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."],
alwayslink = kwargs.get("alwayslink"),
copts = kwargs.get("copts"),
defines = kwargs.get("defines"),

View File

@ -36,7 +36,7 @@ def cpp_proto_library(name, **kwargs): # buildifier: disable=function-docstring
srcs = [name_pb + "_srcs"],
deps = PROTO_DEPS + kwargs.get("deps", []),
hdrs = [name_pb + "_hdrs"],
includes = [name_pb],
includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."],
alwayslink = kwargs.get("alwayslink"),
copts = kwargs.get("copts"),
defines = kwargs.get("defines"),

View File

@ -123,7 +123,7 @@ class RouteGuideClient {
std::uniform_int_distribution<int> feature_distribution(
0, feature_list_.size() - 1);
std::uniform_int_distribution<int> delay_distribution(
500, 1500);
50, 100);
std::unique_ptr<ClientWriter<Point> > writer(
stub_->RecordRoute(&context, &stats));

View File

@ -6,6 +6,41 @@
Changelog
=========
Pending
-------
General
*******
- Updated grpc to 1.54.1
- Updated ``rules_proto`` to 5.3.0-21.7
- Fixed passing extra options to the ``grpc-gateway`` plugin.
`#258 <https://github.com/rules-proto-grpc/rules_proto_grpc/pull/258>`__
- Removed header files from runfiles of `cpp_grpc_library`.
`#262 <https://github.com/rules-proto-grpc/rules_proto_grpc/pull/262>`__
C#/F#
*****
- Updated gRPC to 2.53.0
Go
**
- Updated ``rules_go`` to 0.39.1
Python
******
- Added support for passing ``data`` attr to Python library rules.
`#257 <https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257>`__
Ruby
****
- Updated ``rules_ruby`` to latest
4.4.0
-----

View File

@ -124,7 +124,7 @@ API Reference
- false
- ``[]``
- A list of extra command line arguments to pass directly to protoc, not as plugin options
* - ``extra_protoc_args``
* - ``env``
- ``string_dict``
- false
- ``{}``

View File

@ -128,6 +128,46 @@ def php_path(s):
"""
return "/".join([capitalize(c) for c in s.split("/")])
def snake_case(s):
"""
Convert a path string from camelCase to snake_case.
Args:
s (string): The input string to be converted.
Returns:
(string): The converted string.
"""
converted = ""
is_last_lower_case = False
for char in s.elems():
if char.isupper():
if is_last_lower_case:
converted += "_"+char
is_last_lower_case = False
continue
elif char.islower() or char.isdigit():
is_last_lower_case = True
converted += char
continue
is_last_lower_case = False
converted += char
return converted.lower()
def dasherize(s):
"""
Convert a path string from snake_case to dashed-case.
Args:
s (string): The input string to be converted.
Returns:
(string): The converted string.
"""
return snake_case(s).replace("_", "-")
def get_output_filename(src_file, pattern, proto_info):
"""
Build the predicted filename for file generated by the given plugin.
@ -195,6 +235,13 @@ def get_output_filename(src_file, pattern, proto_info):
protopath_partitions[0],
pascal_objc(protopath_partitions[2]),
]))
filename = pattern.replace("{basename|rust_keyword}", rust_keyword(protopath))
elif "{protopath|dasherize}" in pattern:
filename = pattern.replace("{protopath|dasherize}", "/".join([
# Dasherize only the file name
protopath_partitions[0],
dasherize(protopath_partitions[2]),
]))
else:
filename += basename + pattern

View File

@ -33,7 +33,7 @@ var cppProtoLibraryRuleTemplate = mustTemplate(cppLibraryRuleTemplateString + `
srcs = [name_pb + "_srcs"],
deps = PROTO_DEPS + kwargs.get("deps", []),
hdrs = [name_pb + "_hdrs"],
includes = [name_pb],
includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."],
alwayslink = kwargs.get("alwayslink"),
copts = kwargs.get("copts"),
defines = kwargs.get("defines"),
@ -57,7 +57,7 @@ var cppGrpcLibraryRuleTemplate = mustTemplate(cppLibraryRuleTemplateString + `
srcs = [name_pb + "_srcs"],
deps = GRPC_DEPS + kwargs.get("deps", []),
hdrs = [name_pb + "_hdrs"],
includes = [name_pb],
includes = [name_pb] if kwargs.get("output_mode", "PREFIXED") == "PREFIXED" else ["."],
alwayslink = kwargs.get("alwayslink"),
copts = kwargs.get("copts"),
defines = kwargs.get("defines"),