aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/csharp_generator_helpers.h
diff options
context:
space:
mode:
authortony <57042389+tonydnewell@users.noreply.github.com>2023-08-29 15:24:52 +0100
committerGitHub <noreply@github.com>2023-08-29 14:24:52 +0000
commit157d8e23c814936d60e55e96bf650db240883d57 (patch)
tree16ac2aa7b6f1a34b8145c814b4137155a7e8a24c /src/compiler/csharp_generator_helpers.h
parent430d358f70eeec4f3c9f6e146531c814df7fcc66 (diff)
downloadgrpc-grpc-157d8e23c814936d60e55e96bf650db240883d57.tar.gz
[csharp codegen] Handle empty base_namespace option value to fix #34113 (#34137)
Fix for https://github.com/grpc/grpc/issues/34113 - setting C# option base_namespace to an empty string results in inconsistent behavior Allow the `base_namespace` option in the protocol buffers C# gRPC plugin to be specified with an empty string to make sure the plugin has the same behaviour as the protocol buffers compiler.
Diffstat (limited to 'src/compiler/csharp_generator_helpers.h')
-rw-r--r--src/compiler/csharp_generator_helpers.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/csharp_generator_helpers.h b/src/compiler/csharp_generator_helpers.h
index 94ba152231..6d98099342 100644
--- a/src/compiler/csharp_generator_helpers.h
+++ b/src/compiler/csharp_generator_helpers.h
@@ -26,6 +26,7 @@ namespace grpc_csharp_generator {
inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
const std::string& file_suffix,
+ const bool base_namespace_present,
const std::string& base_namespace,
std::string& out_file, std::string* error) {
// Support for base_namespace option is **experimental**.
@@ -36,7 +37,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
// make a difference (only files with punctuation or numbers in the
// name.)
// Otherwise the behavior remains the same as before.
- if (base_namespace.empty()) {
+ if (!base_namespace_present) {
out_file = grpc_generator::FileNameInUpperCamel(file, false) + file_suffix;
} else {
out_file = GRPC_CUSTOM_CSHARP_GETOUTPUTFILE(file, file_suffix, true,