proto.conf 34 KB

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