proto.conf 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. # tag:tool-specific tag:proto
  2. PROTOC=${tool:"contrib/tools/protoc"}
  3. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  4. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  5. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  6. USE_VANILLA_PROTOC=no
  7. PROTOC_TRANSITIVE_HEADERS=yes
  8. _PROTOC_FLAGS=
  9. # tag:proto
  10. PY_PROTOS_FOR=no
  11. BUILD_PROTO_AS_EVLOG=no
  12. # tag:proto
  13. PROTO_NAMESPACE=
  14. # tag:proto tag:python-specific
  15. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  16. # tag:proto tag:cpp-specific
  17. PROTO_HEADER_EXTS=.pb.h
  18. CPP_PROTO_CMDLINE=
  19. CPP_PROTO_OPTS=
  20. CPP_PROTO_OUTS=
  21. CPP_PROTO_OUTS_SEM=
  22. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  23. CPP_PROTO_PLUGINS=
  24. # tag:proto tag:cpp-specific
  25. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  26. CPP_EV_OUTS=
  27. CPP_EV_OUTS_SEM=
  28. # tag:proto tag:python-specific
  29. PY_PROTO_OPTS=
  30. PY_PROTO_OUTS=
  31. PY_PROTO_OUTS_INTERNAL=
  32. PY_PROTO_DEPS=
  33. PY_PROTO_SUFFIXES=_pb2.py
  34. PY_EVLOG_SUFFIXES=_ev_pb2.py
  35. # tag:proto tag:java-specific
  36. JAVA_PROTO_ARGS=
  37. # tag:proto tag:python-specific
  38. OPTIMIZE_PY_PROTOS_FLAG=no
  39. # tag:internal
  40. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  41. ###
  42. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  43. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  44. ADDINCL($BUILD $SOURCE)
  45. }
  46. # tag:proto
  47. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  48. ###
  49. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  50. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  51. ### proper dependency resolution at configure-time.
  52. ###
  53. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  54. ### from dependency via PROTO_NAMESPACE macro
  55. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  56. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  57. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  58. }
  59. # tag:proto
  60. ### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
  61. ###
  62. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  63. ### which defines output path for .proto generation.
  64. ###
  65. ### For proper importing and configure-time dependency management it sets ADDINCLs
  66. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  67. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  68. ### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
  69. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  70. ### parameter will add appropriate dir from the build root for .proto files search.
  71. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  72. SET(PROTO_NAMESPACE $Namespace)
  73. PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
  74. }
  75. # tag:proto
  76. ### @usage PROTOC_FATAL_WARNINGS()
  77. ###
  78. ### Treat protoc warnings as fatal errors that break the build, for example, unused imports
  79. ### Adds `--fatal_warnings` argument to protoc
  80. macro PROTOC_FATAL_WARNINGS() {
  81. SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
  82. }
  83. # tag:proto tag:internal tag:python-specific
  84. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  85. ###
  86. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  87. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  88. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  89. macro OPTIMIZE_PY_PROTOS() {
  90. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  91. }
  92. # tag:proto tag:python-specific
  93. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  94. ###
  95. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  96. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  97. ### This is default mode only for some system libraries.
  98. macro NO_OPTIMIZE_PY_PROTOS() {
  99. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  100. }
  101. # tag:proto tag:python-specific
  102. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  103. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
  104. .SEM=IGNORED
  105. }
  106. # tag:proto tag:python-specific
  107. macro _ADD_PY_PROTO_OUT(Suf) {
  108. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  109. SET_APPEND(PY_PROTO_OUTS_INTERNAL \${output;hide;noauto;norel;nopath;noext;suf=__int__$Suf:File} \${hide;kv:"ext_out_name_for_\${nopath;noext;suf=__int__$Suf:File} \${nopath;noext;suf=$Suf:File}"})
  110. # XXX fix variable expansion in plugins
  111. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  112. }
  113. # tag:proto tag:python-specific
  114. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  115. ###
  116. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  117. ### using Tool. Extra dependencies are passed via DEPS
  118. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  119. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  120. _ADD_PY_PROTO_OUT($EXT)
  121. # XXX fix variable expansion in plugins
  122. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  123. }
  124. # tag:proto tag:python-specific
  125. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  126. ###
  127. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  128. ### using Tool. Extra dependencies are passed via DEPS
  129. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  130. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  131. _ADD_PY_PROTO_OUT($EXT2)
  132. }
  133. # tag:proto tag:java-specific
  134. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  135. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  136. }
  137. # tag:proto tag:java-specific
  138. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  139. ###
  140. ### Define protoc plugin for Java with given Name that emits extra outputs
  141. ### using Tool. Extra dependencies are passed via DEPS
  142. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  143. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  144. # XXX fix variable expansion in plugins
  145. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  146. }
  147. macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
  148. .SEM=${pre=&& set_target_property $Prop :Args}
  149. }
  150. # tag:proto tag:java-specific
  151. macro WITH_KOTLIN_GRPC() {
  152. ENABLE(KOTLIN_PROTO)
  153. PEERDIR(build/platform/java/kotlin_grpc)
  154. 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)
  155. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/io/grpc/grpc-kotlin-stub/1.3.1)
  156. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/com/google/protobuf/protobuf-kotlin/3.24.2)
  157. }
  158. # tag:proto tag:cpp-specific
  159. macro _ADD_CPP_PROTO_OUT(Suf) {
  160. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
  161. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  162. # XXX fix variable expansion in plugins
  163. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  164. }
  165. # tag:proto tag:cpp-specific
  166. HAS_CPP_PROTOBUF_PEERS=no
  167. CPP_PROTOBUF_PEERS=
  168. # tag:proto tag:cpp-specific
  169. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  170. ###
  171. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  172. ### using Tool. Extra dependencies are passed via DEPS.
  173. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  174. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  175. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  176. # XXX fix variable expansion in plugins
  177. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  178. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  179. }
  180. # tag:proto tag:cpp-specific
  181. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  182. ###
  183. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  184. ### using Tool. Extra dependencies are passed via DEPS.
  185. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  186. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  187. _ADD_CPP_PROTO_OUT($SUF)
  188. }
  189. # tag:proto tag:cpp-specific
  190. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  191. ###
  192. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  193. ### using Tool. Extra dependencies are passed via DEPS.
  194. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  195. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  196. _ADD_CPP_PROTO_OUT($SUF2)
  197. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  198. }
  199. # tag:proto
  200. ### @usage: USE_SKIFF() #wip, do not use
  201. ###
  202. ### Use mapreduce/yt/skiff_proto/plugin for C++
  203. macro USE_SKIFF() {
  204. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  205. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  206. }
  207. # tag:go-specific
  208. _GO_COMMON_GOOGLE_APIS = \
  209. vendor/google.golang.org/genproto/googleapis/api/annotations \
  210. vendor/google.golang.org/genproto/googleapis/api/configchange \
  211. vendor/google.golang.org/genproto/googleapis/api/distribution \
  212. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  213. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  214. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  215. vendor/google.golang.org/genproto/googleapis/api/label \
  216. vendor/google.golang.org/genproto/googleapis/api/metric \
  217. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  218. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  219. vendor/cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb \
  220. vendor/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb \
  221. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  222. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  223. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  224. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  225. vendor/google.golang.org/genproto/googleapis/logging/type \
  226. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  227. vendor/google.golang.org/genproto/googleapis/rpc/code \
  228. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  229. vendor/google.golang.org/genproto/googleapis/rpc/status \
  230. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  231. vendor/google.golang.org/genproto/googleapis/type/color \
  232. vendor/google.golang.org/genproto/googleapis/type/date \
  233. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  234. vendor/google.golang.org/genproto/googleapis/type/expr \
  235. vendor/google.golang.org/genproto/googleapis/type/fraction \
  236. vendor/google.golang.org/genproto/googleapis/type/latlng \
  237. vendor/google.golang.org/genproto/googleapis/type/money \
  238. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  239. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  240. vendor/google.golang.org/genproto/googleapis/type/timeofday
  241. # tag:go-specific
  242. _COMMON_GOOGLE_APIS=None
  243. # tag:go-specific
  244. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  245. ###
  246. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  247. ### This macro is properly handled for all languages including Go, where apis come in
  248. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  249. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  250. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  251. }
  252. # tag:go-specific tag:proto
  253. GO_PROTO_GEN_PLUGINS=
  254. GO_PROTO_OPTS=
  255. GO_PROTO_OUTS=
  256. GO_PROTO_GRPC_OPTS=
  257. GO_PROTO_GRPC_OUTS=
  258. GO_PROTO_V2=no
  259. _GO_PROTO_CHECK_OUTPUT=
  260. # tag:go-specific tag:proto
  261. GO_PROTOBUF_IMPORTS=\
  262. ${GOSTD}/sync \
  263. ${GOSTD}/reflect \
  264. ${GOSTD}/fmt \
  265. ${GOSTD}/math \
  266. vendor/github.com/golang/protobuf/proto \
  267. vendor/google.golang.org/protobuf/types/descriptorpb \
  268. vendor/google.golang.org/protobuf/runtime/protoimpl \
  269. vendor/google.golang.org/protobuf/runtime/protoiface \
  270. vendor/google.golang.org/protobuf/reflect/protoreflect
  271. # tag:go-specific tag:proto
  272. GO_PROTOBUF_WELLKNOWN_TYPES=\
  273. vendor/google.golang.org/protobuf/types/known/anypb \
  274. vendor/google.golang.org/protobuf/types/known/apipb \
  275. vendor/google.golang.org/protobuf/types/known/durationpb \
  276. vendor/google.golang.org/protobuf/types/known/emptypb \
  277. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  278. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  279. vendor/google.golang.org/protobuf/types/known/structpb \
  280. vendor/google.golang.org/protobuf/types/known/timestamppb \
  281. vendor/google.golang.org/protobuf/types/known/typepb \
  282. vendor/google.golang.org/protobuf/types/known/wrapperspb
  283. # tag:go-specific tag:proto
  284. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  285. ###
  286. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  287. ### Ext using Tool. Extra dependencies are passed via DEPS.
  288. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  289. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  290. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  291. PEERDIR(${DEPS})
  292. }
  293. # tag:go-specific tag:proto
  294. 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_PATH $_PROTOC_FLAGS ${hide:PROTO_FAKEID}
  295. # tag:go-specific tag:proto
  296. macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
  297. .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  298. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  299. .ADDINCL=FOR proto contrib/libs/protobuf/src
  300. }
  301. # tag:go-specific tag:proto
  302. macro _GO_PROTO_CMD(File) {
  303. .CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
  304. }
  305. # tag:proto
  306. ### @usage: YT_ORM_PROTO_YSON(Files... OUT_OPTS Opts...)
  307. ###
  308. ### Generate .yson.go from .proto using yt/yt/orm/go/codegen/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  309. macro YT_ORM_PROTO_YSON(OUT_OPTS[], Files...) {
  310. .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}
  311. .ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto contrib/libs/protobuf/src
  312. .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
  313. }
  314. _SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  315. && set_global_flags COMMON_PROTOC_FLAGS \
  316. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  317. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  318. # tag:proto
  319. macro _CPP_PROTO_CMD(File) {
  320. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  321. .SEM=$_SEM_CPP_PROTO_CMD
  322. .PEERDIR=contrib/libs/protobuf
  323. }
  324. # tag:proto
  325. macro _CPP_VANILLA_PROTO_CMD(File) {
  326. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  327. .PEERDIR=contrib/libs/protobuf_std
  328. }
  329. _SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  330. && set_global_flags COMMON_PROTOC_FLAGS \
  331. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
  332. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog
  333. # tag:proto
  334. macro _CPP_EVLOG_CMD(File) {
  335. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  336. .SEM=$_SEM_CPP_EV_CMD
  337. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  338. }
  339. # tag:proto
  340. macro _CPP_PROTO_EVLOG_CMD(File) {
  341. # process .proto as .ev
  342. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  343. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  344. }
  345. # tag:proto
  346. macro _CPP_CFGPROTO_CMD(File) {
  347. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  348. .CMD=$CPP_PROTO_CMDLINE --plugin=protoc-gen-config=${tool:"library/cpp/proto_config/plugin"} --config_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $CPP_EV_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  349. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  350. }
  351. # tag:proto
  352. PY_PROTO_MYPY_ENABLED=yes
  353. 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
  354. # tag:proto tag:python-specific
  355. PY_PROTO_MYPY_SUFFIX=
  356. PY_PROTO_MYPY_PLUGIN=
  357. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  358. # tag:proto tag:python-specific
  359. macro NO_MYPY() {
  360. DISABLE(PY_PROTO_MYPY_ENABLED)
  361. }
  362. # tag:proto tag:python-specific
  363. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  364. .CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args ${hide:PROTO_FAKEID}
  365. }
  366. # tag:proto tag:python-specific
  367. macro _PY_PROTO_CMD(File) {
  368. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  369. }
  370. # tag:proto tag:python-specific
  371. macro _PY_PROTO_CMD_INTERNAL(File) {
  372. .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___pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS_INTERNAL ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.py:File} ${nopath;noext;suf=_pb2.py:File}"} $PY_PROTO_MYPY_PLUGIN_INTERNAL)
  373. }
  374. # tag:proto tag:java-specific
  375. JAVA_PROTO_RUNTIME=
  376. # tag:proto tag:java-specific
  377. ### @usage: USE_JAVALITE()
  378. ### Use protobuf-javalite for Java
  379. macro USE_JAVALITE() {
  380. SET(JAVA_PROTO_RUNTIME javalite)
  381. }
  382. # tag:proto tag:java-specific
  383. JAVA_PROTO_RUNTIME_VERSION = 3.21.12
  384. JAVA_PROTO_COMMON_VERSION = 1.12.0
  385. JAVA_GRPC_VERSION = 1.43.2
  386. KOTLIN_PROTO=no
  387. KOTLIN_PROTO_PEERS=
  388. when ($JAVA_PROTO_RUNTIME == "javalite") {
  389. _JAVA_PROTO_LITE_ARG=lite:
  390. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  391. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/${JAVA_GRPC_VERSION}
  392. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/${JAVA_GRPC_VERSION}
  393. }
  394. otherwise {
  395. _JAVA_PROTO_LITE_ARG=
  396. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  397. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/${JAVA_GRPC_VERSION}
  398. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/${JAVA_GRPC_VERSION}
  399. }
  400. KOTLIN_PROTO_FLAGS=
  401. # tag:proto tag:java-specific
  402. macro _JAVA_PROTO_CMD(File) {
  403. .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 $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}
  404. .SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
  405. }
  406. # tag:proto tag:perl-specific tag:deprecated
  407. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  408. ###
  409. ### Generate Perl code from protobuf.
  410. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  411. macro XS_PROTO(File, Dir, Outputs...) {
  412. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_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}
  413. PEERDIR(${Dir})
  414. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  415. }
  416. # tag:proto tag:fbs
  417. ### @usage: PROTO2FBS(InputProto)
  418. ###
  419. ### Produce flatbuf schema out of protobuf description.
  420. macro PROTO2FBS(File) {
  421. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;norel;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"} && $MOVE_FILE ${BINDIR}/${nopath;noext:File.fbs} ${output;norel;noext:File.fbs}
  422. }
  423. # tag:proto tag:python-specific
  424. when ($PY_PROTOS_FOR == "yes") {
  425. PEERDIR+=contrib/libs/protobuf/python
  426. }
  427. # tag:python-specific
  428. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  429. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  430. .PEERDIR=library/cpp/eventlog/proto
  431. }
  432. # tag:python-specific tag:proto
  433. macro _PY_EVLOG_CMD(File) {
  434. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  435. }
  436. # tag:python-specific tag:proto
  437. macro _PY_EVLOG_CMD_INTERNAL(File) {
  438. .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___ev_pb2.py ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___ev_pb2.py:File} ${nopath;noext;suf=_ev_pb2.py:File}"})
  439. }
  440. # tag:java-specific tag:proto
  441. macro _JAVA_EVLOG_CMD(File) {
  442. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  443. .PEERDIR=library/cpp/eventlog/proto
  444. }
  445. # tag:proto tag:grpc
  446. _GRPC_ENABLED=no
  447. # tag:proto tag:grpc
  448. ### @usage: GRPC()
  449. ###
  450. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  451. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
  452. macro GRPC() {
  453. ENABLE(_GRPC_ENABLED)
  454. # C++
  455. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  456. # Python
  457. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio)
  458. # Java
  459. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  460. SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1)
  461. }
  462. macro GO_PROTO_USE_V2() {
  463. ENABLE(GO_PROTO_V2)
  464. }
  465. # tag:proto
  466. ### @usage: RESOLVE_PROTO()
  467. ###
  468. ### Enable include resolving within UNIONs and let system .proto being resolved
  469. ### among .proto/.gztproto imports
  470. ###
  471. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  472. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  473. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  474. macro RESOLVE_PROTO() {
  475. SET(DONT_RESOLVE_INCLUDES no)
  476. ADDINCL(FOR proto $PROTOBUF_PATH)
  477. }
  478. # tag:python-specific tag:proto tag:deprecated
  479. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  480. ###
  481. ### Generate python bindings for protobuf files.
  482. ### Macro is obsolete and not recommended for use!
  483. macro GENERATE_PY_PROTOS(FILES...) {
  484. foreach (FILE : $FILES) {
  485. _PY_PROTO_CMD($FILE)
  486. }
  487. }
  488. # tag:python-specific tag:proto
  489. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  490. foreach (FILE : $FILES) {
  491. _PY_PROTO_CMD_INTERNAL($FILE)
  492. }
  493. }
  494. # tag:python-specific
  495. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  496. foreach (FILE : $FILES) {
  497. _PY_EVLOG_CMD_INTERNAL($FILE)
  498. }
  499. }
  500. ### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
  501. ###
  502. ### Create list of .proto files in a list-file (should be .proto, files.proto by default)
  503. ### with original .proto-files as list's dependencies.
  504. ###
  505. ### This allows to process files listed, passing list as an argument to the processor
  506. ###
  507. ### TODO: proper implementation needed
  508. macro LIST_PROTO(TO="files.proto", Files...) {
  509. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${input;hide:Files} ${stdout;output;noauto:TO} ${output_include;from_input;hide:Files} && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;noext;suf=.pb.h:TO}
  510. _EXPOSE(${TO})
  511. }
  512. # tag:proto
  513. macro _PROTO_DESC_CMD(File) {
  514. .CMD=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --descriptor_set_out=${output;suf=.desc:File} --include_source_info $_PROTOC_FLAGS ${input;rootrel:File} ${hide:PROTO_FAKEID}
  515. }
  516. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  517. _PROTO_DESC_MERGE_PEERS_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $PEERS $SRCS_GLOBAL ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  518. NEED_GOOGLE_PROTO_PEERDIRS=yes
  519. CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  520. JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  521. # tag:proto
  522. ### @usage: PROTO_LIBRARY()
  523. ###
  524. ### Build some varian of protocol buffers library.
  525. ###
  526. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  527. ###
  528. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  529. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  530. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  531. ### Notes:
  532. ### - Python versions emit C++ code in addition to Python as optimization.
  533. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  534. ### - Use from DEPENDS or BUNDLE is not allowed
  535. ###
  536. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  537. ###
  538. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  539. multimodule PROTO_LIBRARY {
  540. module CPP_PROTO : LIBRARY {
  541. .ALLOWED=_EXPOSE LIST_PROTO
  542. # TODO(svidyuk): think about marker which forces semantics inheritance
  543. .SEM=CPP_PROTO_LIBRARY_SEM
  544. FORCE_COVERAGE_DISABLED=yes
  545. ENABLE(CPP_PROTO)
  546. ENABLE(GEN_PROTO)
  547. NO_CLANG_TIDY()
  548. SET(PEERDIR_TAGS CPP_PROTO)
  549. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  550. _OK=no
  551. }
  552. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  553. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  554. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  555. when ($_COMMON_GOOGLE_APIS != "None") {
  556. PEERDIR += contrib/libs/googleapis-common-protos
  557. }
  558. }
  559. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  560. .EXTS=.jsrc
  561. .ALLOWED=GRPC
  562. .SEM=JAVA_PROTO_LIBRARY_SEM
  563. SET(PEERDIR_TAGS JAVA_PROTO)
  564. ENABLE(JAVA_PROTO)
  565. PEERDIR+=$JAVA_PROTOBUF_PEERS
  566. when ($KOTLIN_PROTO == "yes") {
  567. KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
  568. KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
  569. }
  570. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  571. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  572. }
  573. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  574. ADDINCL(FOR proto $PROTOBUF_PATH)
  575. when ($_COMMON_GOOGLE_APIS != "None") {
  576. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  577. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  578. }
  579. }
  580. module PY_PROTO: PY2_LIBRARY {
  581. .ALIASES=SRCS=PY_SRCS
  582. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  583. .PEERDIRSELF=CPP_PROTO
  584. .SEM=IGNORED
  585. SET(PEERDIR_TAGS PY2 PY_PROTO)
  586. ENABLE(PY_PROTO)
  587. OPTIMIZE_PY_PROTOS()
  588. OBJ_SUF=.py2
  589. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  590. SET(_NO_LINT_VALUE none_internal)
  591. when ($_COMMON_GOOGLE_APIS != "None") {
  592. PEERDIR += contrib/libs/googleapis-common-protos
  593. }
  594. _IGNORE_SELF_PEERS=
  595. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  596. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  597. _IGNORE_PEERDIRSELF=CPP_PROTO
  598. }
  599. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  600. }
  601. module PY3_PROTO: PY3_LIBRARY {
  602. .ALIASES=SRCS=PY_SRCS
  603. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  604. .PEERDIRSELF=CPP_PROTO
  605. .SEM=IGNORED
  606. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  607. ENABLE(PY3_PROTO)
  608. OPTIMIZE_PY_PROTOS()
  609. OBJ_SUF=.py3
  610. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  611. SET(_NO_LINT_VALUE none_internal)
  612. when ($_COMMON_GOOGLE_APIS != "None") {
  613. PEERDIR += contrib/libs/googleapis-common-protos
  614. }
  615. _IGNORE_SELF_PEERS=
  616. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  617. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  618. _IGNORE_PEERDIRSELF=CPP_PROTO
  619. }
  620. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  621. }
  622. module GO_PROTO: GO_LIBRARY {
  623. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  624. .SEM=IGNORED
  625. SET(PEERDIR_TAGS GO GO_PROTO)
  626. ENABLE(GO_PROTO)
  627. when ($_COMMON_GOOGLE_APIS == "None") {
  628. }
  629. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  630. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  631. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  632. }
  633. otherwise {
  634. PEERDIR += $_COMMON_GOOGLE_APIS
  635. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  636. }
  637. }
  638. module DESC_PROTO: _BARE_UNIT {
  639. .CMD=_PROTO_DESC_MERGE_CMD
  640. .SEM=IGNORED
  641. .EXTS=.desc
  642. .NODE_TYPE=Library
  643. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  644. SET(PEERDIR_TAGS DESC_PROTO)
  645. ENABLE(DESC_PROTO)
  646. MODULE_SUFFIX=.self.protodesc
  647. SET(MODULE_TYPE LIBRARY)
  648. _EVLOG_CMDLINE=$_PROTO_DESC_CMDLINE
  649. _PROTO_CMDLINE=$_PROTO_DESC_CMDLINE
  650. when ($_COMMON_GOOGLE_APIS != "None") {
  651. PEERDIR += contrib/libs/googleapis-common-protos
  652. }
  653. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  654. when ($USE_VANILLA_PROTOC == "yes") {
  655. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  656. }
  657. otherwise {
  658. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  659. }
  660. }
  661. }
  662. }
  663. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  664. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  665. .PEERDIR_POLICY=as_build_from
  666. .NODE_TYPE=Library
  667. .RESTRICTED=SRCS
  668. .FINAL_TARGET=yes
  669. SET(PEERDIR_TAGS DESC_PROTO)
  670. SET(MODULE_SUFFIX .protodesc)
  671. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  672. }
  673. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  674. SET(MODULE_TYPE PROTO_REGISTRY)
  675. }
  676. macro EVLOG_CMD(SRC) {
  677. .CMD=$_EVLOG_CMDLINE
  678. .SEM=$_EVLOG_CMDLINE
  679. }
  680. macro PROTO_CMD(SRC) {
  681. .CMD=$_PROTO_CMDLINE
  682. .SEM=$_PROTO_CMDLINE
  683. }
  684. _CPP_EVLOG_CMDLINE=$_CPP_EVLOG_CMD($SRC)
  685. _CPP_PROTO_CMDLINE=$_CPP_PROTO_CMD($SRC)
  686. _CPP_PROTO_EVLOG_CMDLINE=$_CPP_PROTO_EVLOG_CMD($SRC)
  687. _CPP_VANILLA_PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMD($SRC)
  688. _JAVA_EVLOG_CMDLINE=$_JAVA_EVLOG_CMD($SRC)
  689. _JAVA_PROTO_CMDLINE=$_JAVA_PROTO_CMD($SRC)
  690. _PROTO_DESC_CMDLINE=$_PROTO_DESC_CMD($SRC)
  691. _PY_EVLOG_CMDLINE=$_PY_EVLOG_CMD($SRC)
  692. _PY_PROTO_CMDLINE=$_PY_PROTO_CMD($SRC)