# tag:tool-specific tag:proto
PROTOC=${tool:"contrib/tools/protoc"}
PROTOC_OLD=${tool:"contrib/tools/protoc_old"}
PY_PROTOC=${tool:"contrib/tools/protoc"}
when ($PYTHON2 == "yes") {
PY_PROTOC=${PROTOC_OLD}
}
JAVA_PROTOC=${tool:"build/platform/java/protoc"}
when ($OPENSOURCE_REPLACE_PROTOBUF) {
PROTOC_STYLEGUIDE_OUT=
PROTOC_PLUGIN_STYLEGUIDE=
PROTOBUF_INCLUDE_PATH="${protobuf_INCLUDE_DIRS}"
DEFAULT_PROTOC_TOOLS=
}
otherwise {
PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
PROTOBUF_INCLUDE_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
PROTOBUF_OLD_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_old/src
DEFAULT_PROTOC_TOOLS=${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
}
USE_VANILLA_PROTOC=no
PROTOC_TRANSITIVE_HEADERS=yes
_PROTOC_FLAGS=
# tag:proto
PY_PROTOS_FOR=no
BUILD_PROTO_AS_EVLOG=no
# tag:proto
PROTO_NAMESPACE=
# tag:proto tag:python-specific
GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"} --py_ver ${_PYTHON_VER}
# tag:proto tag:cpp-specific
PROTO_HEADER_EXTS=.pb.h
CPP_PROTO_CMDLINE=
CPP_PROTO_OPTS=
CPP_PROTO_OUTS=
CPP_PROTO_OUTS_SEM=
CPP_PROTO_SUFFIXES=.pb.h .pb.cc
CPP_PROTO_PLUGINS=
CPP_PROTO_NO_DBGINFO=no
PROTOC_EXTRA_OUTS_SEM=
# tag:proto tag:cpp-specific
CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
CPP_EV_OUTS=
CPP_EV_OUTS_SEM=
# tag:proto tag:python-specific
PY_PROTO_OPTS=
PY_PROTO_OUTS=
PY_PROTO_OUTS_INTERNAL=
PY_PROTO_DEPS=
PY_PROTO_SUFFIXES=_pb2.py
PY_EVLOG_SUFFIXES=_ev_pb2.py
# tag:proto tag:java-specific
JAVA_PROTO_ARGS=
# tag:proto tag:python-specific
OPTIMIZE_PY_PROTOS_FLAG=no
# tag:proto
### @usage: CPP_PROTOLIBS_DEBUG_INFO()
###
### Eqvivalent to NO_DEBUG_INFO() macro if the flag CPP_PROTO_NO_DBGINFO=yes
macro CPP_PROTOLIBS_DEBUG_INFO() {
SET(NO_DEBUGINFO $CPP_PROTO_NO_DBGINFO)
}
# tag:internal
### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
###
### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
ADDINCL($BUILD $SOURCE)
}
# tag:proto
### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
###
### This macro introduces proper ADDINCLs for .proto-files found in sources and
### .cpp/.h generated files, supplying them to appropriate commands and allowing
### proper dependency resolution at configure-time.
###
### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
### from dependency via PROTO_NAMESPACE macro
macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
_ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
}
# tag:proto
### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
###
### Defines protobuf namespace (import/export path prefix) which should be used for imports and
### which defines output path for .proto generation.
###
### For proper importing and configure-time dependency management it sets ADDINCLs
### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
### If generated .proto files are going to be used for building a module than use of WITH_GEN
### parameter will add appropriate dir from the build root for .proto files search.
macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
SET(PROTO_NAMESPACE $Namespace)
PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
}
# tag:proto
### @usage PROTOC_FATAL_WARNINGS()
###
### Treat protoc warnings as fatal errors that break the build, for example, unused imports
### Adds `--fatal_warnings` argument to protoc
macro PROTOC_FATAL_WARNINGS() {
SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
}
# tag:proto tag:internal tag:python-specific
### @usage: OPTIMIZE_PY_PROTOS() # internal
###
### Enable Python proto optimization by embedding corresponding C++ code into binary.
### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
macro OPTIMIZE_PY_PROTOS() {
SET(OPTIMIZE_PY_PROTOS_FLAG yes)
}
# tag:proto tag:python-specific
### @usage: NO_OPTIMIZE_PY_PROTOS()
###
### Disable Python proto optimization using embedding corresponding C++ code into binary.
### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
### This is default mode only for some system libraries.
macro NO_OPTIMIZE_PY_PROTOS() {
SET(OPTIMIZE_PY_PROTOS_FLAG no)
}
# tag:proto tag:python-specific
macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
.CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
.SEM=IGNORED
}
# tag:proto tag:python-specific
macro _ADD_PY_PROTO_OUT(Suf) {
SET_APPEND(PY_PROTO_OUTS \${hide;noauto;output;norel;nopath;noext;suf=$Suf:File})
SET_APPEND(PY_PROTO_OUTS_INTERNAL \${hide;noauto;output;norel;nopath;noext;suf=__int${_PYTHON_VER}__$Suf:File} \${hide;kv:"ext_out_name_for_\${nopath;noext;suf=__int${_PYTHON_VER}__$Suf:File} \${nopath;noext;suf=$Suf:File}"})
# XXX fix variable expansion in plugins
SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
}
# tag:proto tag:python-specific
### @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)
}
# tag:proto tag:python-specific
### @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)
}
# tag:proto tag:java-specific
macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
.CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
}
# tag:proto tag:java-specific
### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
###
### Define protoc plugin for Java with given Name that emits extra outputs
### using Tool. Extra dependencies are passed via DEPS
macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
# XXX fix variable expansion in plugins
SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
}
macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
.SEM=${pre=&& target_properties-ITEM && target_properties-name $Prop && target_properties-value :Args}
}
# tag:proto tag:java-specific
_WITH_KOTLIN_GRPC_SEM=
macro WITH_KOTLIN_GRPC() {
ENABLE(KOTLIN_PROTO)
PEERDIR(build/platform/java/kotlin_grpc)
SET_APPEND(JAVA_PROTO_ARGS ${env:"JAVA_HOME=${JDK_RESOURCE}"} ${env:"KOTLIN_GRPC_JAR=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/protoc-gen-grpc-kotlin-${KOTLIN_GRPC_VERSION}.jar"} --plugin=protoc-gen-kotlin_grpc=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/grpc_kotlin --kotlin_grpc_out=$ARCADIA_BUILD_ROOT/java_out)
SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/io/grpc/grpc-kotlin-stub/$KOTLIN_GRPC_VERSION)
SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
SET(_WITH_KOTLIN_GRPC_SEM && proto_kotlin_grpc && proto_kotlin_grpc_version ${KOTLIN_GRPC_VERSION})
}
# tag:proto tag:cpp-specific
macro _ADD_CPP_PROTO_OUT(Suf) {
SET_APPEND(CPP_PROTO_OUTS \${output;norel;nopath;noext;suf=$Suf:File})
SET_APPEND(PROTOC_EXTRA_OUTS_SEM && protoc_extra_outs $Suf \${hide;output;suf=.o:Suf} \$_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE))
# XXX fix variable expansion in plugins
SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
}
# tag:proto tag:cpp-specific
HAS_CPP_PROTOBUF_PEERS=no
CPP_PROTOBUF_PEERS=
# tag:proto tag:cpp-specific
### @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[], EXTRA_OUT_FLAG="") {
.SEM=target_macroses-ITEM && target_macroses-macro target_proto_plugin && target_macroses-args $NAME ${tool;rootrel:TOOL} ${hide;output;suf=.fake.o:NAME}
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)
SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
}
# tag:proto tag:cpp-specific
### @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[], 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>] [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[], 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 \${hide;output;norel;nopath;noext;suf=$SUF2:File})
}
# tag:proto
### @usage: USE_SKIFF() #wip, do not use
###
### Use mapreduce/yt/skiff_proto/plugin for C++
macro USE_SKIFF() {
# Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
}
# tag:go-specific
_GO_COMMON_GOOGLE_APIS = \
vendor/google.golang.org/genproto/googleapis/api/annotations \
vendor/google.golang.org/genproto/googleapis/api/configchange \
vendor/google.golang.org/genproto/googleapis/api/distribution \
vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
vendor/google.golang.org/genproto/googleapis/api/httpbody \
vendor/google.golang.org/genproto/googleapis/api/label \
vendor/google.golang.org/genproto/googleapis/api/metric \
vendor/google.golang.org/genproto/googleapis/api/monitoredres \
vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
vendor/cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb \
vendor/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb \
vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
vendor/google.golang.org/genproto/googleapis/iam/v1 \
vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
vendor/google.golang.org/genproto/googleapis/logging/type \
vendor/google.golang.org/genproto/googleapis/logging/v2 \
vendor/google.golang.org/genproto/googleapis/rpc/code \
vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
vendor/google.golang.org/genproto/googleapis/rpc/status \
vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
vendor/google.golang.org/genproto/googleapis/type/color \
vendor/google.golang.org/genproto/googleapis/type/date \
vendor/google.golang.org/genproto/googleapis/type/dayofweek \
vendor/google.golang.org/genproto/googleapis/type/expr \
vendor/google.golang.org/genproto/googleapis/type/fraction \
vendor/google.golang.org/genproto/googleapis/type/latlng \
vendor/google.golang.org/genproto/googleapis/type/money \
vendor/google.golang.org/genproto/googleapis/type/postaladdress \
vendor/google.golang.org/genproto/googleapis/type/quaternion \
vendor/google.golang.org/genproto/googleapis/type/timeofday
# tag:go-specific
_COMMON_GOOGLE_APIS=None
# tag:go-specific
### @usage: USE_COMMON_GOOGLE_APIS([apis...])
###
### Use common-google-apis library set. Pass optional apis list to be used or use them all.
### This macro is properly handled for all languages including Go, where apis come in
## pregenerated form. In other languages apis are generated from sources in Arcadia.
macro USE_COMMON_GOOGLE_APIS(APIS...) {
SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
}
# tag:go-specific tag:proto
GO_PROTO_GEN_PLUGINS=
GO_PROTO_OPTS=
GO_PROTO_OUTS=
GO_PROTO_GRPC_OPTS=
GO_PROTO_GRPC_OUTS=
GO_PROTO_V2=no
_GO_PROTO_CHECK_OUTPUT=
# tag:go-specific tag:proto
GO_PROTOBUF_IMPORTS=\
${GOSTD}/sync \
${GOSTD}/reflect \
${GOSTD}/fmt \
${GOSTD}/math \
vendor/github.com/golang/protobuf/proto \
vendor/google.golang.org/protobuf/types/descriptorpb \
vendor/google.golang.org/protobuf/runtime/protoimpl \
vendor/google.golang.org/protobuf/runtime/protoiface \
vendor/google.golang.org/protobuf/reflect/protoreflect
# tag:go-specific tag:proto
GO_PROTOBUF_WELLKNOWN_TYPES=\
vendor/google.golang.org/protobuf/types/known/anypb \
vendor/google.golang.org/protobuf/types/known/apipb \
vendor/google.golang.org/protobuf/types/known/durationpb \
vendor/google.golang.org/protobuf/types/known/emptypb \
vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
vendor/google.golang.org/protobuf/types/known/structpb \
vendor/google.golang.org/protobuf/types/known/timestamppb \
vendor/google.golang.org/protobuf/types/known/typepb \
vendor/google.golang.org/protobuf/types/known/wrapperspb
# tag:go-specific tag:proto
### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
###
### Define protoc plugin for GO with given Name that emits extra output with provided extension
### Ext using Tool. Extra dependencies are passed via DEPS.
macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
SET_APPEND(GO_PROTO_OUTS \${hide;noauto;output;norel;nopath;noext;suf=$EXT:File})
PEERDIR(${DEPS})
}
# tag:go-specific tag:proto
GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/go_proto_wrapper.py"} --arcadia-prefix $GO_ARCADIA_PROJECT_PREFIX --contrib-prefix $GO_CONTRIB_PROJECT_PREFIX --namespace ./$PROTO_NAMESPACE $_GO_PROTO_CHECK_OUTPUT --proto ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_INCLUDE_PATH $_PROTOC_FLAGS ${hide:PROTO_FAKEID}
# tag:go-specific tag:proto
macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
.CMD=$GO_PROTO_CMDLINE $OPTS ${hide;kv:"p PB"} ${hide;kv:"pc yellow"}
.PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
.ADDINCL=FOR proto ${PROTOBUF_INCLUDE_PATH}
}
# tag:go-specific tag:proto
macro _GO_PROTO_CMD(File) {
.CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
}
# tag:proto
### @usage: YT_ORM_PROTO_YSON(Files... OUT_OPTS Opts...)
###
### Generate .yson.go from .proto using yt/yt/orm/go/codegen/yson/internal/proto-yson-gen/cmd/proto-yson-gen
macro YT_ORM_PROTO_YSON(OUT_OPTS[], Files...) {
.CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yt/yt/orm/go/codegen/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" $_PROTOC_FLAGS ${input:Files} ${hide;noauto;output;nopath;noext;suf=.yson.go:Files} ${hide:PROTO_FAKEID}
.ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto ${PROTOBUF_INCLUDE_PATH}
.PEERDIR=$GOSTD/strings $GOSTD/fmt $GOSTD/errors $GOSTD/encoding/json library/go/core/xerrors yt/go/yson yt/go/yterrors yt/yt/orm/go/codegen/yson/ytypes contrib/libs/protobuf
}
_SEM_CPP_PROTO_CMD=target_options-privates-ITEM && target_options-privates-option target_proto_messages && target_options-privates-args ${input:File} \
$CPP_PROTO_OUTS_SEM ${hide;output;suf=${OBJ_SUF}.pb.o:File} $DEFAULT_PROTOC_TOOLS \
$PROTOC_EXTRA_OUTS_SEM \
&& platform_vars-COMMON_PROTOC_FLAGS "" \
&& target_macroses-ITEM && target_macroses-macro target_proto_outs && target_macroses-args --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
&& target_macroses-ITEM && target_macroses-macro target_proto_addincls && target_macroses-args ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_INCLUDE_PATH
# tag:proto
macro _CPP_PROTO_CMD(File) {
.CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS ${hide;kv:"p PB"} ${hide;kv:"pc yellow"}
.SEM=$_SEM_CPP_PROTO_CMD
.PEERDIR=contrib/libs/protobuf
}
# tag:proto
macro _CPP_VANILLA_PROTO_CMD(File) {
.CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS ${hide;kv:"p PB"} ${hide;kv:"pc yellow"}
.PEERDIR=contrib/libs/protobuf_std
}
_SEM_CPP_EV_CMD=target_options-privates-ITEM && target_options-privates-option target_ev_messages && target_options-privates-args ${input:File} \
$CPP_EV_OUTS_SEM ${hide;output;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} $DEFAULT_PROTOC_TOOLS \
&& platform_vars-COMMON_PROTOC_FLAGS "" \
&& target_macroses-ITEM && target_macroses-macro target_proto_outs && target_macroses-args --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
&& target_macroses-ITEM && target_macroses-macro target_proto_addincls && target_macroses-args ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_INCLUDE_PATH $ARCADIA_ROOT/library/cpp/eventlog
# tag:proto
macro _CPP_EVLOG_CMD(File) {
.CMD=$CPP_EV_CMDLINE $CPP_EV_OPTS ${hide;kv:"p EV"} ${hide;kv:"pc yellow"}
.SEM=$_SEM_CPP_EV_CMD
.PEERDIR=library/cpp/eventlog contrib/libs/protobuf
}
# tag:proto
macro _CPP_PROTO_EVLOG_CMD(File) {
# process .proto as .ev
.CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS ${hide;kv:"p PB"} ${hide;kv:"pc yellow"}
.PEERDIR=library/cpp/eventlog contrib/libs/protobuf
}
# tag:proto
macro _CPP_CFGPROTO_CMD(File) {
# keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
.CMD=$CPP_EV_CMDLINE --plugin=protoc-gen-config=${tool:"library/cpp/proto_config/plugin"} --config_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE ${hide;kv:"p PB"} ${hide;kv:"pc yellow"}
.PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
}
# tag:proto
PY_PROTO_MYPY_ENABLED=yes
PY_PROTO_MYPY_PLUGIN_BASE=--plugin=protoc-gen-mypy=${tool:"contrib/python/mypy-protobuf/bin/protoc-gen-mypy"} --mypy_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
# tag:proto tag:python-specific
PY_PROTO_MYPY_SUFFIX=
PY_PROTO_MYPY_PLUGIN=
PY_PROTO_MYPY_PLUGIN_INTERNAL=
# tag:proto tag:python-specific
macro NO_MYPY() {
DISABLE(PY_PROTO_MYPY_ENABLED)
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
.CMD=$PY_PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_INCLUDE_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS ${input;rootrel:File} ${output;main;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${hide;kv:"p PB"} ${hide;kv:"pc yellow"} $Args ${hide:PROTO_FAKEID}
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
}
# tag:proto tag:python-specific
macro _PY_PROTO_CMD_INTERNAL(File) {
.CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_PROTO_SUFFIXES $PY_PROTO_MYPY_SUFFIX --input ${input;rootrel:File} --ns /$PROTO_NAMESPACE -- $_PY_PROTO_CMD_BASE($File __int${_PYTHON_VER}___pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS_INTERNAL ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int${_PYTHON_VER}___pb2.py:File} ${nopath;noext;suf=_pb2.py:File}"} $PY_PROTO_MYPY_PLUGIN_INTERNAL)
}
# tag:proto tag:java-specific
JAVA_PROTO_RUNTIME=
# tag:proto tag:java-specific
### @usage: USE_JAVALITE()
### Use protobuf-javalite for Java
macro USE_JAVALITE() {
SET(JAVA_PROTO_RUNTIME javalite)
}
# tag:proto tag:java-specific
JAVA_PROTO_COMPILER_VERSION = 3.25.3
JAVA_PROTO_RUNTIME_VERSION = 3.25.3
JAVA_PROTO_COMMON_VERSION = 2.9.0
JAVA_GRPC_VERSION = 1.51.0
KOTLIN_GRPC_VERSION = 1.3.1
JAVA_NETTY_NETTY_VERSION = 4.1.79.Final
KOTLIN_PROTO=no
KOTLIN_PROTO_PEERS=
when ($JAVA_PROTO_RUNTIME == "javalite") {
_JAVA_PROTO_LITE_ARG=lite:
JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/${JAVA_GRPC_VERSION}
JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/${JAVA_GRPC_VERSION}
}
otherwise {
_JAVA_PROTO_LITE_ARG=
JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/${JAVA_GRPC_VERSION}
JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/${JAVA_GRPC_VERSION}
}
KOTLIN_PROTO_FLAGS=
# tag:proto tag:java-specific
macro _JAVA_PROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $JAVA_PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT --java_out=${_JAVA_PROTO_LITE_ARG}$ARCADIA_BUILD_ROOT/java_out ${KOTLIN_PROTO_FLAGS} $_PROTOC_FLAGS ${input;rootrel:File} ${hide;kv:"p PB"} ${hide;kv:"pc yellow"} $JAVA_PROTO_ARGS ${hide:PROTO_FAKEID}
.SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
}
# tag:proto tag:perl-specific tag:deprecated
### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
###
### Generate Perl code from protobuf.
### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
macro XS_PROTO(File, Dir, Outputs...) {
.CMD=${PROTOC_OLD} -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_OLD_PATH} --perlxs_out=${BINDIR} $_PROTOC_FLAGS ${input:File} ${hide;output:Outputs} ${induced_deps=h+cpp;hide;nopath;noext;suf=.pb.h:File} ${hide:PROTO_FAKEID}
PEERDIR(${Dir})
ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
}
# tag:proto tag:python-specific
when ($PY_PROTOS_FOR == "yes") {
PEERDIR+=contrib/libs/protobuf/python
}
# tag:python-specific
macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
.CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
.PEERDIR=library/cpp/eventlog/proto
}
# tag:python-specific tag:proto
macro _PY_EVLOG_CMD(File) {
.CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
}
# tag:python-specific tag:proto
macro _PY_EVLOG_CMD_INTERNAL(File) {
.CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_EVLOG_SUFFIXES --input ${input;rootrel:File} --ns /$PROTO_NAMESPACE -- $_PY_EVLOG_CMD_BASE($File __int${_PYTHON_VER}___ev_pb2.py ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int${_PYTHON_VER}___ev_pb2.py:File} ${nopath;noext;suf=_ev_pb2.py:File}"})
}
# tag:java-specific tag:proto
macro _JAVA_EVLOG_CMD(File) {
.CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${hide;kv:"p EV"} ${hide;kv:"pc yellow"}
.PEERDIR=library/cpp/eventlog/proto
}
# 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()
###
### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
macro GRPC() {
ENABLE(_GRPC_ENABLED)
# C++
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)
# Java
JAVA_PROTO_PLUGIN(grpc_java build/platform/java/grpc DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
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 ${hide;output;norel;nopath;noext;suf=_mock$_GRPC_SUF_H:File})
}
macro GO_PROTO_USE_V2() {
ENABLE(GO_PROTO_V2)
}
# tag:proto
### @usage: RESOLVE_PROTO()
###
### Enable include resolving within UNIONs and let system .proto being resolved
### among .proto/.gztproto imports
###
### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
macro RESOLVE_PROTO() {
SET(DONT_RESOLVE_INCLUDES no)
ADDINCL(FOR proto $PROTOBUF_INCLUDE_PATH)
}
# tag:python-specific tag:proto tag:deprecated
### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
###
### Generate python bindings for protobuf files.
### Macro is obsolete and not recommended for use!
macro GENERATE_PY_PROTOS(FILES...) {
foreach (FILE : $FILES) {
_PY_PROTO_CMD($FILE)
}
}
# tag:python-specific tag:proto
macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
foreach (FILE : $FILES) {
_PY_PROTO_CMD_INTERNAL($FILE)
}
}
# tag:python-specific
macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
foreach (FILE : $FILES) {
_PY_EVLOG_CMD_INTERNAL($FILE)
}
}
### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
###
### Create list of .proto files in a list-file (should be .proto, files.proto by default)
### with original .proto-files as list's dependencies.
###
### This allows to process files listed, passing list as an argument to the processor
###
### TODO: proper implementation needed
macro LIST_PROTO(TO="files.proto", Files...) {
.CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${hide;input:Files} ${stdout;noauto;output:TO} ${output_include;from_input;hide:Files}
_COMPILE_LIST_PROTO(${TO})
_EXPOSE(${TO})
}
macro _COMPILE_LIST_PROTO(SRC) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${hide;input:SRC} ${output;noext;suf=.pb.h:SRC}
}
# tag:proto
macro _PROTO_DESC_RAWPROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/desc_rawproto_wrapper.py"} --desc-output ${output;suf=.desc:File} --rawproto-output ${output;norel;suf=.${_MODDIR_HASH}.rawproto:File} --proto-file ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_INCLUDE_PATH --include_source_info $_PROTOC_FLAGS ${hide:PROTO_FAKEID}
}
_PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/merge_files.py"} $TARGET ${ext=.desc:AUTO_INPUT} ${hide;kv:"p PD"} ${hide;kv:"pc light-cyan"} && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/collect_rawproto.py"} --output ${output;suf=.protosrc:REALPRJNAME} ${rootrel;ext=.rawproto:AUTO_INPUT}
_PROTO_DESC_MERGE_PEERS_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/merge_files.py"} $TARGET $PEERS ${ext=.protodesc:SRCS_GLOBAL} ${hide;kv:"p PD"} ${hide;kv:"pc light-cyan"} && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/merge_protosrc.py"} --output ${output;suf=.tar:REALPRJNAME} ${rootrel:PEERS}
NEED_GOOGLE_PROTO_PEERDIRS=yes
CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
module _CPP_PROTO : LIBRARY {
.ALLOWED=_EXPOSE LIST_PROTO
FORCE_COVERAGE_DISABLED=yes
ENABLE(CPP_PROTO)
ENABLE(GEN_PROTO)
NO_CLANG_TIDY()
CPP_PROTOLIBS_DEBUG_INFO()
SET(PEERDIR_TAGS)
when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
_OK=no
}
ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
}
module _JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
.EXTS=.jsrc
.ALLOWED=GRPC
SET(PEERDIR_TAGS JAVA)
ENABLE(JAVA_PROTO)
DISABLE(_NEED_SBOM_INFO)
PEERDIR+=$JAVA_PROTOBUF_PEERS
when ($KOTLIN_PROTO == "yes") {
KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
}
when ($GRADLE_EXPORT_PUBLISHING == "yes") {
_GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
}
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
ADDINCL(FOR proto $PROTOBUF_INCLUDE_PATH)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
}
module _PY_PROTO: PY2_LIBRARY {
.ALIASES=SRCS=PY_SRCS
.ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
SET(PEERDIR_TAGS PY2)
ENABLE(PY_PROTO)
DISABLE(_NEED_SBOM_INFO)
OPTIMIZE_PY_PROTOS()
OBJ_SUF=.py2
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
_IGNORE_SELF_PEERS=
_CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
_IGNORE_PEERDIRSELF=CPP_PROTO
}
SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
}
module _PY3_PROTO: PY3_LIBRARY {
.ALIASES=SRCS=PY_SRCS
.ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
SET(PEERDIR_TAGS PY3)
ENABLE(PY3_PROTO)
DISABLE(_NEED_SBOM_INFO)
OPTIMIZE_PY_PROTOS()
OBJ_SUF=.py3
# Can not use NO_LINT(), because is not allowed outside of contrib directory
SET(_NO_LINT_VALUE none_internal)
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
_IGNORE_SELF_PEERS=
_CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
_IGNORE_PEERDIRSELF=CPP_PROTO
}
SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
}
module _GO_PROTO: GO_LIBRARY {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
SET(PEERDIR_TAGS GO)
ENABLE(GO_PROTO)
when ($_COMMON_GOOGLE_APIS == "None") {
}
elsewhen ($_COMMON_GOOGLE_APIS == "") {
PEERDIR += $_GO_COMMON_GOOGLE_APIS
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
otherwise {
PEERDIR += $_COMMON_GOOGLE_APIS
ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
}
}
module _TS_PROTO: _TS_PROTO_IMPL {
DISABLE(_NEED_SBOM_INFO)
}
module _TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
.IGNORED=PEERDIR
DISABLE(_NEED_SBOM_INFO)
}
module _DESC_PROTO: _BARE_UNIT {
.CMD=_PROTO_DESC_MERGE_CMD
.EXTS=.desc .rawproto
.NODE_TYPE=Library
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
.ALIASES=SRCS=_SRCS_NO_GLOBAL
ENABLE(DESC_PROTO)
DISABLE(_NEED_SBOM_INFO)
MODULE_SUFFIX=.self.protodesc
SET(MODULE_TYPE LIBRARY)
SET(_MODDIR_HASH ${hash:MODDIR})
_EVLOG_CMDLINE=$_PROTO_DESC_CMDLINE
_PROTO_CMDLINE=$_PROTO_DESC_CMDLINE
when ($_COMMON_GOOGLE_APIS != "None") {
PEERDIR += contrib/libs/googleapis-common-protos
}
when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
when ($USE_VANILLA_PROTOC == "yes") {
PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
}
otherwise {
PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
}
}
}
# tag:proto
### @usage: PROTO_LIBRARY()
###
### Build some varian of protocol buffers library.
###
### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
###
### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
### When PEERDIR comes from module for particular language appropriate variant is selected.
### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
### Notes:
### - Python versions emit C++ code in addition to Python as optimization.
### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
### - Use from DEPENDS or BUNDLE is not allowed
###
### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
###
### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
multimodule PROTO_LIBRARY {
module CPP_PROTO: _CPP_PROTO {
# TODO(svidyuk): think about marker which forces semantics inheritance
.SEM=CPP_PROTO_LIBRARY_SEM
SET_APPEND(PEERDIR_TAGS CPP_PROTO)
}
module JAVA_PROTO: _JAVA_PROTO {
.SEM=JAVA_PROTO_LIBRARY_SEM
SET_APPEND(PEERDIR_TAGS JAVA_PROTO)
}
module PY_PROTO: _PY_PROTO {
.SEM=IGNORED
SET_APPEND(PEERDIR_TAGS PY_PROTO)
.PEERDIRSELF=CPP_PROTO
}
module PY3_PROTO: _PY3_PROTO {
.SEM=IGNORED
SET_APPEND(PEERDIR_TAGS PY3_PROTO)
.PEERDIRSELF=CPP_PROTO
}
module GO_PROTO: _GO_PROTO {
.SEM=IGNORED
SET_APPEND(PEERDIR_TAGS GO_PROTO)
}
module TS_PROTO: _TS_PROTO {
# opt-in. We don't want to have TS_PROTO by default
# To include TS_PROTO user have to set INCLUDE_TAGS(TS_PROTO TS_PREPARE_DEPS) in ya.make
.INCLUDE_TAG=no
.PEERDIRSELF=TS_PREPARE_DEPS
.EPILOGUE=_TS_CONFIG_EPILOGUE
SET_APPEND(PEERDIR_TAGS TS_PROTO)
}
module TS_PREPARE_DEPS: _TS_PREPARE_DEPS {
.INCLUDE_TAG=no
SET_APPEND(PEERDIR_TAGS TS_PREPARE_DEPS)
}
module DESC_PROTO: _DESC_PROTO {
.SEM=IGNORED
SET_APPEND(PEERDIR_TAGS DESC_PROTO)
}
}
module PROTO_DESCRIPTIONS: _BARE_UNIT {
.CMD=_PROTO_DESC_MERGE_PEERS_CMD
.PEERDIR_POLICY=as_build_from
.NODE_TYPE=Library
.RESTRICTED=SRCS
.FINAL_TARGET=yes
SET(MODULE_TAG PROTO_DESCRIPTIONS)
SET(PEERDIR_TAGS DESC_PROTO DESC_PROTO_FROM_SCHEMA)
SET(MODULE_SUFFIX .protodesc)
SET(MODULE_TYPE PROTO_DESCRIPTIONS)
}
module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
SET(MODULE_TAG PROTO_REGISTRY)
SET(MODULE_TYPE PROTO_REGISTRY)
}
# tag:proto
### @usage: PROTO_SCHEMA()
###
### Build some variant of protocol buffers library or proto descriptions.
###
### When used as a PEERDIR from a language module like GO_PROGRAM it behaves like PROTO_LIBRARY.
### When built directly it produces proto descriptions. When required by RECURSE it produces
### both proto descriptions and language libraries.
### PROTO_SCHEMA can depend on PROTO_LIBRARY, but PROTO_LIBRARY cannot depend on PROTO_SCHEMA.
###
### See: [PROTO_LIBRARY()](#module_PROTO_LIBRARY)
multimodule PROTO_SCHEMA {
module CPP_PROTO_FROM_SCHEMA: _CPP_PROTO {
# TODO(svidyuk): think about marker which forces semantics inheritance
.SEM=CPP_PROTO_LIBRARY_SEM
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS CPP_PROTO CPP_PROTO_FROM_SCHEMA)
}
module JAVA_PROTO_FROM_SCHEMA: _JAVA_PROTO {
.SEM=JAVA_PROTO_LIBRARY_SEM
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS JAVA_PROTO JAVA_PROTO_FROM_SCHEMA)
}
module PY_PROTO_FROM_SCHEMA: _PY_PROTO {
.SEM=IGNORED
.PEERDIRSELF=CPP_PROTO_FROM_SCHEMA
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS PY_PROTO PY_PROTO_FROM_SCHEMA)
}
module PY3_PROTO_FROM_SCHEMA: _PY3_PROTO {
.SEM=IGNORED
.PEERDIRSELF=CPP_PROTO_FROM_SCHEMA
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS PY3_PROTO PY3_PROTO_FROM_SCHEMA)
}
module GO_PROTO_FROM_SCHEMA: _GO_PROTO {
.SEM=IGNORED
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS GO_PROTO GO_PROTO_FROM_SCHEMA)
}
module TS_PROTO_FROM_SCHEMA: _TS_PROTO {
# opt-in. We don't want to have TS_PROTO by default
# To include TS_PROTO user have to set INCLUDE_TAGS(TS_PROTO TS_PREPARE_DEPS) in ya.make
.INCLUDE_TAG=no
.PEERDIRSELF=TS_PREPARE_DEPS_FROM_SCHEMA
.EPILOGUE=_TS_CONFIG_EPILOGUE
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS TS_PROTO TS_PROTO_FROM_SCHEMA)
}
module TS_PREPARE_DEPS_FROM_SCHEMA: _TS_PREPARE_DEPS {
.INCLUDE_TAG=no
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS TS_PREPARE_DEPS TS_PREPARE_DEPS_FROM_SCHEMA)
}
module DESC_PROTO_FROM_SCHEMA: _DESC_PROTO {
.SEM=IGNORED
DISABLE(START_TARGET)
SET_APPEND(PEERDIR_TAGS DESC_PROTO DESC_PROTO_FROM_SCHEMA)
}
module PROTO_DESCRIPTIONS_: PROTO_DESCRIPTIONS {
.PEERDIRSELF=DESC_PROTO_FROM_SCHEMA
.FINAL_TARGET=yes
SET_APPEND(PEERDIR_TAGS DESC_PROTO_FROM_SCHEMA)
}
}
macro EVLOG_CMD(SRC) {
.CMD=$_EVLOG_CMDLINE
.SEM=$_EVLOG_CMDLINE
}
macro PROTO_CMD(SRC) {
.CMD=$_PROTO_CMDLINE
.SEM=$_PROTO_CMDLINE
}
_CPP_EVLOG_CMDLINE=$_CPP_EVLOG_CMD($SRC)
_CPP_PROTO_CMDLINE=$_CPP_PROTO_CMD($SRC)
_CPP_PROTO_EVLOG_CMDLINE=$_CPP_PROTO_EVLOG_CMD($SRC)
_CPP_VANILLA_PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMD($SRC)
_JAVA_EVLOG_CMDLINE=$_JAVA_EVLOG_CMD($SRC)
_JAVA_PROTO_CMDLINE=$_JAVA_PROTO_CMD($SRC)
_PROTO_DESC_CMDLINE=$_PROTO_DESC_RAWPROTO_CMD($SRC)
_PY_EVLOG_CMDLINE=$_PY_EVLOG_CMD($SRC)
_PY_PROTO_CMDLINE=$_PY_PROTO_CMD($SRC)