proto.conf 33 KB

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