123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881 |
- # 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
- # 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 \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
- SET_APPEND(PY_PROTO_OUTS_INTERNAL \${output;hide;noauto;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=&& set_target_property $Prop :Args} ${pre=&& target_properties-ITEM && target_properties-name $Prop && target_properties-value :Args}
- }
- # tag:proto tag:java-specific
- 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-1.3.1.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/1.3.1)
- SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
- }
- # tag:proto tag:cpp-specific
- macro _ADD_CPP_PROTO_OUT(Suf) {
- .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf && protoc_extra_outs $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
- SET_APPEND(CPP_PROTO_OUTS \${output;norel;nopath;noext;suf=$Suf:File})
- # 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_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME} && target_macroses-ITEM && target_macroses-macro target_proto_plugin && target_macroses-args $NAME ${tool;rootrel:TOOL} ${output;hide;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 \${output;hide;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 \${output;hide;noauto;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 ${kv;hide:"p PB"} ${kv;hide:"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} ${output;hide;noauto;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_proto_messages PRIVATE ${input:File} \
- && target_options-privates-ITEM && target_options-privates-option target_proto_messages && target_options-privates-args ${input:File} \
- $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} $DEFAULT_PROTOC_TOOLS \
- && set_global_flags COMMON_PROTOC_FLAGS \
- && platform_vars-COMMON_PROTOC_FLAGS "" \
- && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
- && target_macroses-ITEM && target_macroses-macro target_proto_outs && target_macroses-args --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
- && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_INCLUDE_PATH \
- && 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 ${kv;hide:"p PB"} ${kv;hide:"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 ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
- .PEERDIR=contrib/libs/protobuf_std
- }
- _SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} \
- && target_options-privates-ITEM && target_options-privates-option target_ev_messages && target_options-privates-args ${input:File} \
- $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} $DEFAULT_PROTOC_TOOLS \
- && set_global_flags COMMON_PROTOC_FLAGS \
- && platform_vars-COMMON_PROTOC_FLAGS "" \
- && target_proto_outs --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_outs && target_macroses-args --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
- && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_INCLUDE_PATH $ARCADIA_ROOT/library/cpp/eventlog \
- && 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 ${kv;hide:"p EV"} ${kv;hide:"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 ${kv;hide:"p PB"} ${kv;hide:"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 ${kv;hide:"p PB"} ${kv;hide:"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} ${kv;hide:"p PB"} ${kv;hide:"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
- 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} ${kv;hide:"p PB"} ${kv;hide:"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} ${kv;hide:"p EV"} ${kv;hide:"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 ${output;hide;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} ${input;hide:Files} ${stdout;output;noauto: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"} ${input;hide: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} ${kv;hide:"p PD"} ${kv;hide:"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} ${kv;hide:"p PD"} ${kv;hide:"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
- # 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 : LIBRARY {
- .ALLOWED=_EXPOSE LIST_PROTO
- # TODO(svidyuk): think about marker which forces semantics inheritance
- .SEM=CPP_PROTO_LIBRARY_SEM
- FORCE_COVERAGE_DISABLED=yes
- ENABLE(CPP_PROTO)
- ENABLE(GEN_PROTO)
- NO_CLANG_TIDY()
- CPP_PROTOLIBS_DEBUG_INFO()
- SET(PEERDIR_TAGS CPP_PROTO)
- 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
- .SEM=JAVA_PROTO_LIBRARY_SEM
- SET(PEERDIR_TAGS JAVA JAVA_PROTO)
- 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
- .PEERDIRSELF=CPP_PROTO
- .SEM=IGNORED
- SET(PEERDIR_TAGS PY2 PY_PROTO)
- 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
- .PEERDIRSELF=CPP_PROTO
- .SEM=IGNORED
- SET(PEERDIR_TAGS PY3 PY3_PROTO)
- 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
- .SEM=IGNORED
- SET(PEERDIR_TAGS GO GO_PROTO)
- 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 {
- # opt-in. We don't want to have TS_PROTO by default
- # To include TS_PROTO user have to set INCLUDE_TAGS(TS_PROTO) in ya.make
- .INCLUDE_TAG=no
- .EPILOGUE=_TS_CONFIG_EPILOGUE
- .PEERDIRSELF=TS_PREPARE_DEPS
- DISABLE(_NEED_SBOM_INFO)
- }
- module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
- .INCLUDE_TAG=no
- .IGNORED=PEERDIR
- DISABLE(_NEED_SBOM_INFO)
- }
- module DESC_PROTO: _BARE_UNIT {
- .CMD=_PROTO_DESC_MERGE_CMD
- .SEM=IGNORED
- .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
- SET(PEERDIR_TAGS DESC_PROTO)
- 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
- }
- }
- }
- }
- 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)
- SET(MODULE_SUFFIX .protodesc)
- SET(MODULE_TYPE PROTO_DESCRIPTIONS)
- }
- module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
- SET(MODULE_TAG PROTO_REGISTRY)
- SET(MODULE_TYPE PROTO_REGISTRY)
- }
- 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)
|