summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-09-27 13:40:19 -0500
committerDaniel Moody <daniel.moody@mongodb.com>2022-09-27 13:40:19 -0500
commit690f68168e253bad8a060fcf5d25d4d0afdc76c0 (patch)
tree5a978e87154e4f87b4182b4afd2fec85b3c3601d
parenta2b185a76513420a07b83867b9050da1d9d95850 (diff)
downloadmongo-690f68168e253bad8a060fcf5d25d4d0afdc76c0.tar.gz
SERVER-68365 a few small fixes
-rw-r--r--SConstruct2
-rw-r--r--site_scons/site_tools/protobuf_compiler.py17
-rw-r--r--src/third_party/grpc/SConscript8
3 files changed, 10 insertions, 17 deletions
diff --git a/SConstruct b/SConstruct
index 648a2774fbb..59c2228c855 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1336,7 +1336,7 @@ env_vars.Add(
)
env_vars.Add(
- 'PROTOC_CPP_PLUGIN',
+ 'PROTOC_GRPC_PLUGIN',
default="$DESTDIR/bin/grpc_cpp_plugin$PROGSUFFIX",
help='Path to protobuf compiler grpc plugin.',
)
diff --git a/site_scons/site_tools/protobuf_compiler.py b/site_scons/site_tools/protobuf_compiler.py
index 78791a8537d..de5a6f4a9d9 100644
--- a/site_scons/site_tools/protobuf_compiler.py
+++ b/site_scons/site_tools/protobuf_compiler.py
@@ -39,6 +39,7 @@ def protoc_emitter(target, source, env):
if type == 'cpp':
new_targets += [f"{base_file_name}.pb.cc", f"{base_file_name}.pb.h"]
+
plugins = env.get('PROTOC_PLUGINS', [])
for name in plugins:
for ext in plugins[name].get('exts', []):
@@ -66,14 +67,11 @@ protoc_scanner = SCons.Scanner.Scanner(function=protoc_scanner, skeys=[".proto"]
def type_out_gen(source, target, env, for_signature):
# the user set PROTOC_CPPGEN_DIR that means we add the flag
# to turn on cpp generation
- try:
- result = env.subst('$PROTOC_GEN_TYPES', target=target, source=source)
- if 'cpp' in result:
- out_dir = os.path.dirname(str(target[0].abspath))
- os.makedirs(out_dir, exist_ok=True)
- return f"--cpp_out={out_dir}"
- except:
- traceback.print_exc()
+ result = env.subst('$PROTOC_GEN_TYPES', target=target, source=source)
+ if 'cpp' in result:
+ out_dir = os.path.dirname(str(target[0].abspath))
+ os.makedirs(out_dir, exist_ok=True)
+ return f"--cpp_out={out_dir}"
def gen_types_str(source, target, env, for_signature):
# This generates the types from the list of types we which are supported and
@@ -103,10 +101,9 @@ def gen_plugins(source, target, env, for_signature):
gen_types_results = []
plugins = env.get('PROTOC_PLUGINS', [])
for name in plugins:
- out_dir = plugins[name].get('out_dir')
plugin = plugins[name].get('plugin')
options = plugins[name].get('options')
- if plugin and out_dir:
+ if plugin:
cmd_line = f'--{name}_out='
for opt in options:
cmd_line += f'{opt}:'
diff --git a/src/third_party/grpc/SConscript b/src/third_party/grpc/SConscript
index 040e46128cc..5403462d097 100644
--- a/src/third_party/grpc/SConscript
+++ b/src/third_party/grpc/SConscript
@@ -90,7 +90,7 @@ grpc_env.Append(CPPPATH=[
grpc_root.Dir('dist/third_party/address_sorting/include'),
])
-# This should match the default $PROTOC_CPP_PLUGIN bin name for everything to be seamless
+# This should match the default $PROTOC_GRPC_PLUGIN bin name for everything to be seamless
# so if for some reason this name needs to change, make sure to update the default as well.
protobuf_plugin_bin = grpc_env.Program(
target='grpc_cpp_plugin',
@@ -853,15 +853,11 @@ grpcxx_env.AppendUnique(
PROTOC_GEN_TYPES=['cpp'],
PROTOC_PLUGINS={
'grpc': {
- 'plugin': '$PROTOC_CPP_PLUGIN',
- 'out_dir': '$PROTOC_CPPGEN_DIR',
+ 'plugin': '$PROTOC_GRPC_PLUGIN',
'options': ['generate_mock_code=true'],
'exts': ['.grpc.pb.cc', '.grpc.pb.h'],
},
},
- PROTOC_MOCKS=[
- 'grpc'
- ],
)
lib_node = grpcxx_env.Library(