Introduce PY_PROTO_PLUGIN macro and use it
@@ -360,6 +360,29 @@ macro _ADD_PY_PROTO_OUT(Suf) {
SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
}
+### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
+###
+### Define protoc plugin for python with given Name that emits extra output with provided Extension
+### using Tool. Extra dependencies are passed via DEPS
+macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
+ SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
+ _ADD_PY_PROTO_OUT($EXT)
+ # XXX fix variable expansion in plugins
+ SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
+}
+
+### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
+###
+### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
+### using Tool. Extra dependencies are passed via DEPS
+macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
+ PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
+ _ADD_PY_PROTO_OUT($EXT2)
+}
+
+### @usage: QUASAR_PROTO() # deprecated
+###
+### This macro is quasar-specific and should never be used
macro QUASAR_PROTO() {
SET(QUASAR yes)
@@ -546,10 +569,7 @@ macro GRPC() {
SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES .grpc.pb.h .grpc.pb.cc)
# Python
- SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE(grpc_py contrib/tools/protoc/plugins/grpc_python))
- _ADD_PY_PROTO_OUT(_pb2_grpc.py)
- # XXX fix variable expansion in plugins
- SET(PY_PROTO_DEPS $PY_PROTO_DEPS contrib/libs/grpc/python contrib/libs/grpc)
+ PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/libs/grpc/python contrib/libs/grpc)
# Java
SET_APPEND(JAVA_PROTO_ARGS --plugin=protoc-gen-grpc_java=\${tool:"contrib/tools/protoc/plugins/grpc_java"} --grpc_java_out=$ARCADIA_BUILD_ROOT/java_out)
@@ -4656,11 +4676,7 @@ macro TASKLET() {
SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES .tasklet.h)
# Python
- SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE(tasklet_py tasklet/gen/python))
- _ADD_PY_PROTO_OUT(_tasklet.py)
- _ADD_PY_PROTO_OUT(_sbtask.py)
- # XXX fix variable expansion in plugins
- SET(PY_PROTO_DEPS $PY_PROTO_DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
+ PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/gen/python DEPS tasklet/domain/sandbox tasklet/runtime sandbox/sdk2)
}
TASKLET_REG_INCLUDES= \
