diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2024-04-26 18:43:51 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2024-04-26 19:02:04 +0300 |
commit | e5d4b7bde277d240f06d301c81ccc3009edeb765 (patch) | |
tree | 79ae1aefda77738b053e7f7d6ca2302bdee63ad4 /build/conf/proto.conf | |
parent | 60002826e83cd20252e3dacf03aaf772e94d15eb (diff) | |
download | ydb-e5d4b7bde277d240f06d301c81ccc3009edeb765.tar.gz |
Add macro WITH_GMOCK()
b82821a13a9efe8887d6166de64a0dc6c03bf2fe
Diffstat (limited to 'build/conf/proto.conf')
-rw-r--r-- | build/conf/proto.conf | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/build/conf/proto.conf b/build/conf/proto.conf index 7c16a5cb7a..92c31b0d9a 100644 --- a/build/conf/proto.conf +++ b/build/conf/proto.conf @@ -219,13 +219,13 @@ HAS_CPP_PROTOBUF_PEERS=no CPP_PROTOBUF_PEERS= # tag:proto tag:cpp-specific -### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>) +### @usage: CPP_PROTO_PLUGIN0(Name Tool [DEPS <Dependencies>] [EXTRA_OUT_FLAG <ExtraOutFlag>]) ### ### Define protoc plugin for C++ with given Name that emits code into regular outputs ### using Tool. Extra dependencies are passed via DEPS. -macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) { +macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[], EXTRA_OUT_FLAG="") { .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME} - SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL)) + SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL $EXTRA_OUT_FLAG)) # XXX fix variable expansion in plugins ENABLE(HAS_CPP_PROTOBUF_PEERS) @@ -233,23 +233,23 @@ macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) { } # tag:proto tag:cpp-specific -### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>) +### @usage: CPP_PROTO_PLUGIN(Name Tool Suf [DEPS <Dependencies>] [EXTRA_OUT_FLAG <ExtraOutFlag>]) ### ### Define protoc plugin for C++ with given Name that emits code into 1 extra output ### using Tool. Extra dependencies are passed via DEPS. -macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) { - CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS) +macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[], EXTRA_OUT_FLAG="") { + CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS ${pre=EXTRA_OUT_FLAG :EXTRA_OUT_FLAG}) _ADD_CPP_PROTO_OUT($SUF) } # tag:proto tag:cpp-specific -### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>) +### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 [DEPS <Dependencies>] [EXTRA_OUT_FLAG <ExtraOutFlag>]) ### ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs ### using Tool. Extra dependencies are passed via DEPS. -macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) { - CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS) +macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[], EXTRA_OUT_FLAG="") { + CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS ${pre=EXTRA_OUT_FLAG :EXTRA_OUT_FLAG}) _ADD_CPP_PROTO_OUT($SUF2) SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File}) @@ -535,6 +535,8 @@ macro _JAVA_EVLOG_CMD(File) { # tag:proto tag:grpc _GRPC_ENABLED=no +_GRPC_SUF_CC=.grpc.pb.cc +_GRPC_SUF_H=.grpc.pb.h # tag:proto tag:grpc ### @usage: GRPC() @@ -545,7 +547,7 @@ macro GRPC() { ENABLE(_GRPC_ENABLED) # C++ - CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc) + CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp $_GRPC_SUF_CC $_GRPC_SUF_H DEPS contrib/libs/grpc $_GRPC_GMOCK_OUTFLAG) # Python PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio) @@ -555,6 +557,20 @@ macro GRPC() { SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1) } +# tag:proto tag:grpc +_GRPC_GMOCK_OUTFLAG= + +# tag:proto tag:grpc +### @usage: WITH_GMOCK() +### +### Enable generating *_mock.grpc.pb.cc/h files +macro GRPC_WITH_GMOCK() { + SET(_GRPC_GMOCK_OUTFLAG EXTRA_OUT_FLAG generate_mock_code=true) + GRPC() + _ADD_CPP_PROTO_OUT(_mock$_GRPC_SUF_H) + SET_APPEND(CPP_PROTO_OUTS_SEM ${output;hide;norel;nopath;noext;suf=_mock$_GRPC_SUF_H:File}) +} + macro GO_PROTO_USE_V2() { ENABLE(GO_PROTO_V2) } |