proto.conf 36 KB

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