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