BUILD 40 KB

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