BUILD 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. # Bazel (https://bazel.build/) BUILD file for Protobuf.
  2. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
  3. load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
  4. load("@rules_proto//proto/private:native.bzl", "native_proto_common")
  5. load("@rules_python//python:defs.bzl", "py_library")
  6. load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
  7. licenses(["notice"])
  8. exports_files(["LICENSE"])
  9. ################################################################################
  10. # ZLIB configuration
  11. ################################################################################
  12. ZLIB_DEPS = ["@zlib//:zlib"]
  13. ################################################################################
  14. # Protobuf Runtime Library
  15. ################################################################################
  16. MSVC_COPTS = [
  17. "/DHAVE_PTHREAD",
  18. "/wd4018", # -Wno-sign-compare
  19. "/wd4065", # switch statement contains 'default' but no 'case' labels
  20. "/wd4146", # unary minus operator applied to unsigned type, result still unsigned
  21. "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
  22. "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
  23. "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
  24. "/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
  25. "/wd4307", # 'operator' : integral constant overflow
  26. "/wd4309", # 'conversion' : truncation of constant value
  27. "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
  28. "/wd4355", # 'this' : used in base member initializer list
  29. "/wd4506", # no definition for inline function 'function'
  30. "/wd4514", # -Wno-unused-function
  31. "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
  32. "/wd4996", # The compiler encountered a deprecated declaration.
  33. ]
  34. COPTS = select({
  35. ":msvc": MSVC_COPTS,
  36. "//conditions:default": [
  37. "-DHAVE_PTHREAD",
  38. "-DHAVE_ZLIB",
  39. "-Woverloaded-virtual",
  40. "-Wno-sign-compare",
  41. "-Wno-unused-function",
  42. # Prevents ISO C++ const string assignment warnings for pyext sources.
  43. "-Wno-write-strings",
  44. "-Wno-deprecated-declarations",
  45. ],
  46. })
  47. load(":compiler_config_setting.bzl", "create_compiler_config_setting")
  48. create_compiler_config_setting(
  49. name = "msvc",
  50. value = "msvc-cl",
  51. visibility = [
  52. # Public, but Protobuf only visibility.
  53. "//:__subpackages__",
  54. ],
  55. )
  56. config_setting(
  57. name = "android",
  58. values = {
  59. "crosstool_top": "//external:android/crosstool",
  60. },
  61. visibility = [
  62. # Public, but Protobuf only visibility.
  63. "//:__subpackages__",
  64. ],
  65. )
  66. config_setting(
  67. name = "android-libcpp",
  68. values = {
  69. "crosstool_top": "@androidndk//:toolchain-libcpp",
  70. },
  71. visibility = [
  72. # Public, but Protobuf only visibility.
  73. "//:__subpackages__",
  74. ],
  75. )
  76. config_setting(
  77. name = "android-gnu-libstdcpp",
  78. values = {
  79. "crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp",
  80. },
  81. visibility = [
  82. # Public, but Protobuf only visibility.
  83. "//:__subpackages__",
  84. ],
  85. )
  86. # Android and MSVC builds do not need to link in a separate pthread library.
  87. LINK_OPTS = select({
  88. ":android": [],
  89. ":android-libcpp": [],
  90. ":android-gnu-libstdcpp": [],
  91. ":msvc": [
  92. # Suppress linker warnings about files with no symbols defined.
  93. "-ignore:4221",
  94. ],
  95. "//conditions:default": [
  96. "-lpthread",
  97. "-lm",
  98. ],
  99. })
  100. load(
  101. ":protobuf.bzl",
  102. "cc_proto_library",
  103. "internal_copied_filegroup",
  104. "internal_gen_well_known_protos_java",
  105. "internal_protobuf_py_tests",
  106. "py_proto_library",
  107. )
  108. cc_library(
  109. name = "protobuf_lite",
  110. srcs = [
  111. # AUTOGEN(protobuf_lite_srcs)
  112. "src/google/protobuf/any_lite.cc",
  113. "src/google/protobuf/arena.cc",
  114. "src/google/protobuf/extension_set.cc",
  115. "src/google/protobuf/generated_enum_util.cc",
  116. "src/google/protobuf/generated_message_table_driven_lite.cc",
  117. "src/google/protobuf/generated_message_util.cc",
  118. "src/google/protobuf/implicit_weak_message.cc",
  119. "src/google/protobuf/io/coded_stream.cc",
  120. "src/google/protobuf/io/io_win32.cc",
  121. "src/google/protobuf/io/strtod.cc",
  122. "src/google/protobuf/io/zero_copy_stream.cc",
  123. "src/google/protobuf/io/zero_copy_stream_impl.cc",
  124. "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
  125. "src/google/protobuf/message_lite.cc",
  126. "src/google/protobuf/parse_context.cc",
  127. "src/google/protobuf/repeated_field.cc",
  128. "src/google/protobuf/stubs/bytestream.cc",
  129. "src/google/protobuf/stubs/common.cc",
  130. "src/google/protobuf/stubs/int128.cc",
  131. "src/google/protobuf/stubs/status.cc",
  132. "src/google/protobuf/stubs/statusor.cc",
  133. "src/google/protobuf/stubs/stringpiece.cc",
  134. "src/google/protobuf/stubs/stringprintf.cc",
  135. "src/google/protobuf/stubs/structurally_valid.cc",
  136. "src/google/protobuf/stubs/strutil.cc",
  137. "src/google/protobuf/stubs/time.cc",
  138. "src/google/protobuf/wire_format_lite.cc",
  139. ],
  140. hdrs = glob([
  141. "src/google/protobuf/**/*.h",
  142. "src/google/protobuf/**/*.inc",
  143. ]),
  144. copts = COPTS,
  145. includes = ["src/"],
  146. linkopts = LINK_OPTS,
  147. visibility = ["//visibility:public"],
  148. )
  149. PROTOBUF_DEPS = select({
  150. ":msvc": [],
  151. "//conditions:default": ZLIB_DEPS,
  152. })
  153. cc_library(
  154. name = "protobuf",
  155. srcs = [
  156. # AUTOGEN(protobuf_srcs)
  157. "src/google/protobuf/any.cc",
  158. "src/google/protobuf/any.pb.cc",
  159. "src/google/protobuf/api.pb.cc",
  160. "src/google/protobuf/compiler/importer.cc",
  161. "src/google/protobuf/compiler/parser.cc",
  162. "src/google/protobuf/descriptor.cc",
  163. "src/google/protobuf/descriptor.pb.cc",
  164. "src/google/protobuf/descriptor_database.cc",
  165. "src/google/protobuf/duration.pb.cc",
  166. "src/google/protobuf/dynamic_message.cc",
  167. "src/google/protobuf/empty.pb.cc",
  168. "src/google/protobuf/extension_set_heavy.cc",
  169. "src/google/protobuf/field_mask.pb.cc",
  170. "src/google/protobuf/generated_message_reflection.cc",
  171. "src/google/protobuf/generated_message_table_driven.cc",
  172. "src/google/protobuf/io/gzip_stream.cc",
  173. "src/google/protobuf/io/printer.cc",
  174. "src/google/protobuf/io/tokenizer.cc",
  175. "src/google/protobuf/map_field.cc",
  176. "src/google/protobuf/message.cc",
  177. "src/google/protobuf/reflection_ops.cc",
  178. "src/google/protobuf/service.cc",
  179. "src/google/protobuf/source_context.pb.cc",
  180. "src/google/protobuf/struct.pb.cc",
  181. "src/google/protobuf/stubs/substitute.cc",
  182. "src/google/protobuf/text_format.cc",
  183. "src/google/protobuf/timestamp.pb.cc",
  184. "src/google/protobuf/type.pb.cc",
  185. "src/google/protobuf/unknown_field_set.cc",
  186. "src/google/protobuf/util/delimited_message_util.cc",
  187. "src/google/protobuf/util/field_comparator.cc",
  188. "src/google/protobuf/util/field_mask_util.cc",
  189. "src/google/protobuf/util/internal/datapiece.cc",
  190. "src/google/protobuf/util/internal/default_value_objectwriter.cc",
  191. "src/google/protobuf/util/internal/error_listener.cc",
  192. "src/google/protobuf/util/internal/field_mask_utility.cc",
  193. "src/google/protobuf/util/internal/json_escaping.cc",
  194. "src/google/protobuf/util/internal/json_objectwriter.cc",
  195. "src/google/protobuf/util/internal/json_stream_parser.cc",
  196. "src/google/protobuf/util/internal/object_writer.cc",
  197. "src/google/protobuf/util/internal/proto_writer.cc",
  198. "src/google/protobuf/util/internal/protostream_objectsource.cc",
  199. "src/google/protobuf/util/internal/protostream_objectwriter.cc",
  200. "src/google/protobuf/util/internal/type_info.cc",
  201. "src/google/protobuf/util/internal/type_info_test_helper.cc",
  202. "src/google/protobuf/util/internal/utility.cc",
  203. "src/google/protobuf/util/json_util.cc",
  204. "src/google/protobuf/util/message_differencer.cc",
  205. "src/google/protobuf/util/time_util.cc",
  206. "src/google/protobuf/util/type_resolver_util.cc",
  207. "src/google/protobuf/wire_format.cc",
  208. "src/google/protobuf/wrappers.pb.cc",
  209. ],
  210. hdrs = glob([
  211. "src/**/*.h",
  212. "src/**/*.inc",
  213. ]),
  214. copts = COPTS,
  215. includes = ["src/"],
  216. linkopts = LINK_OPTS,
  217. visibility = ["//visibility:public"],
  218. deps = [":protobuf_lite"] + PROTOBUF_DEPS,
  219. )
  220. # This provides just the header files for use in projects that need to build
  221. # shared libraries for dynamic loading. This target is available until Bazel
  222. # adds native support for such use cases.
  223. # TODO(keveman): Remove this target once the support gets added to Bazel.
  224. cc_library(
  225. name = "protobuf_headers",
  226. hdrs = glob([
  227. "src/**/*.h",
  228. "src/**/*.inc",
  229. ]),
  230. includes = ["src/"],
  231. visibility = ["//visibility:public"],
  232. )
  233. # Map of all well known protos.
  234. # name => (include path, imports)
  235. WELL_KNOWN_PROTO_MAP = {
  236. "any": ("src/google/protobuf/any.proto", []),
  237. "api": (
  238. "src/google/protobuf/api.proto",
  239. [
  240. "source_context",
  241. "type",
  242. ],
  243. ),
  244. "compiler_plugin": (
  245. "src/google/protobuf/compiler/plugin.proto",
  246. ["descriptor"],
  247. ),
  248. "descriptor": ("src/google/protobuf/descriptor.proto", []),
  249. "duration": ("src/google/protobuf/duration.proto", []),
  250. "empty": ("src/google/protobuf/empty.proto", []),
  251. "field_mask": ("src/google/protobuf/field_mask.proto", []),
  252. "source_context": ("src/google/protobuf/source_context.proto", []),
  253. "struct": ("src/google/protobuf/struct.proto", []),
  254. "timestamp": ("src/google/protobuf/timestamp.proto", []),
  255. "type": (
  256. "src/google/protobuf/type.proto",
  257. [
  258. "any",
  259. "source_context",
  260. ],
  261. ),
  262. "wrappers": ("src/google/protobuf/wrappers.proto", []),
  263. }
  264. WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()]
  265. filegroup(
  266. name = "well_known_protos",
  267. srcs = WELL_KNOWN_PROTOS,
  268. visibility = ["//visibility:public"],
  269. )
  270. cc_proto_library(
  271. name = "cc_wkt_protos",
  272. srcs = WELL_KNOWN_PROTOS,
  273. include = "src",
  274. default_runtime = ":protobuf",
  275. internal_bootstrap_hack = 1,
  276. protoc = ":protoc",
  277. visibility = ["//visibility:public"],
  278. )
  279. ################################################################################
  280. # Well Known Types Proto Library Rules
  281. #
  282. # These proto_library rules can be used with one of the language specific proto
  283. # library rules i.e. java_proto_library:
  284. #
  285. # java_proto_library(
  286. # name = "any_java_proto",
  287. # deps = ["@com_google_protobuf//:any_proto],
  288. # )
  289. ################################################################################
  290. [proto_library(
  291. name = proto[0] + "_proto",
  292. srcs = [proto[1][0]],
  293. strip_import_prefix = "src",
  294. visibility = ["//visibility:public"],
  295. deps = [dep + "_proto" for dep in proto[1][1]],
  296. ) for proto in WELL_KNOWN_PROTO_MAP.items()]
  297. [native_cc_proto_library(
  298. name = proto + "_cc_proto",
  299. deps = [proto + "_proto"],
  300. visibility = ["//visibility:private"],
  301. ) for proto in WELL_KNOWN_PROTO_MAP.keys()]
  302. cc_proto_blacklist_test(
  303. name = "cc_proto_blacklist_test",
  304. deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()]
  305. )
  306. ################################################################################
  307. # Protocol Buffers Compiler
  308. ################################################################################
  309. cc_library(
  310. name = "protoc_lib",
  311. srcs = [
  312. # AUTOGEN(protoc_lib_srcs)
  313. "src/google/protobuf/compiler/code_generator.cc",
  314. "src/google/protobuf/compiler/command_line_interface.cc",
  315. "src/google/protobuf/compiler/cpp/cpp_enum.cc",
  316. "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
  317. "src/google/protobuf/compiler/cpp/cpp_extension.cc",
  318. "src/google/protobuf/compiler/cpp/cpp_field.cc",
  319. "src/google/protobuf/compiler/cpp/cpp_file.cc",
  320. "src/google/protobuf/compiler/cpp/cpp_generator.cc",
  321. "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
  322. "src/google/protobuf/compiler/cpp/cpp_map_field.cc",
  323. "src/google/protobuf/compiler/cpp/cpp_message.cc",
  324. "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
  325. "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
  326. "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
  327. "src/google/protobuf/compiler/cpp/cpp_service.cc",
  328. "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
  329. "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
  330. "src/google/protobuf/compiler/csharp/csharp_enum.cc",
  331. "src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
  332. "src/google/protobuf/compiler/csharp/csharp_field_base.cc",
  333. "src/google/protobuf/compiler/csharp/csharp_generator.cc",
  334. "src/google/protobuf/compiler/csharp/csharp_helpers.cc",
  335. "src/google/protobuf/compiler/csharp/csharp_map_field.cc",
  336. "src/google/protobuf/compiler/csharp/csharp_message.cc",
  337. "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
  338. "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
  339. "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
  340. "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
  341. "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
  342. "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
  343. "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
  344. "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
  345. "src/google/protobuf/compiler/java/java_context.cc",
  346. "src/google/protobuf/compiler/java/java_doc_comment.cc",
  347. "src/google/protobuf/compiler/java/java_enum.cc",
  348. "src/google/protobuf/compiler/java/java_enum_field.cc",
  349. "src/google/protobuf/compiler/java/java_enum_field_lite.cc",
  350. "src/google/protobuf/compiler/java/java_enum_lite.cc",
  351. "src/google/protobuf/compiler/java/java_extension.cc",
  352. "src/google/protobuf/compiler/java/java_extension_lite.cc",
  353. "src/google/protobuf/compiler/java/java_field.cc",
  354. "src/google/protobuf/compiler/java/java_file.cc",
  355. "src/google/protobuf/compiler/java/java_generator.cc",
  356. "src/google/protobuf/compiler/java/java_generator_factory.cc",
  357. "src/google/protobuf/compiler/java/java_helpers.cc",
  358. "src/google/protobuf/compiler/java/java_map_field.cc",
  359. "src/google/protobuf/compiler/java/java_map_field_lite.cc",
  360. "src/google/protobuf/compiler/java/java_message.cc",
  361. "src/google/protobuf/compiler/java/java_message_builder.cc",
  362. "src/google/protobuf/compiler/java/java_message_builder_lite.cc",
  363. "src/google/protobuf/compiler/java/java_message_field.cc",
  364. "src/google/protobuf/compiler/java/java_message_field_lite.cc",
  365. "src/google/protobuf/compiler/java/java_message_lite.cc",
  366. "src/google/protobuf/compiler/java/java_name_resolver.cc",
  367. "src/google/protobuf/compiler/java/java_primitive_field.cc",
  368. "src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
  369. "src/google/protobuf/compiler/java/java_service.cc",
  370. "src/google/protobuf/compiler/java/java_shared_code_generator.cc",
  371. "src/google/protobuf/compiler/java/java_string_field.cc",
  372. "src/google/protobuf/compiler/java/java_string_field_lite.cc",
  373. "src/google/protobuf/compiler/js/js_generator.cc",
  374. "src/google/protobuf/compiler/js/well_known_types_embed.cc",
  375. "src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
  376. "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
  377. "src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
  378. "src/google/protobuf/compiler/objectivec/objectivec_field.cc",
  379. "src/google/protobuf/compiler/objectivec/objectivec_file.cc",
  380. "src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
  381. "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
  382. "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
  383. "src/google/protobuf/compiler/objectivec/objectivec_message.cc",
  384. "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
  385. "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
  386. "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
  387. "src/google/protobuf/compiler/php/php_generator.cc",
  388. "src/google/protobuf/compiler/plugin.cc",
  389. "src/google/protobuf/compiler/plugin.pb.cc",
  390. "src/google/protobuf/compiler/python/python_generator.cc",
  391. "src/google/protobuf/compiler/ruby/ruby_generator.cc",
  392. "src/google/protobuf/compiler/subprocess.cc",
  393. "src/google/protobuf/compiler/zip_writer.cc",
  394. ],
  395. copts = COPTS,
  396. includes = ["src/"],
  397. linkopts = LINK_OPTS,
  398. visibility = ["//visibility:public"],
  399. deps = [":protobuf"],
  400. )
  401. cc_binary(
  402. name = "protoc",
  403. srcs = ["src/google/protobuf/compiler/main.cc"],
  404. linkopts = LINK_OPTS,
  405. visibility = ["//visibility:public"],
  406. deps = [":protoc_lib"],
  407. )
  408. ################################################################################
  409. # Tests
  410. ################################################################################
  411. RELATIVE_LITE_TEST_PROTOS = [
  412. # AUTOGEN(lite_test_protos)
  413. "google/protobuf/map_lite_unittest.proto",
  414. "google/protobuf/unittest_import_lite.proto",
  415. "google/protobuf/unittest_import_public_lite.proto",
  416. "google/protobuf/unittest_lite.proto",
  417. "google/protobuf/unittest_no_arena_lite.proto",
  418. ]
  419. LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS]
  420. RELATIVE_TEST_PROTOS = [
  421. # AUTOGEN(test_protos)
  422. "google/protobuf/any_test.proto",
  423. "google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto",
  424. "google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto",
  425. "google/protobuf/map_proto2_unittest.proto",
  426. "google/protobuf/map_unittest.proto",
  427. "google/protobuf/unittest.proto",
  428. "google/protobuf/unittest_arena.proto",
  429. "google/protobuf/unittest_custom_options.proto",
  430. "google/protobuf/unittest_drop_unknown_fields.proto",
  431. "google/protobuf/unittest_embed_optimize_for.proto",
  432. "google/protobuf/unittest_empty.proto",
  433. "google/protobuf/unittest_enormous_descriptor.proto",
  434. "google/protobuf/unittest_import.proto",
  435. "google/protobuf/unittest_import_public.proto",
  436. "google/protobuf/unittest_lazy_dependencies.proto",
  437. "google/protobuf/unittest_lazy_dependencies_custom_option.proto",
  438. "google/protobuf/unittest_lazy_dependencies_enum.proto",
  439. "google/protobuf/unittest_lite_imports_nonlite.proto",
  440. "google/protobuf/unittest_mset.proto",
  441. "google/protobuf/unittest_mset_wire_format.proto",
  442. "google/protobuf/unittest_no_arena.proto",
  443. "google/protobuf/unittest_no_arena_import.proto",
  444. "google/protobuf/unittest_no_field_presence.proto",
  445. "google/protobuf/unittest_no_generic_services.proto",
  446. "google/protobuf/unittest_optimize_for.proto",
  447. "google/protobuf/unittest_preserve_unknown_enum.proto",
  448. "google/protobuf/unittest_preserve_unknown_enum2.proto",
  449. "google/protobuf/unittest_proto3.proto",
  450. "google/protobuf/unittest_proto3_arena.proto",
  451. "google/protobuf/unittest_proto3_arena_lite.proto",
  452. "google/protobuf/unittest_proto3_lite.proto",
  453. "google/protobuf/unittest_well_known_types.proto",
  454. "google/protobuf/util/internal/testdata/anys.proto",
  455. "google/protobuf/util/internal/testdata/books.proto",
  456. "google/protobuf/util/internal/testdata/default_value.proto",
  457. "google/protobuf/util/internal/testdata/default_value_test.proto",
  458. "google/protobuf/util/internal/testdata/field_mask.proto",
  459. "google/protobuf/util/internal/testdata/maps.proto",
  460. "google/protobuf/util/internal/testdata/oneofs.proto",
  461. "google/protobuf/util/internal/testdata/proto3.proto",
  462. "google/protobuf/util/internal/testdata/struct.proto",
  463. "google/protobuf/util/internal/testdata/timestamp_duration.proto",
  464. "google/protobuf/util/internal/testdata/wrappers.proto",
  465. "google/protobuf/util/json_format.proto",
  466. "google/protobuf/util/json_format_proto3.proto",
  467. "google/protobuf/util/message_differencer_unittest.proto",
  468. ]
  469. TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
  470. cc_proto_library(
  471. name = "cc_test_protos",
  472. srcs = LITE_TEST_PROTOS + TEST_PROTOS,
  473. include = "src",
  474. default_runtime = ":protobuf",
  475. protoc = ":protoc",
  476. deps = [":cc_wkt_protos"],
  477. )
  478. COMMON_TEST_SRCS = [
  479. # AUTOGEN(common_test_srcs)
  480. "src/google/protobuf/arena_test_util.cc",
  481. "src/google/protobuf/map_test_util.inc",
  482. "src/google/protobuf/test_util.cc",
  483. "src/google/protobuf/test_util.inc",
  484. "src/google/protobuf/testing/file.cc",
  485. "src/google/protobuf/testing/googletest.cc",
  486. ]
  487. cc_binary(
  488. name = "test_plugin",
  489. srcs = [
  490. # AUTOGEN(test_plugin_srcs)
  491. "src/google/protobuf/compiler/mock_code_generator.cc",
  492. "src/google/protobuf/compiler/test_plugin.cc",
  493. "src/google/protobuf/testing/file.cc",
  494. ],
  495. deps = [
  496. ":protobuf",
  497. ":protoc_lib",
  498. "//external:gtest",
  499. ],
  500. )
  501. cc_test(
  502. name = "win32_test",
  503. srcs = ["src/google/protobuf/io/io_win32_unittest.cc"],
  504. tags = [
  505. "manual",
  506. "windows",
  507. ],
  508. deps = [
  509. ":protobuf_lite",
  510. "//external:gtest_main",
  511. ],
  512. )
  513. cc_test(
  514. name = "protobuf_test",
  515. srcs = COMMON_TEST_SRCS + [
  516. # AUTOGEN(test_srcs)
  517. "src/google/protobuf/any_test.cc",
  518. "src/google/protobuf/arena_unittest.cc",
  519. "src/google/protobuf/arenastring_unittest.cc",
  520. "src/google/protobuf/compiler/annotation_test_util.cc",
  521. "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
  522. "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
  523. "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
  524. "src/google/protobuf/compiler/cpp/cpp_unittest.cc",
  525. "src/google/protobuf/compiler/cpp/cpp_unittest.inc",
  526. "src/google/protobuf/compiler/cpp/metadata_test.cc",
  527. "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc",
  528. "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
  529. "src/google/protobuf/compiler/importer_unittest.cc",
  530. "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
  531. "src/google/protobuf/compiler/java/java_plugin_unittest.cc",
  532. "src/google/protobuf/compiler/mock_code_generator.cc",
  533. "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
  534. "src/google/protobuf/compiler/parser_unittest.cc",
  535. "src/google/protobuf/compiler/python/python_plugin_unittest.cc",
  536. "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
  537. "src/google/protobuf/descriptor_database_unittest.cc",
  538. "src/google/protobuf/descriptor_unittest.cc",
  539. "src/google/protobuf/drop_unknown_fields_test.cc",
  540. "src/google/protobuf/dynamic_message_unittest.cc",
  541. "src/google/protobuf/extension_set_unittest.cc",
  542. "src/google/protobuf/generated_message_reflection_unittest.cc",
  543. "src/google/protobuf/io/coded_stream_unittest.cc",
  544. "src/google/protobuf/io/io_win32_unittest.cc",
  545. "src/google/protobuf/io/printer_unittest.cc",
  546. "src/google/protobuf/io/tokenizer_unittest.cc",
  547. "src/google/protobuf/io/zero_copy_stream_unittest.cc",
  548. "src/google/protobuf/map_field_test.cc",
  549. "src/google/protobuf/map_test.cc",
  550. "src/google/protobuf/message_unittest.cc",
  551. "src/google/protobuf/message_unittest.inc",
  552. "src/google/protobuf/no_field_presence_test.cc",
  553. "src/google/protobuf/preserve_unknown_enum_test.cc",
  554. "src/google/protobuf/proto3_arena_lite_unittest.cc",
  555. "src/google/protobuf/proto3_arena_unittest.cc",
  556. "src/google/protobuf/proto3_lite_unittest.cc",
  557. "src/google/protobuf/proto3_lite_unittest.inc",
  558. "src/google/protobuf/reflection_ops_unittest.cc",
  559. "src/google/protobuf/repeated_field_reflection_unittest.cc",
  560. "src/google/protobuf/repeated_field_unittest.cc",
  561. "src/google/protobuf/stubs/bytestream_unittest.cc",
  562. "src/google/protobuf/stubs/common_unittest.cc",
  563. "src/google/protobuf/stubs/int128_unittest.cc",
  564. "src/google/protobuf/stubs/status_test.cc",
  565. "src/google/protobuf/stubs/statusor_test.cc",
  566. "src/google/protobuf/stubs/stringpiece_unittest.cc",
  567. "src/google/protobuf/stubs/stringprintf_unittest.cc",
  568. "src/google/protobuf/stubs/structurally_valid_unittest.cc",
  569. "src/google/protobuf/stubs/strutil_unittest.cc",
  570. "src/google/protobuf/stubs/template_util_unittest.cc",
  571. "src/google/protobuf/stubs/time_test.cc",
  572. "src/google/protobuf/text_format_unittest.cc",
  573. "src/google/protobuf/unknown_field_set_unittest.cc",
  574. "src/google/protobuf/util/delimited_message_util_test.cc",
  575. "src/google/protobuf/util/field_comparator_test.cc",
  576. "src/google/protobuf/util/field_mask_util_test.cc",
  577. "src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
  578. "src/google/protobuf/util/internal/json_objectwriter_test.cc",
  579. "src/google/protobuf/util/internal/json_stream_parser_test.cc",
  580. "src/google/protobuf/util/internal/protostream_objectsource_test.cc",
  581. "src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
  582. "src/google/protobuf/util/internal/type_info_test_helper.cc",
  583. "src/google/protobuf/util/json_util_test.cc",
  584. "src/google/protobuf/util/message_differencer_unittest.cc",
  585. "src/google/protobuf/util/time_util_test.cc",
  586. "src/google/protobuf/util/type_resolver_util_test.cc",
  587. "src/google/protobuf/well_known_types_unittest.cc",
  588. "src/google/protobuf/wire_format_unittest.cc",
  589. ] + select({
  590. "//conditions:default": [
  591. # AUTOGEN(non_msvc_test_srcs)
  592. "src/google/protobuf/compiler/command_line_interface_unittest.cc",
  593. ],
  594. ":msvc": [],
  595. }),
  596. copts = COPTS,
  597. data = [
  598. ":test_plugin",
  599. ] + glob([
  600. "src/google/protobuf/**/*",
  601. # Files for csharp_bootstrap_unittest.cc.
  602. "conformance/**/*",
  603. "csharp/src/**/*",
  604. ]),
  605. includes = [
  606. "src/",
  607. ],
  608. linkopts = LINK_OPTS,
  609. deps = [
  610. ":cc_test_protos",
  611. ":protobuf",
  612. ":protoc_lib",
  613. "//external:gtest_main",
  614. ] + PROTOBUF_DEPS,
  615. )
  616. ################################################################################
  617. # Java support
  618. ################################################################################
  619. internal_gen_well_known_protos_java(
  620. name = "gen_well_known_protos_java",
  621. deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
  622. visibility = [
  623. "//java:__subpackages__",
  624. ],
  625. )
  626. alias(
  627. name = "protobuf_java",
  628. actual = "//java/core",
  629. visibility = ["//visibility:public"],
  630. )
  631. alias(
  632. name = "protobuf_javalite",
  633. actual = "//java/lite",
  634. visibility = ["//visibility:public"],
  635. )
  636. alias(
  637. name = "protobuf_java_util",
  638. actual = "//java/util",
  639. visibility = ["//visibility:public"],
  640. )
  641. alias(
  642. name = "java_toolchain",
  643. actual = "//java/core:toolchain",
  644. visibility = ["//visibility:public"],
  645. )
  646. alias(
  647. name = "javalite_toolchain",
  648. actual = "//java/lite:toolchain",
  649. visibility = ["//visibility:public"],
  650. )
  651. ################################################################################
  652. # Python support
  653. ################################################################################
  654. py_library(
  655. name = "python_srcs",
  656. srcs = glob(
  657. [
  658. "python/google/**/*.py",
  659. ],
  660. exclude = [
  661. "python/google/protobuf/**/__init__.py",
  662. "python/google/protobuf/internal/*_test.py",
  663. "python/google/protobuf/internal/test_util.py",
  664. ],
  665. ),
  666. imports = ["python"],
  667. srcs_version = "PY2AND3",
  668. )
  669. cc_binary(
  670. name = "python/google/protobuf/internal/_api_implementation.so",
  671. srcs = ["python/google/protobuf/internal/api_implementation.cc"],
  672. copts = COPTS + [
  673. "-DPYTHON_PROTO2_CPP_IMPL_V2",
  674. ],
  675. linkshared = 1,
  676. linkstatic = 1,
  677. deps = select({
  678. "//conditions:default": [],
  679. ":use_fast_cpp_protos": ["//external:python_headers"],
  680. }),
  681. )
  682. cc_binary(
  683. name = "python/google/protobuf/pyext/_message.so",
  684. srcs = glob([
  685. "python/google/protobuf/pyext/*.cc",
  686. "python/google/protobuf/pyext/*.h",
  687. ]),
  688. copts = COPTS + [
  689. "-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
  690. ] + select({
  691. "//conditions:default": [],
  692. ":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"],
  693. }),
  694. includes = [
  695. "python/",
  696. "src/",
  697. ],
  698. linkshared = 1,
  699. linkstatic = 1,
  700. deps = [
  701. ":protobuf",
  702. ":proto_api",
  703. ] + select({
  704. "//conditions:default": [],
  705. ":use_fast_cpp_protos": ["//external:python_headers"],
  706. }),
  707. )
  708. config_setting(
  709. name = "use_fast_cpp_protos",
  710. values = {
  711. "define": "use_fast_cpp_protos=true",
  712. },
  713. visibility = [
  714. # Public, but Protobuf only visibility.
  715. "//:__subpackages__",
  716. ],
  717. )
  718. config_setting(
  719. name = "allow_oversize_protos",
  720. values = {
  721. "define": "allow_oversize_protos=true",
  722. },
  723. visibility = [
  724. # Public, but Protobuf only visibility.
  725. "//:__subpackages__",
  726. ],
  727. )
  728. # Copy the builtin proto files from src/google/protobuf to
  729. # python/google/protobuf. This way, the generated Python sources will be in the
  730. # same directory as the Python runtime sources. This is necessary for the
  731. # modules to be imported correctly since they are all part of the same Python
  732. # package.
  733. internal_copied_filegroup(
  734. name = "protos_python",
  735. srcs = WELL_KNOWN_PROTOS,
  736. dest = "python",
  737. strip_prefix = "src",
  738. )
  739. # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
  740. # which case we can simply add :protos_python in srcs.
  741. COPIED_WELL_KNOWN_PROTOS = ["python/" + s[4:] for s in WELL_KNOWN_PROTOS]
  742. py_proto_library(
  743. name = "protobuf_python",
  744. srcs = COPIED_WELL_KNOWN_PROTOS,
  745. include = "python",
  746. data = select({
  747. "//conditions:default": [],
  748. ":use_fast_cpp_protos": [
  749. ":python/google/protobuf/internal/_api_implementation.so",
  750. ":python/google/protobuf/pyext/_message.so",
  751. ],
  752. }),
  753. default_runtime = "",
  754. protoc = ":protoc",
  755. py_extra_srcs = glob(["python/**/__init__.py"]),
  756. py_libs = [
  757. ":python_srcs",
  758. "@six//:six",
  759. ],
  760. srcs_version = "PY2AND3",
  761. visibility = ["//visibility:public"],
  762. )
  763. # Copy the test proto files from src/google/protobuf to
  764. # python/google/protobuf. This way, the generated Python sources will be in the
  765. # same directory as the Python runtime sources. This is necessary for the
  766. # modules to be imported correctly by the tests since they are all part of the
  767. # same Python package.
  768. internal_copied_filegroup(
  769. name = "protos_python_test",
  770. srcs = LITE_TEST_PROTOS + TEST_PROTOS,
  771. dest = "python",
  772. strip_prefix = "src",
  773. )
  774. # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
  775. # which case we can simply add :protos_python_test in srcs.
  776. COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS]
  777. COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS]
  778. py_proto_library(
  779. name = "python_common_test_protos",
  780. srcs = COPIED_LITE_TEST_PROTOS + COPIED_TEST_PROTOS,
  781. include = "python",
  782. default_runtime = "",
  783. protoc = ":protoc",
  784. srcs_version = "PY2AND3",
  785. deps = [":protobuf_python"],
  786. )
  787. py_proto_library(
  788. name = "python_specific_test_protos",
  789. srcs = glob([
  790. "python/google/protobuf/internal/*.proto",
  791. "python/google/protobuf/internal/import_test_package/*.proto",
  792. ]),
  793. include = "python",
  794. default_runtime = ":protobuf_python",
  795. protoc = ":protoc",
  796. srcs_version = "PY2AND3",
  797. deps = [":python_common_test_protos"],
  798. )
  799. py_library(
  800. name = "python_tests",
  801. srcs = glob(
  802. [
  803. "python/google/protobuf/internal/*_test.py",
  804. "python/google/protobuf/internal/test_util.py",
  805. "python/google/protobuf/internal/import_test_package/__init__.py",
  806. ],
  807. ),
  808. imports = ["python"],
  809. srcs_version = "PY2AND3",
  810. deps = [
  811. ":protobuf_python",
  812. ":python_common_test_protos",
  813. ":python_specific_test_protos",
  814. ],
  815. )
  816. internal_protobuf_py_tests(
  817. name = "python_tests_batch",
  818. data = glob([
  819. "src/google/protobuf/**/*",
  820. ]),
  821. modules = [
  822. "descriptor_database_test",
  823. "descriptor_pool_test",
  824. "descriptor_test",
  825. "generator_test",
  826. "json_format_test",
  827. "message_factory_test",
  828. "message_test",
  829. "proto_builder_test",
  830. "reflection_test",
  831. "service_reflection_test",
  832. "symbol_database_test",
  833. "text_encoding_test",
  834. "text_format_test",
  835. "unknown_fields_test",
  836. "wire_format_test",
  837. ],
  838. deps = [":python_tests"],
  839. )
  840. cc_library(
  841. name = "proto_api",
  842. hdrs = ["python/google/protobuf/proto_api.h"],
  843. visibility = ["//visibility:public"],
  844. deps = [
  845. "//external:python_headers",
  846. ],
  847. )
  848. # Note: We use `native_proto_common` here because we depend on an implementation-detail of
  849. # `proto_lang_toolchain`, which may not be available on `proto_common`.
  850. reject_blacklisted_files = hasattr(native_proto_common, "proto_lang_toolchain_rejects_files_do_not_use_or_we_will_break_you_without_mercy")
  851. cc_toolchain_blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()] if reject_blacklisted_files else [":well_known_protos"]
  852. proto_lang_toolchain(
  853. name = "cc_toolchain",
  854. blacklisted_protos = cc_toolchain_blacklisted_protos,
  855. command_line = "--cpp_out=$(OUT)",
  856. runtime = ":protobuf",
  857. visibility = ["//visibility:public"],
  858. )
  859. alias(
  860. name = "objectivec",
  861. actual = ":protobuf_objc",
  862. visibility = ["//visibility:public"],
  863. )
  864. objc_library(
  865. name = "protobuf_objc",
  866. hdrs = [
  867. "objectivec/GPBArray.h",
  868. "objectivec/GPBBootstrap.h",
  869. "objectivec/GPBCodedInputStream.h",
  870. "objectivec/GPBCodedOutputStream.h",
  871. "objectivec/GPBDescriptor.h",
  872. "objectivec/GPBDictionary.h",
  873. "objectivec/GPBExtensionInternals.h",
  874. "objectivec/GPBExtensionRegistry.h",
  875. "objectivec/GPBMessage.h",
  876. "objectivec/GPBProtocolBuffers.h",
  877. "objectivec/GPBProtocolBuffers_RuntimeSupport.h",
  878. "objectivec/GPBRootObject.h",
  879. "objectivec/GPBRuntimeTypes.h",
  880. "objectivec/GPBUnknownField.h",
  881. "objectivec/GPBUnknownFieldSet.h",
  882. "objectivec/GPBUtilities.h",
  883. "objectivec/GPBWellKnownTypes.h",
  884. "objectivec/GPBWireFormat.h",
  885. "objectivec/google/protobuf/Any.pbobjc.h",
  886. "objectivec/google/protobuf/Api.pbobjc.h",
  887. "objectivec/google/protobuf/Duration.pbobjc.h",
  888. "objectivec/google/protobuf/Empty.pbobjc.h",
  889. "objectivec/google/protobuf/FieldMask.pbobjc.h",
  890. "objectivec/google/protobuf/SourceContext.pbobjc.h",
  891. "objectivec/google/protobuf/Struct.pbobjc.h",
  892. "objectivec/google/protobuf/Timestamp.pbobjc.h",
  893. "objectivec/google/protobuf/Type.pbobjc.h",
  894. "objectivec/google/protobuf/Wrappers.pbobjc.h",
  895. # Package private headers, but exposed because the generated sources
  896. # need to use them.
  897. "objectivec/GPBArray_PackagePrivate.h",
  898. "objectivec/GPBCodedInputStream_PackagePrivate.h",
  899. "objectivec/GPBCodedOutputStream_PackagePrivate.h",
  900. "objectivec/GPBDescriptor_PackagePrivate.h",
  901. "objectivec/GPBDictionary_PackagePrivate.h",
  902. "objectivec/GPBMessage_PackagePrivate.h",
  903. "objectivec/GPBRootObject_PackagePrivate.h",
  904. "objectivec/GPBUnknownFieldSet_PackagePrivate.h",
  905. "objectivec/GPBUnknownField_PackagePrivate.h",
  906. "objectivec/GPBUtilities_PackagePrivate.h",
  907. ],
  908. copts = [
  909. "-Wno-vla",
  910. ],
  911. includes = [
  912. "objectivec",
  913. ],
  914. non_arc_srcs = [
  915. "objectivec/GPBArray.m",
  916. "objectivec/GPBCodedInputStream.m",
  917. "objectivec/GPBCodedOutputStream.m",
  918. "objectivec/GPBDescriptor.m",
  919. "objectivec/GPBDictionary.m",
  920. "objectivec/GPBExtensionInternals.m",
  921. "objectivec/GPBExtensionRegistry.m",
  922. "objectivec/GPBMessage.m",
  923. "objectivec/GPBRootObject.m",
  924. "objectivec/GPBUnknownField.m",
  925. "objectivec/GPBUnknownFieldSet.m",
  926. "objectivec/GPBUtilities.m",
  927. "objectivec/GPBWellKnownTypes.m",
  928. "objectivec/GPBWireFormat.m",
  929. "objectivec/google/protobuf/Any.pbobjc.m",
  930. "objectivec/google/protobuf/Api.pbobjc.m",
  931. "objectivec/google/protobuf/Duration.pbobjc.m",
  932. "objectivec/google/protobuf/Empty.pbobjc.m",
  933. "objectivec/google/protobuf/FieldMask.pbobjc.m",
  934. "objectivec/google/protobuf/SourceContext.pbobjc.m",
  935. "objectivec/google/protobuf/Struct.pbobjc.m",
  936. "objectivec/google/protobuf/Timestamp.pbobjc.m",
  937. "objectivec/google/protobuf/Type.pbobjc.m",
  938. "objectivec/google/protobuf/Wrappers.pbobjc.m",
  939. ],
  940. visibility = ["//visibility:public"],
  941. )
  942. ################################################################################
  943. # Test generated proto support
  944. ################################################################################
  945. genrule(
  946. name = "generated_protos",
  947. srcs = ["src/google/protobuf/unittest_import.proto"],
  948. outs = ["unittest_gen.proto"],
  949. cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)",
  950. )
  951. proto_library(
  952. name = "generated_protos_proto",
  953. srcs = [
  954. "src/google/protobuf/unittest_import_public.proto",
  955. "unittest_gen.proto",
  956. ],
  957. )
  958. py_proto_library(
  959. name = "generated_protos_py",
  960. srcs = [
  961. "src/google/protobuf/unittest_import_public.proto",
  962. "unittest_gen.proto",
  963. ],
  964. default_runtime = "",
  965. protoc = ":protoc",
  966. )
  967. ################################################################################
  968. # Conformance tests
  969. ################################################################################
  970. proto_library(
  971. name = "test_messages_proto2_proto",
  972. srcs = ["src/google/protobuf/test_messages_proto2.proto"],
  973. visibility = ["//visibility:public"],
  974. )
  975. proto_library(
  976. name = "test_messages_proto3_proto",
  977. srcs = ["src/google/protobuf/test_messages_proto3.proto"],
  978. visibility = ["//visibility:public"],
  979. deps = [
  980. ":any_proto",
  981. ":duration_proto",
  982. ":field_mask_proto",
  983. ":struct_proto",
  984. ":timestamp_proto",
  985. ":wrappers_proto",
  986. ],
  987. )
  988. cc_proto_library(
  989. name = "test_messages_proto2_proto_cc",
  990. srcs = ["src/google/protobuf/test_messages_proto2.proto"],
  991. )
  992. cc_proto_library(
  993. name = "test_messages_proto3_proto_cc",
  994. srcs = ["src/google/protobuf/test_messages_proto3.proto"],
  995. deps = [
  996. ":cc_wkt_protos",
  997. ],
  998. )
  999. proto_library(
  1000. name = "conformance_proto",
  1001. srcs = ["conformance/conformance.proto"],
  1002. visibility = ["//visibility:public"],
  1003. )
  1004. cc_proto_library(
  1005. name = "conformance_proto_cc",
  1006. srcs = ["conformance/conformance.proto"],
  1007. )
  1008. cc_library(
  1009. name = "jsoncpp",
  1010. srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"],
  1011. hdrs = ["conformance/third_party/jsoncpp/json.h"],
  1012. includes = ["conformance"],
  1013. )
  1014. cc_library(
  1015. name = "conformance_test",
  1016. srcs = [
  1017. "conformance/conformance_test.cc",
  1018. "conformance/conformance_test_runner.cc",
  1019. ],
  1020. hdrs = [
  1021. "conformance/conformance_test.h",
  1022. ],
  1023. includes = [
  1024. "conformance",
  1025. "src",
  1026. ],
  1027. deps = [":conformance_proto_cc"],
  1028. )
  1029. cc_library(
  1030. name = "binary_json_conformance_suite",
  1031. srcs = ["conformance/binary_json_conformance_suite.cc"],
  1032. hdrs = ["conformance/binary_json_conformance_suite.h"],
  1033. deps = [
  1034. ":conformance_test",
  1035. ":jsoncpp",
  1036. ":test_messages_proto2_proto_cc",
  1037. ":test_messages_proto3_proto_cc",
  1038. ],
  1039. )
  1040. cc_library(
  1041. name = "text_format_conformance_suite",
  1042. srcs = ["conformance/text_format_conformance_suite.cc"],
  1043. hdrs = ["conformance/text_format_conformance_suite.h"],
  1044. deps = [
  1045. ":conformance_test",
  1046. ":test_messages_proto2_proto_cc",
  1047. ":test_messages_proto3_proto_cc",
  1048. ],
  1049. )
  1050. cc_binary(
  1051. name = "conformance_test_runner",
  1052. srcs = ["conformance/conformance_test_main.cc"],
  1053. visibility = ["//visibility:public"],
  1054. deps = [
  1055. ":binary_json_conformance_suite",
  1056. ":conformance_test",
  1057. ":text_format_conformance_suite",
  1058. ],
  1059. )
  1060. sh_test(
  1061. name = "build_files_updated_unittest",
  1062. srcs = [
  1063. "build_files_updated_unittest.sh",
  1064. ],
  1065. data = [
  1066. "BUILD",
  1067. "cmake/extract_includes.bat.in",
  1068. "cmake/libprotobuf.cmake",
  1069. "cmake/libprotobuf-lite.cmake",
  1070. "cmake/libprotoc.cmake",
  1071. "cmake/tests.cmake",
  1072. "src/Makefile.am",
  1073. "update_file_lists.sh",
  1074. ],
  1075. )