2015-06-18 00:37:58 +00:00
|
|
|
# Bazel (http://bazel.io/) BUILD file for Protobuf.
|
|
|
|
|
|
|
|
licenses(["notice"])
|
|
|
|
|
2015-06-28 22:23:02 +00:00
|
|
|
################################################################################
|
|
|
|
# Protobuf Runtime Library
|
|
|
|
################################################################################
|
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
COPTS = [
|
|
|
|
"-DHAVE_PTHREAD",
|
|
|
|
"-Wall",
|
|
|
|
"-Wwrite-strings",
|
|
|
|
"-Woverloaded-virtual",
|
|
|
|
"-Wno-sign-compare",
|
|
|
|
"-Wno-error=unused-function",
|
|
|
|
]
|
|
|
|
|
2016-04-04 19:13:30 +00:00
|
|
|
config_setting(
|
|
|
|
name = "android",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "//external:android/crosstool",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Android builds do not need to link in a separate pthread library.
|
|
|
|
LINK_OPTS = select({
|
2016-04-04 20:13:31 +00:00
|
|
|
":android": [],
|
2016-04-04 19:13:30 +00:00
|
|
|
"//conditions:default": ["-lpthread"],
|
|
|
|
})
|
2015-06-18 00:37:58 +00:00
|
|
|
|
2015-10-20 22:00:13 +00:00
|
|
|
load(
|
|
|
|
"protobuf",
|
|
|
|
"cc_proto_library",
|
|
|
|
"py_proto_library",
|
2016-02-25 15:53:19 +00:00
|
|
|
"internal_gen_well_known_protos_java",
|
2015-10-20 22:00:13 +00:00
|
|
|
"internal_protobuf_py_tests",
|
|
|
|
)
|
2015-10-15 00:12:11 +00:00
|
|
|
|
2016-02-23 18:18:32 +00:00
|
|
|
config_setting(
|
2016-03-09 21:03:52 +00:00
|
|
|
name = "ios_armv7",
|
2016-02-23 18:18:32 +00:00
|
|
|
values = {
|
|
|
|
"ios_cpu": "armv7",
|
2016-03-09 21:03:52 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "ios_armv7s",
|
|
|
|
values = {
|
2016-02-23 18:18:32 +00:00
|
|
|
"ios_cpu": "armv7s",
|
2016-03-09 21:03:52 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "ios_arm64",
|
|
|
|
values = {
|
2016-02-23 18:18:32 +00:00
|
|
|
"ios_cpu": "arm64",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
IOS_ARM_COPTS = COPTS + [
|
|
|
|
"-DOS_IOS",
|
|
|
|
"-miphoneos-version-min=7.0",
|
|
|
|
"-arch armv7",
|
|
|
|
"-arch armv7s",
|
|
|
|
"-arch arm64",
|
|
|
|
"-D__thread=",
|
|
|
|
"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/",
|
|
|
|
]
|
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
cc_library(
|
|
|
|
name = "protobuf_lite",
|
|
|
|
srcs = [
|
|
|
|
# AUTOGEN(protobuf_lite_srcs)
|
|
|
|
"src/google/protobuf/arena.cc",
|
|
|
|
"src/google/protobuf/arenastring.cc",
|
|
|
|
"src/google/protobuf/extension_set.cc",
|
|
|
|
"src/google/protobuf/generated_message_util.cc",
|
|
|
|
"src/google/protobuf/io/coded_stream.cc",
|
|
|
|
"src/google/protobuf/io/zero_copy_stream.cc",
|
|
|
|
"src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
|
|
|
|
"src/google/protobuf/message_lite.cc",
|
|
|
|
"src/google/protobuf/repeated_field.cc",
|
|
|
|
"src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
|
|
|
|
"src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/stubs/bytestream.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/stubs/common.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/stubs/int128.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/stubs/once.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/stubs/status.cc",
|
|
|
|
"src/google/protobuf/stubs/statusor.cc",
|
|
|
|
"src/google/protobuf/stubs/stringpiece.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/stubs/stringprintf.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/stubs/structurally_valid.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/stubs/strutil.cc",
|
|
|
|
"src/google/protobuf/stubs/time.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/wire_format_lite.cc",
|
|
|
|
],
|
2015-12-07 21:08:21 +00:00
|
|
|
hdrs = glob(["src/google/protobuf/**/*.h"]),
|
2016-02-23 18:18:32 +00:00
|
|
|
copts = select({
|
2016-03-09 21:03:52 +00:00
|
|
|
":ios_armv7": IOS_ARM_COPTS,
|
|
|
|
":ios_armv7s": IOS_ARM_COPTS,
|
|
|
|
":ios_arm64": IOS_ARM_COPTS,
|
2016-02-23 18:18:32 +00:00
|
|
|
"//conditions:default": COPTS,
|
|
|
|
}),
|
2015-06-18 00:37:58 +00:00
|
|
|
includes = ["src/"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "protobuf",
|
|
|
|
srcs = [
|
|
|
|
# AUTOGEN(protobuf_srcs)
|
|
|
|
"src/google/protobuf/any.cc",
|
|
|
|
"src/google/protobuf/any.pb.cc",
|
|
|
|
"src/google/protobuf/api.pb.cc",
|
|
|
|
"src/google/protobuf/compiler/importer.cc",
|
|
|
|
"src/google/protobuf/compiler/parser.cc",
|
|
|
|
"src/google/protobuf/descriptor.cc",
|
|
|
|
"src/google/protobuf/descriptor.pb.cc",
|
|
|
|
"src/google/protobuf/descriptor_database.cc",
|
|
|
|
"src/google/protobuf/duration.pb.cc",
|
|
|
|
"src/google/protobuf/dynamic_message.cc",
|
|
|
|
"src/google/protobuf/empty.pb.cc",
|
|
|
|
"src/google/protobuf/extension_set_heavy.cc",
|
|
|
|
"src/google/protobuf/field_mask.pb.cc",
|
|
|
|
"src/google/protobuf/generated_message_reflection.cc",
|
|
|
|
"src/google/protobuf/io/gzip_stream.cc",
|
|
|
|
"src/google/protobuf/io/printer.cc",
|
|
|
|
"src/google/protobuf/io/strtod.cc",
|
|
|
|
"src/google/protobuf/io/tokenizer.cc",
|
|
|
|
"src/google/protobuf/io/zero_copy_stream_impl.cc",
|
|
|
|
"src/google/protobuf/map_field.cc",
|
|
|
|
"src/google/protobuf/message.cc",
|
|
|
|
"src/google/protobuf/reflection_ops.cc",
|
|
|
|
"src/google/protobuf/service.cc",
|
|
|
|
"src/google/protobuf/source_context.pb.cc",
|
|
|
|
"src/google/protobuf/struct.pb.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/stubs/mathlimits.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/stubs/substitute.cc",
|
|
|
|
"src/google/protobuf/text_format.cc",
|
|
|
|
"src/google/protobuf/timestamp.pb.cc",
|
|
|
|
"src/google/protobuf/type.pb.cc",
|
|
|
|
"src/google/protobuf/unknown_field_set.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/util/field_comparator.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/util/field_mask_util.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/util/internal/datapiece.cc",
|
|
|
|
"src/google/protobuf/util/internal/default_value_objectwriter.cc",
|
|
|
|
"src/google/protobuf/util/internal/error_listener.cc",
|
|
|
|
"src/google/protobuf/util/internal/field_mask_utility.cc",
|
|
|
|
"src/google/protobuf/util/internal/json_escaping.cc",
|
|
|
|
"src/google/protobuf/util/internal/json_objectwriter.cc",
|
|
|
|
"src/google/protobuf/util/internal/json_stream_parser.cc",
|
|
|
|
"src/google/protobuf/util/internal/object_writer.cc",
|
2015-12-29 01:33:55 +00:00
|
|
|
"src/google/protobuf/util/internal/proto_writer.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/util/internal/protostream_objectsource.cc",
|
|
|
|
"src/google/protobuf/util/internal/protostream_objectwriter.cc",
|
|
|
|
"src/google/protobuf/util/internal/type_info.cc",
|
|
|
|
"src/google/protobuf/util/internal/type_info_test_helper.cc",
|
|
|
|
"src/google/protobuf/util/internal/utility.cc",
|
|
|
|
"src/google/protobuf/util/json_util.cc",
|
|
|
|
"src/google/protobuf/util/message_differencer.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/util/time_util.cc",
|
2015-06-18 20:38:36 +00:00
|
|
|
"src/google/protobuf/util/type_resolver_util.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/wire_format.cc",
|
|
|
|
"src/google/protobuf/wrappers.pb.cc",
|
|
|
|
],
|
2015-11-16 08:36:32 +00:00
|
|
|
hdrs = glob(["src/**/*.h"]),
|
2016-02-23 18:18:32 +00:00
|
|
|
copts = select({
|
2016-03-09 21:03:52 +00:00
|
|
|
":ios_armv7": IOS_ARM_COPTS,
|
|
|
|
":ios_armv7s": IOS_ARM_COPTS,
|
|
|
|
":ios_arm64": IOS_ARM_COPTS,
|
2016-02-23 18:18:32 +00:00
|
|
|
"//conditions:default": COPTS,
|
|
|
|
}),
|
2015-06-18 00:37:58 +00:00
|
|
|
includes = ["src/"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":protobuf_lite"],
|
|
|
|
)
|
|
|
|
|
2015-10-20 22:36:22 +00:00
|
|
|
objc_library(
|
|
|
|
name = "protobuf_objc",
|
|
|
|
hdrs = ["objectivec/GPBProtocolBuffers.h"],
|
|
|
|
includes = ["objectivec"],
|
|
|
|
non_arc_srcs = ["objectivec/GPBProtocolBuffers.m"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
2015-06-28 22:23:02 +00:00
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
RELATIVE_WELL_KNOWN_PROTOS = [
|
2015-06-28 22:23:02 +00:00
|
|
|
# AUTOGEN(well_known_protos)
|
|
|
|
"google/protobuf/any.proto",
|
|
|
|
"google/protobuf/api.proto",
|
|
|
|
"google/protobuf/compiler/plugin.proto",
|
|
|
|
"google/protobuf/descriptor.proto",
|
|
|
|
"google/protobuf/duration.proto",
|
|
|
|
"google/protobuf/empty.proto",
|
|
|
|
"google/protobuf/field_mask.proto",
|
|
|
|
"google/protobuf/source_context.proto",
|
|
|
|
"google/protobuf/struct.proto",
|
|
|
|
"google/protobuf/timestamp.proto",
|
|
|
|
"google/protobuf/type.proto",
|
|
|
|
"google/protobuf/wrappers.proto",
|
|
|
|
]
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
|
|
|
|
|
2016-03-23 00:56:07 +00:00
|
|
|
filegroup(
|
|
|
|
name = "well_known_protos",
|
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2015-10-15 00:12:11 +00:00
|
|
|
cc_proto_library(
|
|
|
|
name = "cc_wkt_protos",
|
2015-10-20 00:19:49 +00:00
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
2015-10-16 19:46:26 +00:00
|
|
|
include = "src",
|
2015-12-07 21:08:21 +00:00
|
|
|
default_runtime = ":protobuf",
|
2015-10-20 00:19:49 +00:00
|
|
|
internal_bootstrap_hack = 1,
|
2015-10-20 22:00:13 +00:00
|
|
|
protoc = ":protoc",
|
2015-11-17 20:36:21 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2015-10-15 00:12:11 +00:00
|
|
|
)
|
|
|
|
|
2015-06-28 22:23:02 +00:00
|
|
|
################################################################################
|
|
|
|
# Protocol Buffers Compiler
|
|
|
|
################################################################################
|
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
cc_library(
|
|
|
|
name = "protoc_lib",
|
|
|
|
srcs = [
|
|
|
|
# AUTOGEN(protoc_lib_srcs)
|
|
|
|
"src/google/protobuf/compiler/code_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/command_line_interface.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_enum.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_extension.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_field.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_file.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_helpers.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_map_field.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_message.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_service.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_string_field.cc",
|
2015-10-05 21:37:21 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_enum.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_field_base.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_helpers.cc",
|
2015-07-15 12:17:42 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_map_field.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_message.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
|
2015-11-19 13:05:17 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
|
|
|
|
"src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
|
2015-07-15 12:17:42 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_context.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_doc_comment.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_enum.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_enum_field_lite.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_enum_lite.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_extension.cc",
|
2016-04-18 21:12:08 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_extension_lite.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_file.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_generator_factory.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_helpers.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_lazy_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_map_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_map_field_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message_builder.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message_builder_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message_field_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_message_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_name_resolver.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_primitive_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_service.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_shared_code_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_string_field.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_string_field_lite.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_enum.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_extension.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_field.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_file.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_helpers.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_map_field.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_message.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
|
2015-12-29 01:33:55 +00:00
|
|
|
"src/google/protobuf/compiler/js/js_generator.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_field.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_file.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_message.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
|
|
|
|
"src/google/protobuf/compiler/plugin.cc",
|
|
|
|
"src/google/protobuf/compiler/plugin.pb.cc",
|
|
|
|
"src/google/protobuf/compiler/python/python_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/ruby/ruby_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/subprocess.cc",
|
|
|
|
"src/google/protobuf/compiler/zip_writer.cc",
|
|
|
|
],
|
|
|
|
copts = COPTS,
|
|
|
|
includes = ["src/"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":protobuf"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_binary(
|
|
|
|
name = "protoc",
|
|
|
|
srcs = ["src/google/protobuf/compiler/main.cc"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":protoc_lib"],
|
|
|
|
)
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Tests
|
|
|
|
################################################################################
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
RELATIVE_LITE_TEST_PROTOS = [
|
2015-06-18 00:37:58 +00:00
|
|
|
# AUTOGEN(lite_test_protos)
|
|
|
|
"google/protobuf/map_lite_unittest.proto",
|
|
|
|
"google/protobuf/unittest_import_lite.proto",
|
|
|
|
"google/protobuf/unittest_import_public_lite.proto",
|
|
|
|
"google/protobuf/unittest_lite.proto",
|
2015-08-26 00:06:33 +00:00
|
|
|
"google/protobuf/unittest_no_arena_lite.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
]
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS]
|
|
|
|
|
|
|
|
RELATIVE_TEST_PROTOS = [
|
2015-06-18 00:37:58 +00:00
|
|
|
# AUTOGEN(test_protos)
|
|
|
|
"google/protobuf/any_test.proto",
|
|
|
|
"google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto",
|
|
|
|
"google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto",
|
|
|
|
"google/protobuf/map_proto2_unittest.proto",
|
|
|
|
"google/protobuf/map_unittest.proto",
|
|
|
|
"google/protobuf/unittest.proto",
|
|
|
|
"google/protobuf/unittest_arena.proto",
|
|
|
|
"google/protobuf/unittest_custom_options.proto",
|
|
|
|
"google/protobuf/unittest_drop_unknown_fields.proto",
|
|
|
|
"google/protobuf/unittest_embed_optimize_for.proto",
|
|
|
|
"google/protobuf/unittest_empty.proto",
|
|
|
|
"google/protobuf/unittest_enormous_descriptor.proto",
|
|
|
|
"google/protobuf/unittest_import.proto",
|
|
|
|
"google/protobuf/unittest_import_public.proto",
|
|
|
|
"google/protobuf/unittest_lite_imports_nonlite.proto",
|
|
|
|
"google/protobuf/unittest_mset.proto",
|
2015-08-26 00:06:33 +00:00
|
|
|
"google/protobuf/unittest_mset_wire_format.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
"google/protobuf/unittest_no_arena.proto",
|
|
|
|
"google/protobuf/unittest_no_arena_import.proto",
|
|
|
|
"google/protobuf/unittest_no_field_presence.proto",
|
|
|
|
"google/protobuf/unittest_no_generic_services.proto",
|
|
|
|
"google/protobuf/unittest_optimize_for.proto",
|
|
|
|
"google/protobuf/unittest_preserve_unknown_enum.proto",
|
|
|
|
"google/protobuf/unittest_preserve_unknown_enum2.proto",
|
|
|
|
"google/protobuf/unittest_proto3_arena.proto",
|
2016-04-15 16:23:50 +00:00
|
|
|
"google/protobuf/unittest_proto3_arena_lite.proto",
|
|
|
|
"google/protobuf/unittest_proto3_lite.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
"google/protobuf/unittest_well_known_types.proto",
|
2015-06-18 20:38:36 +00:00
|
|
|
"google/protobuf/util/internal/testdata/anys.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/books.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/default_value.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/default_value_test.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/field_mask.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/maps.proto",
|
2015-08-26 00:06:33 +00:00
|
|
|
"google/protobuf/util/internal/testdata/oneofs.proto",
|
2015-06-18 20:38:36 +00:00
|
|
|
"google/protobuf/util/internal/testdata/struct.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/timestamp_duration.proto",
|
|
|
|
"google/protobuf/util/json_format_proto3.proto",
|
2015-12-29 01:33:55 +00:00
|
|
|
"google/protobuf/util/message_differencer_unittest.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
]
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
|
|
|
|
|
2015-10-15 00:12:11 +00:00
|
|
|
cc_proto_library(
|
|
|
|
name = "cc_test_protos",
|
2015-10-20 00:19:49 +00:00
|
|
|
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
|
2015-10-16 19:46:26 +00:00
|
|
|
include = "src",
|
2015-10-27 22:11:38 +00:00
|
|
|
default_runtime = ":protobuf",
|
2015-12-07 21:08:21 +00:00
|
|
|
protoc = ":protoc",
|
2015-10-16 18:44:21 +00:00
|
|
|
deps = [":cc_wkt_protos"],
|
2015-06-18 00:37:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
COMMON_TEST_SRCS = [
|
|
|
|
# AUTOGEN(common_test_srcs)
|
|
|
|
"src/google/protobuf/arena_test_util.cc",
|
|
|
|
"src/google/protobuf/map_test_util.cc",
|
|
|
|
"src/google/protobuf/test_util.cc",
|
|
|
|
"src/google/protobuf/testing/file.cc",
|
|
|
|
"src/google/protobuf/testing/googletest.cc",
|
|
|
|
]
|
|
|
|
|
2015-06-18 23:45:27 +00:00
|
|
|
cc_binary(
|
|
|
|
name = "test_plugin",
|
|
|
|
srcs = [
|
|
|
|
# AUTOGEN(test_plugin_srcs)
|
|
|
|
"src/google/protobuf/compiler/mock_code_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/test_plugin.cc",
|
|
|
|
"src/google/protobuf/testing/file.cc",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":protobuf",
|
|
|
|
":protoc_lib",
|
|
|
|
"//external:gtest",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "protobuf_test",
|
2015-10-15 00:12:11 +00:00
|
|
|
srcs = COMMON_TEST_SRCS + [
|
2015-06-18 23:45:27 +00:00
|
|
|
# AUTOGEN(test_srcs)
|
|
|
|
"src/google/protobuf/any_test.cc",
|
|
|
|
"src/google/protobuf/arena_unittest.cc",
|
|
|
|
"src/google/protobuf/arenastring_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
|
2016-04-18 21:12:08 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/metadata_test.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/importer_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/java/java_plugin_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/mock_code_generator.cc",
|
|
|
|
"src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/parser_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/python/python_plugin_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
|
|
|
|
"src/google/protobuf/descriptor_database_unittest.cc",
|
|
|
|
"src/google/protobuf/descriptor_unittest.cc",
|
|
|
|
"src/google/protobuf/drop_unknown_fields_test.cc",
|
|
|
|
"src/google/protobuf/dynamic_message_unittest.cc",
|
|
|
|
"src/google/protobuf/extension_set_unittest.cc",
|
|
|
|
"src/google/protobuf/generated_message_reflection_unittest.cc",
|
|
|
|
"src/google/protobuf/io/coded_stream_unittest.cc",
|
|
|
|
"src/google/protobuf/io/printer_unittest.cc",
|
|
|
|
"src/google/protobuf/io/tokenizer_unittest.cc",
|
|
|
|
"src/google/protobuf/io/zero_copy_stream_unittest.cc",
|
|
|
|
"src/google/protobuf/map_field_test.cc",
|
|
|
|
"src/google/protobuf/map_test.cc",
|
|
|
|
"src/google/protobuf/message_unittest.cc",
|
|
|
|
"src/google/protobuf/no_field_presence_test.cc",
|
|
|
|
"src/google/protobuf/preserve_unknown_enum_test.cc",
|
|
|
|
"src/google/protobuf/proto3_arena_unittest.cc",
|
2016-04-15 16:23:50 +00:00
|
|
|
"src/google/protobuf/proto3_arena_lite_unittest.cc",
|
|
|
|
"src/google/protobuf/proto3_lite_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/reflection_ops_unittest.cc",
|
|
|
|
"src/google/protobuf/repeated_field_reflection_unittest.cc",
|
|
|
|
"src/google/protobuf/repeated_field_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/bytestream_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/common_unittest.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/stubs/int128_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/stubs/once_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/status_test.cc",
|
|
|
|
"src/google/protobuf/stubs/statusor_test.cc",
|
|
|
|
"src/google/protobuf/stubs/stringpiece_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/stringprintf_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/structurally_valid_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/strutil_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/template_util_unittest.cc",
|
|
|
|
"src/google/protobuf/stubs/time_test.cc",
|
|
|
|
"src/google/protobuf/stubs/type_traits_unittest.cc",
|
|
|
|
"src/google/protobuf/text_format_unittest.cc",
|
|
|
|
"src/google/protobuf/unknown_field_set_unittest.cc",
|
|
|
|
"src/google/protobuf/util/field_comparator_test.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/util/field_mask_util_test.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
|
|
|
|
"src/google/protobuf/util/internal/json_objectwriter_test.cc",
|
|
|
|
"src/google/protobuf/util/internal/json_stream_parser_test.cc",
|
|
|
|
"src/google/protobuf/util/internal/protostream_objectsource_test.cc",
|
|
|
|
"src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
|
|
|
|
"src/google/protobuf/util/internal/type_info_test_helper.cc",
|
|
|
|
"src/google/protobuf/util/json_util_test.cc",
|
2015-12-29 01:33:55 +00:00
|
|
|
"src/google/protobuf/util/message_differencer_unittest.cc",
|
2015-08-26 00:06:33 +00:00
|
|
|
"src/google/protobuf/util/time_util_test.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/util/type_resolver_util_test.cc",
|
|
|
|
"src/google/protobuf/well_known_types_unittest.cc",
|
|
|
|
"src/google/protobuf/wire_format_unittest.cc",
|
|
|
|
],
|
|
|
|
copts = COPTS,
|
|
|
|
data = [
|
|
|
|
":test_plugin",
|
2015-10-21 18:19:16 +00:00
|
|
|
] + glob([
|
|
|
|
"src/google/protobuf/**/*",
|
|
|
|
]),
|
2015-06-18 23:45:27 +00:00
|
|
|
includes = [
|
|
|
|
"src/",
|
|
|
|
],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
deps = [
|
2015-10-20 00:19:49 +00:00
|
|
|
":cc_test_protos",
|
2015-06-18 23:45:27 +00:00
|
|
|
":protobuf",
|
|
|
|
":protoc_lib",
|
|
|
|
"//external:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
2015-10-20 00:19:49 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Java support
|
|
|
|
################################################################################
|
2016-02-25 15:53:19 +00:00
|
|
|
internal_gen_well_known_protos_java(
|
2016-01-22 07:03:28 +00:00
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
2015-10-20 00:19:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
java_library(
|
2015-10-21 17:56:38 +00:00
|
|
|
name = "protobuf_java",
|
2015-10-20 00:19:49 +00:00
|
|
|
srcs = glob([
|
2016-01-22 07:03:28 +00:00
|
|
|
"java/core/src/main/java/com/google/protobuf/*.java",
|
2015-10-20 00:19:49 +00:00
|
|
|
]) + [
|
2016-01-22 07:03:28 +00:00
|
|
|
":gen_well_known_protos_java",
|
2015-10-20 00:19:49 +00:00
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2016-03-11 01:50:25 +00:00
|
|
|
java_library(
|
|
|
|
name = "protobuf_java_util",
|
|
|
|
srcs = glob([
|
|
|
|
"java/util/src/main/java/com/google/protobuf/util/*.java",
|
|
|
|
]),
|
|
|
|
deps = [
|
2016-04-08 20:30:13 +00:00
|
|
|
"protobuf_java",
|
|
|
|
"//external:gson",
|
|
|
|
"//external:guava",
|
2016-03-11 01:50:25 +00:00
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
################################################################################
|
|
|
|
# Python support
|
|
|
|
################################################################################
|
|
|
|
|
2016-02-12 02:11:10 +00:00
|
|
|
py_library(
|
2015-10-20 00:19:49 +00:00
|
|
|
name = "python_srcs",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"python/google/protobuf/*.py",
|
|
|
|
"python/google/protobuf/**/*.py",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"python/google/protobuf/internal/*_test.py",
|
|
|
|
"python/google/protobuf/internal/test_util.py",
|
|
|
|
],
|
|
|
|
),
|
2016-04-08 20:30:13 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2016-02-12 02:11:10 +00:00
|
|
|
imports = ["python"],
|
2015-10-20 00:19:49 +00:00
|
|
|
)
|
|
|
|
|
2015-12-07 21:08:21 +00:00
|
|
|
cc_binary(
|
2015-12-08 18:46:17 +00:00
|
|
|
name = "internal/_api_implementation.so",
|
2015-12-07 21:08:21 +00:00
|
|
|
srcs = ["python/google/protobuf/internal/api_implementation.cc"],
|
|
|
|
copts = COPTS + [
|
|
|
|
"-DPYTHON_PROTO2_CPP_IMPL_V2",
|
|
|
|
],
|
|
|
|
linkshared = 1,
|
|
|
|
linkstatic = 1,
|
2015-12-08 16:24:37 +00:00
|
|
|
deps = select({
|
|
|
|
"//conditions:default": [],
|
2016-02-12 02:11:10 +00:00
|
|
|
":use_fast_cpp_protos": ["//external:python_headers"],
|
2015-12-08 16:24:37 +00:00
|
|
|
}),
|
2015-12-07 21:08:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_binary(
|
2015-12-08 18:46:17 +00:00
|
|
|
name = "pyext/_message.so",
|
2015-12-07 21:08:21 +00:00
|
|
|
srcs = glob([
|
|
|
|
"python/google/protobuf/pyext/*.cc",
|
|
|
|
"python/google/protobuf/pyext/*.h",
|
|
|
|
]),
|
|
|
|
copts = COPTS + [
|
|
|
|
"-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
|
2016-02-16 23:17:10 +00:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"],
|
|
|
|
}),
|
2015-12-07 21:08:21 +00:00
|
|
|
includes = [
|
|
|
|
"python/",
|
|
|
|
"src/",
|
|
|
|
],
|
|
|
|
linkshared = 1,
|
|
|
|
linkstatic = 1,
|
2015-12-08 16:24:37 +00:00
|
|
|
deps = [
|
|
|
|
":protobuf",
|
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
2016-02-12 02:11:10 +00:00
|
|
|
":use_fast_cpp_protos": ["//external:python_headers"],
|
2015-12-08 16:24:37 +00:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "use_fast_cpp_protos",
|
|
|
|
values = {
|
|
|
|
"define": "use_fast_cpp_protos=true",
|
|
|
|
},
|
2015-12-07 21:08:21 +00:00
|
|
|
)
|
|
|
|
|
2016-02-16 23:17:10 +00:00
|
|
|
config_setting(
|
|
|
|
name = "allow_oversize_protos",
|
|
|
|
values = {
|
|
|
|
"define": "allow_oversize_protos=true",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
py_proto_library(
|
2015-10-21 17:56:38 +00:00
|
|
|
name = "protobuf_python",
|
2015-10-20 00:19:49 +00:00
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
|
|
|
include = "src",
|
2015-12-08 16:24:37 +00:00
|
|
|
data = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
":use_fast_cpp_protos": [
|
2015-12-08 18:46:17 +00:00
|
|
|
":internal/_api_implementation.so",
|
|
|
|
":pyext/_message.so",
|
2015-12-08 16:24:37 +00:00
|
|
|
],
|
|
|
|
}),
|
2015-12-07 21:08:21 +00:00
|
|
|
default_runtime = "",
|
2015-10-20 22:00:13 +00:00
|
|
|
protoc = ":protoc",
|
2016-02-12 02:11:10 +00:00
|
|
|
py_libs = [
|
|
|
|
":python_srcs",
|
|
|
|
"//external:six"
|
|
|
|
],
|
2015-12-07 21:08:21 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-20 00:19:49 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_proto_library(
|
|
|
|
name = "python_common_test_protos",
|
|
|
|
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
|
|
|
|
include = "src",
|
2015-12-07 21:08:21 +00:00
|
|
|
default_runtime = "",
|
2015-10-20 22:00:13 +00:00
|
|
|
protoc = ":protoc",
|
2016-04-08 20:30:13 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-21 17:56:38 +00:00
|
|
|
deps = [":protobuf_python"],
|
2015-10-20 00:19:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
py_proto_library(
|
|
|
|
name = "python_specific_test_protos",
|
2015-10-22 18:13:14 +00:00
|
|
|
srcs = glob([
|
|
|
|
"python/google/protobuf/internal/*.proto",
|
|
|
|
"python/google/protobuf/internal/import_test_package/*.proto",
|
|
|
|
]),
|
2015-10-20 00:19:49 +00:00
|
|
|
include = "python",
|
2015-12-07 21:08:21 +00:00
|
|
|
default_runtime = ":protobuf_python",
|
2015-10-20 22:00:13 +00:00
|
|
|
protoc = ":protoc",
|
2016-04-08 20:30:13 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-20 00:19:49 +00:00
|
|
|
deps = [":python_common_test_protos"],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
name = "python_tests",
|
2016-02-12 02:11:10 +00:00
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"python/google/protobuf/internal/*_test.py",
|
|
|
|
"python/google/protobuf/internal/test_util.py",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
imports = ["python"],
|
2015-12-03 21:11:19 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-20 00:19:49 +00:00
|
|
|
deps = [
|
2015-10-21 17:56:38 +00:00
|
|
|
":protobuf_python",
|
2015-10-21 18:19:16 +00:00
|
|
|
":python_common_test_protos",
|
2015-10-20 00:19:49 +00:00
|
|
|
":python_specific_test_protos",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
internal_protobuf_py_tests(
|
2015-10-20 23:21:41 +00:00
|
|
|
name = "python_tests_batch",
|
2015-10-22 18:13:14 +00:00
|
|
|
data = glob([
|
|
|
|
"src/google/protobuf/**/*",
|
|
|
|
]),
|
2015-10-20 00:19:49 +00:00
|
|
|
modules = [
|
|
|
|
"descriptor_database_test",
|
|
|
|
"descriptor_pool_test",
|
|
|
|
"descriptor_test",
|
|
|
|
"generator_test",
|
|
|
|
"json_format_test",
|
|
|
|
"message_factory_test",
|
2015-10-22 18:13:14 +00:00
|
|
|
"message_test",
|
2015-10-20 00:19:49 +00:00
|
|
|
"proto_builder_test",
|
2015-10-22 18:13:14 +00:00
|
|
|
"reflection_test",
|
2015-10-20 00:19:49 +00:00
|
|
|
"service_reflection_test",
|
|
|
|
"symbol_database_test",
|
|
|
|
"text_encoding_test",
|
2015-10-22 18:13:14 +00:00
|
|
|
"text_format_test",
|
2015-10-20 00:19:49 +00:00
|
|
|
"unknown_fields_test",
|
|
|
|
"wire_format_test",
|
|
|
|
],
|
|
|
|
deps = [":python_tests"],
|
|
|
|
)
|