2017-12-01 11:05:32 +00:00
|
|
|
# Bazel (https://bazel.build/) BUILD file for Protobuf.
|
2015-06-18 00:37:58 +00:00
|
|
|
|
2020-03-02 23:15:22 +00:00
|
|
|
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
2020-01-15 18:27:35 +00:00
|
|
|
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
|
2021-11-04 22:57:29 +00:00
|
|
|
load("@rules_pkg//:pkg.bzl", "pkg_zip")
|
2022-01-07 01:22:31 +00:00
|
|
|
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
|
2019-07-23 14:28:57 +00:00
|
|
|
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
|
2019-08-06 19:12:06 +00:00
|
|
|
load("@rules_python//python:defs.bzl", "py_library")
|
2021-08-04 12:03:24 +00:00
|
|
|
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
|
2020-01-15 18:27:35 +00:00
|
|
|
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
|
2021-11-04 22:57:29 +00:00
|
|
|
load(":protobuf_release.bzl", "package_naming")
|
2015-06-18 00:37:58 +00:00
|
|
|
licenses(["notice"])
|
|
|
|
|
2016-08-04 22:32:14 +00:00
|
|
|
exports_files(["LICENSE"])
|
|
|
|
|
2020-03-02 23:15:22 +00:00
|
|
|
################################################################################
|
|
|
|
# build configuration
|
|
|
|
################################################################################
|
|
|
|
|
2018-12-11 19:58:26 +00:00
|
|
|
################################################################################
|
|
|
|
# ZLIB configuration
|
|
|
|
################################################################################
|
|
|
|
|
2019-04-12 22:41:08 +00:00
|
|
|
ZLIB_DEPS = ["@zlib//:zlib"]
|
2018-12-11 19:58:26 +00:00
|
|
|
|
2015-06-28 22:23:02 +00:00
|
|
|
################################################################################
|
|
|
|
# Protobuf Runtime Library
|
|
|
|
################################################################################
|
|
|
|
|
2018-03-22 20:14:10 +00:00
|
|
|
MSVC_COPTS = [
|
2019-07-01 19:21:04 +00:00
|
|
|
"/wd4018", # -Wno-sign-compare
|
|
|
|
"/wd4065", # switch statement contains 'default' but no 'case' labels
|
|
|
|
"/wd4146", # unary minus operator applied to unsigned type, result still unsigned
|
|
|
|
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
|
|
|
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
|
|
|
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
|
|
|
|
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
|
|
|
|
"/wd4307", # 'operator' : integral constant overflow
|
|
|
|
"/wd4309", # 'conversion' : truncation of constant value
|
|
|
|
"/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
|
|
|
"/wd4355", # 'this' : used in base member initializer list
|
|
|
|
"/wd4506", # no definition for inline function 'function'
|
|
|
|
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
|
|
|
"/wd4996", # The compiler encountered a deprecated declaration.
|
2015-06-18 00:37:58 +00:00
|
|
|
]
|
|
|
|
|
2017-05-31 12:01:23 +00:00
|
|
|
COPTS = select({
|
2019-07-01 19:21:04 +00:00
|
|
|
":msvc": MSVC_COPTS,
|
2017-05-31 12:01:23 +00:00
|
|
|
"//conditions:default": [
|
2018-12-11 19:58:26 +00:00
|
|
|
"-DHAVE_ZLIB",
|
2021-08-03 20:31:58 +00:00
|
|
|
"-Wmissing-field-initializers",
|
2017-05-31 12:01:23 +00:00
|
|
|
"-Woverloaded-virtual",
|
|
|
|
"-Wno-sign-compare",
|
|
|
|
],
|
|
|
|
})
|
|
|
|
|
2018-08-28 12:07:55 +00:00
|
|
|
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
|
|
|
|
|
2019-07-01 19:21:04 +00:00
|
|
|
create_compiler_config_setting(
|
2018-03-22 20:14:10 +00:00
|
|
|
name = "msvc",
|
2019-07-01 19:21:04 +00:00
|
|
|
value = "msvc-cl",
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
2017-05-31 12:01:23 +00:00
|
|
|
)
|
|
|
|
|
2021-10-13 21:19:42 +00:00
|
|
|
# Android NDK builds can specify different crosstool_top flags to choose which
|
|
|
|
# STL they use for C++. We need these multiple variants to catch all of those
|
|
|
|
# versions of crosstool_top and reliably detect Android.
|
|
|
|
#
|
|
|
|
# For more info on the various crosstool_tops used by NDK Bazel builds, see:
|
|
|
|
# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl
|
|
|
|
|
2016-04-04 19:13:30 +00:00
|
|
|
config_setting(
|
|
|
|
name = "android",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "//external:android/crosstool",
|
|
|
|
},
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
2016-04-04 19:13:30 +00:00
|
|
|
)
|
|
|
|
|
2021-10-13 21:19:42 +00:00
|
|
|
config_setting(
|
|
|
|
name = "android-stlport",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "@androidndk//:toolchain-stlport",
|
|
|
|
},
|
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-04-02 12:08:37 +00:00
|
|
|
config_setting(
|
|
|
|
name = "android-libcpp",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "@androidndk//:toolchain-libcpp",
|
|
|
|
},
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
2019-04-02 12:08:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "android-gnu-libstdcpp",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp",
|
|
|
|
},
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
2019-04-02 12:08:37 +00:00
|
|
|
)
|
|
|
|
|
2021-10-13 21:19:42 +00:00
|
|
|
config_setting(
|
|
|
|
name = "android-default",
|
|
|
|
values = {
|
|
|
|
"crosstool_top": "@androidndk//:default_crosstool",
|
|
|
|
},
|
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2018-03-22 20:14:10 +00:00
|
|
|
# Android and MSVC builds do not need to link in a separate pthread library.
|
2016-04-04 19:13:30 +00:00
|
|
|
LINK_OPTS = select({
|
2016-04-04 20:13:31 +00:00
|
|
|
":android": [],
|
2021-10-13 21:19:42 +00:00
|
|
|
":android-stlport": [],
|
2019-04-02 12:08:37 +00:00
|
|
|
":android-libcpp": [],
|
|
|
|
":android-gnu-libstdcpp": [],
|
2021-10-13 21:19:42 +00:00
|
|
|
":android-default": [],
|
2018-05-24 16:51:53 +00:00
|
|
|
":msvc": [
|
2018-06-06 02:03:25 +00:00
|
|
|
# Suppress linker warnings about files with no symbols defined.
|
|
|
|
"-ignore:4221",
|
2017-12-01 11:05:32 +00:00
|
|
|
],
|
2019-07-01 19:21:04 +00:00
|
|
|
"//conditions:default": [
|
|
|
|
"-lpthread",
|
|
|
|
"-lm",
|
|
|
|
],
|
2016-04-04 19:13:30 +00:00
|
|
|
})
|
2015-06-18 00:37:58 +00:00
|
|
|
|
2015-10-20 22:00:13 +00:00
|
|
|
load(
|
2017-02-08 20:23:57 +00:00
|
|
|
":protobuf.bzl",
|
2020-02-15 12:26:56 +00:00
|
|
|
"adapt_proto_library",
|
2015-10-20 22:00:13 +00:00
|
|
|
"cc_proto_library",
|
2016-05-20 23:49:04 +00:00
|
|
|
"internal_copied_filegroup",
|
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",
|
2019-07-20 10:49:03 +00:00
|
|
|
"py_proto_library",
|
2015-10-20 22:00:13 +00:00
|
|
|
)
|
2015-10-15 00:12:11 +00:00
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
cc_library(
|
|
|
|
name = "protobuf_lite",
|
|
|
|
srcs = [
|
|
|
|
# AUTOGEN(protobuf_lite_srcs)
|
2019-03-14 10:35:05 +00:00
|
|
|
"src/google/protobuf/any_lite.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/arena.cc",
|
2020-09-28 19:19:39 +00:00
|
|
|
"src/google/protobuf/arenastring.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/extension_set.cc",
|
2019-05-03 22:08:01 +00:00
|
|
|
"src/google/protobuf/generated_enum_util.cc",
|
2017-07-25 21:38:00 +00:00
|
|
|
"src/google/protobuf/generated_message_table_driven_lite.cc",
|
2021-09-11 02:32:15 +00:00
|
|
|
"src/google/protobuf/generated_message_tctable_lite.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/generated_message_util.cc",
|
2017-12-07 22:16:50 +00:00
|
|
|
"src/google/protobuf/implicit_weak_message.cc",
|
2021-08-03 20:44:26 +00:00
|
|
|
"src/google/protobuf/inlined_string_field.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/io/coded_stream.cc",
|
2019-04-09 13:48:01 +00:00
|
|
|
"src/google/protobuf/io/io_win32.cc",
|
2019-06-06 01:28:16 +00:00
|
|
|
"src/google/protobuf/io/strtod.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/io/zero_copy_stream.cc",
|
2019-05-03 22:08:01 +00:00
|
|
|
"src/google/protobuf/io/zero_copy_stream_impl.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
|
2020-08-18 00:12:44 +00:00
|
|
|
"src/google/protobuf/map.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/message_lite.cc",
|
2019-03-14 10:35:05 +00:00
|
|
|
"src/google/protobuf/parse_context.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/repeated_field.cc",
|
2021-10-12 18:49:50 +00:00
|
|
|
"src/google/protobuf/repeated_ptr_field.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 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",
|
|
|
|
],
|
2019-07-01 19:21:04 +00:00
|
|
|
hdrs = glob([
|
|
|
|
"src/google/protobuf/**/*.h",
|
|
|
|
"src/google/protobuf/**/*.inc",
|
|
|
|
]),
|
2017-10-15 20:06:58 +00:00
|
|
|
copts = COPTS,
|
2015-06-18 00:37:58 +00:00
|
|
|
includes = ["src/"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2018-12-11 19:58:26 +00:00
|
|
|
PROTOBUF_DEPS = select({
|
|
|
|
":msvc": [],
|
|
|
|
"//conditions:default": ZLIB_DEPS,
|
|
|
|
})
|
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
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",
|
2021-08-18 17:25:22 +00:00
|
|
|
"src/google/protobuf/generated_message_bases.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/generated_message_reflection.cc",
|
2017-07-25 18:52:33 +00:00
|
|
|
"src/google/protobuf/generated_message_table_driven.cc",
|
2021-09-11 02:32:15 +00:00
|
|
|
"src/google/protobuf/generated_message_tctable_full.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/io/gzip_stream.cc",
|
|
|
|
"src/google/protobuf/io/printer.cc",
|
|
|
|
"src/google/protobuf/io/tokenizer.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",
|
|
|
|
"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",
|
2017-03-20 19:52:37 +00:00
|
|
|
"src/google/protobuf/util/delimited_message_util.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/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",
|
|
|
|
],
|
2019-07-01 19:21:04 +00:00
|
|
|
hdrs = glob([
|
|
|
|
"src/**/*.h",
|
|
|
|
"src/**/*.inc",
|
|
|
|
]),
|
2017-10-15 20:06:58 +00:00
|
|
|
copts = COPTS,
|
2015-06-18 00:37:58 +00:00
|
|
|
includes = ["src/"],
|
|
|
|
linkopts = LINK_OPTS,
|
|
|
|
visibility = ["//visibility:public"],
|
2018-12-11 19:58:26 +00:00
|
|
|
deps = [":protobuf_lite"] + PROTOBUF_DEPS,
|
2015-06-18 00:37:58 +00:00
|
|
|
)
|
|
|
|
|
2017-03-03 02:02:05 +00:00
|
|
|
# This provides just the header files for use in projects that need to build
|
|
|
|
# shared libraries for dynamic loading. This target is available until Bazel
|
|
|
|
# adds native support for such use cases.
|
|
|
|
# TODO(keveman): Remove this target once the support gets added to Bazel.
|
2017-02-23 16:17:24 +00:00
|
|
|
cc_library(
|
|
|
|
name = "protobuf_headers",
|
2019-07-01 19:21:04 +00:00
|
|
|
hdrs = glob([
|
|
|
|
"src/**/*.h",
|
|
|
|
"src/**/*.inc",
|
|
|
|
]),
|
2017-02-23 16:17:24 +00:00
|
|
|
includes = ["src/"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2017-09-05 15:15:10 +00:00
|
|
|
# Map of all well known protos.
|
|
|
|
# name => (include path, imports)
|
|
|
|
WELL_KNOWN_PROTO_MAP = {
|
2019-07-18 13:55:47 +00:00
|
|
|
"any": ("src/google/protobuf/any.proto", []),
|
2019-07-01 19:21:04 +00:00
|
|
|
"api": (
|
2019-07-18 13:55:47 +00:00
|
|
|
"src/google/protobuf/api.proto",
|
2019-07-01 19:21:04 +00:00
|
|
|
[
|
|
|
|
"source_context",
|
|
|
|
"type",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
"compiler_plugin": (
|
2019-07-18 13:55:47 +00:00
|
|
|
"src/google/protobuf/compiler/plugin.proto",
|
2019-07-01 19:21:04 +00:00
|
|
|
["descriptor"],
|
|
|
|
),
|
2019-07-18 13:55:47 +00:00
|
|
|
"descriptor": ("src/google/protobuf/descriptor.proto", []),
|
|
|
|
"duration": ("src/google/protobuf/duration.proto", []),
|
|
|
|
"empty": ("src/google/protobuf/empty.proto", []),
|
|
|
|
"field_mask": ("src/google/protobuf/field_mask.proto", []),
|
|
|
|
"source_context": ("src/google/protobuf/source_context.proto", []),
|
|
|
|
"struct": ("src/google/protobuf/struct.proto", []),
|
|
|
|
"timestamp": ("src/google/protobuf/timestamp.proto", []),
|
2019-07-01 19:21:04 +00:00
|
|
|
"type": (
|
2019-07-18 13:55:47 +00:00
|
|
|
"src/google/protobuf/type.proto",
|
2019-07-01 19:21:04 +00:00
|
|
|
[
|
|
|
|
"any",
|
|
|
|
"source_context",
|
|
|
|
],
|
|
|
|
),
|
2019-07-18 13:55:47 +00:00
|
|
|
"wrappers": ("src/google/protobuf/wrappers.proto", []),
|
2017-09-05 15:15:10 +00:00
|
|
|
}
|
|
|
|
|
2019-07-18 13:55:47 +00:00
|
|
|
WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()]
|
2015-10-20 00:19:49 +00:00
|
|
|
|
2021-06-21 22:28:17 +00:00
|
|
|
LITE_WELL_KNOWN_PROTO_MAP = {
|
|
|
|
"any": ("src/google/protobuf/any.proto", []),
|
|
|
|
"api": (
|
|
|
|
"src/google/protobuf/api.proto",
|
|
|
|
[
|
|
|
|
"source_context",
|
|
|
|
"type",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
"duration": ("src/google/protobuf/duration.proto", []),
|
|
|
|
"empty": ("src/google/protobuf/empty.proto", []),
|
|
|
|
"field_mask": ("src/google/protobuf/field_mask.proto", []),
|
|
|
|
"source_context": ("src/google/protobuf/source_context.proto", []),
|
|
|
|
"struct": ("src/google/protobuf/struct.proto", []),
|
|
|
|
"timestamp": ("src/google/protobuf/timestamp.proto", []),
|
|
|
|
"type": (
|
|
|
|
"src/google/protobuf/type.proto",
|
|
|
|
[
|
|
|
|
"any",
|
|
|
|
"source_context",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
"wrappers": ("src/google/protobuf/wrappers.proto", []),
|
|
|
|
}
|
|
|
|
|
|
|
|
LITE_WELL_KNOWN_PROTOS = [value[0] for value in LITE_WELL_KNOWN_PROTO_MAP.values()]
|
|
|
|
|
2016-03-23 00:56:07 +00:00
|
|
|
filegroup(
|
|
|
|
name = "well_known_protos",
|
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-06-21 22:28:17 +00:00
|
|
|
filegroup(
|
|
|
|
name = "lite_well_known_protos",
|
|
|
|
srcs = LITE_WELL_KNOWN_PROTOS,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2020-02-15 12:26:56 +00:00
|
|
|
adapt_proto_library(
|
|
|
|
name = "cc_wkt_protos_genproto",
|
|
|
|
visibility = ["//visibility:public"],
|
2021-08-04 12:03:24 +00:00
|
|
|
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
2020-02-15 12:26:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
2015-10-15 00:12:11 +00:00
|
|
|
name = "cc_wkt_protos",
|
2020-02-15 12:26:56 +00:00
|
|
|
deprecation = "Only for backward compatibility. Do not use.",
|
2015-11-17 20:36:21 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2015-10-15 00:12:11 +00:00
|
|
|
)
|
|
|
|
|
2017-09-05 15:15:10 +00:00
|
|
|
################################################################################
|
|
|
|
# Well Known Types Proto Library Rules
|
|
|
|
#
|
|
|
|
# These proto_library rules can be used with one of the language specific proto
|
|
|
|
# library rules i.e. java_proto_library:
|
|
|
|
#
|
|
|
|
# java_proto_library(
|
|
|
|
# name = "any_java_proto",
|
|
|
|
# deps = ["@com_google_protobuf//:any_proto],
|
|
|
|
# )
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
[proto_library(
|
|
|
|
name = proto[0] + "_proto",
|
|
|
|
srcs = [proto[1][0]],
|
2019-07-18 13:55:47 +00:00
|
|
|
strip_import_prefix = "src",
|
2017-09-05 15:15:10 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2019-07-01 19:21:04 +00:00
|
|
|
deps = [dep + "_proto" for dep in proto[1][1]],
|
|
|
|
) for proto in WELL_KNOWN_PROTO_MAP.items()]
|
2017-09-05 15:15:10 +00:00
|
|
|
|
2020-01-15 18:27:35 +00:00
|
|
|
[native_cc_proto_library(
|
|
|
|
name = proto + "_cc_proto",
|
|
|
|
visibility = ["//visibility:private"],
|
2021-08-04 12:03:24 +00:00
|
|
|
deps = [proto + "_proto"],
|
2020-01-15 18:27:35 +00:00
|
|
|
) for proto in WELL_KNOWN_PROTO_MAP.keys()]
|
|
|
|
|
|
|
|
cc_proto_blacklist_test(
|
|
|
|
name = "cc_proto_blacklist_test",
|
2020-10-21 17:04:14 +00:00
|
|
|
tags = [
|
|
|
|
# Exclude this target from wildcard expansion (//...). Due to
|
|
|
|
# https://github.com/bazelbuild/bazel/issues/10590, this test has to
|
|
|
|
# be nominated using the `@com_google_protobuf//` prefix. We do that,
|
|
|
|
# e.g., in kokoro/linux/bazel/build.sh.
|
|
|
|
# See also https://github.com/protocolbuffers/protobuf/pull/7096.
|
|
|
|
"manual",
|
|
|
|
],
|
2021-08-04 12:03:24 +00:00
|
|
|
deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
2020-01-15 18:27:35 +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",
|
2017-09-12 17:32:01 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
|
2021-04-16 15:10:49 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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",
|
2021-03-24 20:00:57 +00:00
|
|
|
"src/google/protobuf/compiler/java/java_kotlin_generator.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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",
|
2015-12-29 01:33:55 +00:00
|
|
|
"src/google/protobuf/compiler/js/js_generator.cc",
|
2016-12-05 18:16:47 +00:00
|
|
|
"src/google/protobuf/compiler/js/well_known_types_embed.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",
|
2016-09-22 22:14:58 +00:00
|
|
|
"src/google/protobuf/compiler/php/php_generator.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/compiler/plugin.cc",
|
2018-03-02 00:36:05 +00:00
|
|
|
"src/google/protobuf/compiler/plugin.pb.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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/"],
|
2018-08-14 14:01:24 +00:00
|
|
|
linkopts = LINK_OPTS,
|
2015-06-18 00:37:58 +00:00
|
|
|
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"],
|
|
|
|
)
|
|
|
|
|
2021-11-04 22:57:29 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Generates protoc release artifacts.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "protoc_readme",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
cmd = """
|
|
|
|
echo "Protocol Buffers - Google's data interchange format
|
|
|
|
Copyright 2008 Google Inc.
|
|
|
|
https://developers.google.com/protocol-buffers/
|
|
|
|
This package contains a precompiled binary version of the protocol buffer
|
|
|
|
compiler (protoc). This binary is intended for users who want to use Protocol
|
|
|
|
Buffers in languages other than C++ but do not want to compile protoc
|
|
|
|
themselves. To install, simply place this binary somewhere in your PATH.
|
|
|
|
If you intend to use the included well known types then don't forget to
|
|
|
|
copy the contents of the 'include' directory somewhere as well, for example
|
|
|
|
into '/usr/local/include/'.
|
|
|
|
Please refer to our official github site for more installation instructions:
|
|
|
|
https://github.com/protocolbuffers/protobuf" > $@
|
|
|
|
""",
|
|
|
|
outs = ["readme.txt"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# plugin.proto is excluded from this list because it belongs in a nested folder (protobuf/compiler/plugin.proto)
|
|
|
|
pkg_files(
|
|
|
|
name = "wkt_protos_files",
|
|
|
|
srcs = [value[0] for value in WELL_KNOWN_PROTO_MAP.values() if not value[0].endswith("plugin.proto")],
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
prefix = "include/google/protobuf",
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
name = "compiler_plugin_protos_files",
|
|
|
|
srcs = ["src/google/protobuf/compiler/plugin.proto"],
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
prefix = "include/google/protobuf/compiler",
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
name = "protoc_files",
|
|
|
|
srcs = [":protoc"],
|
2022-01-07 01:22:31 +00:00
|
|
|
attributes = pkg_attributes(mode = "0555"),
|
2021-11-04 22:57:29 +00:00
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
prefix = "bin/",
|
|
|
|
)
|
|
|
|
|
|
|
|
package_naming(
|
|
|
|
name = "protoc_pkg_naming",
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_zip(
|
|
|
|
name = "protoc_release",
|
2021-11-24 21:27:54 +00:00
|
|
|
package_file_name = "protoc-{version}-{platform}.zip",
|
2021-11-04 22:57:29 +00:00
|
|
|
package_variables = ":protoc_pkg_naming",
|
|
|
|
srcs = [
|
|
|
|
":protoc_files",
|
|
|
|
":wkt_protos_files",
|
|
|
|
":compiler_plugin_protos_files",
|
|
|
|
"readme.txt",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2015-06-18 00:37:58 +00:00
|
|
|
################################################################################
|
|
|
|
# Tests
|
|
|
|
################################################################################
|
|
|
|
|
2021-04-20 18:36:32 +00:00
|
|
|
filegroup(
|
|
|
|
name = "testdata",
|
|
|
|
srcs = glob(["src/google/protobuf/testdata/**/*"]),
|
2021-08-04 12:03:24 +00:00
|
|
|
visibility = ["//:__subpackages__"],
|
2021-04-20 18:36:32 +00:00
|
|
|
)
|
|
|
|
|
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-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",
|
2017-03-29 21:01:40 +00:00
|
|
|
"google/protobuf/unittest_lazy_dependencies.proto",
|
|
|
|
"google/protobuf/unittest_lazy_dependencies_custom_option.proto",
|
|
|
|
"google/protobuf/unittest_lazy_dependencies_enum.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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_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",
|
2018-08-13 19:58:55 +00:00
|
|
|
"google/protobuf/unittest_proto3.proto",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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",
|
2020-04-01 00:31:32 +00:00
|
|
|
"google/protobuf/unittest_proto3_optional.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",
|
2016-09-22 22:11:17 +00:00
|
|
|
"google/protobuf/util/internal/testdata/proto3.proto",
|
2015-06-18 20:38:36 +00:00
|
|
|
"google/protobuf/util/internal/testdata/struct.proto",
|
|
|
|
"google/protobuf/util/internal/testdata/timestamp_duration.proto",
|
2016-09-22 22:11:17 +00:00
|
|
|
"google/protobuf/util/internal/testdata/wrappers.proto",
|
2018-08-13 19:58:55 +00:00
|
|
|
"google/protobuf/util/json_format.proto",
|
2015-06-18 20:38:36 +00:00
|
|
|
"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]
|
|
|
|
|
2021-04-20 18:36:32 +00:00
|
|
|
GENERIC_RELATIVE_TEST_PROTOS = [
|
|
|
|
"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_lazy_dependencies.proto",
|
|
|
|
"google/protobuf/unittest_lazy_dependencies_custom_option.proto",
|
|
|
|
"google/protobuf/unittest_lazy_dependencies_enum.proto",
|
|
|
|
"google/protobuf/unittest_lite_imports_nonlite.proto",
|
|
|
|
"google/protobuf/unittest_mset.proto",
|
|
|
|
"google/protobuf/unittest_mset_wire_format.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.proto",
|
|
|
|
"google/protobuf/unittest_proto3_arena.proto",
|
|
|
|
"google/protobuf/unittest_proto3_arena_lite.proto",
|
|
|
|
"google/protobuf/unittest_proto3_lite.proto",
|
|
|
|
"google/protobuf/unittest_proto3_optional.proto",
|
|
|
|
"google/protobuf/unittest_well_known_types.proto",
|
|
|
|
]
|
|
|
|
|
|
|
|
GENERIC_TEST_PROTOS = ["src/" + s for s in GENERIC_RELATIVE_TEST_PROTOS]
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "generic_test_protos",
|
|
|
|
srcs = LITE_TEST_PROTOS + GENERIC_TEST_PROTOS,
|
2021-08-04 12:03:24 +00:00
|
|
|
strip_import_prefix = "src",
|
|
|
|
visibility = ["//:__subpackages__"],
|
2021-04-20 18:36:32 +00:00
|
|
|
deps = [
|
|
|
|
"//:any_proto",
|
|
|
|
"//:api_proto",
|
|
|
|
"//:descriptor_proto",
|
|
|
|
"//:duration_proto",
|
|
|
|
"//:empty_proto",
|
|
|
|
"//:field_mask_proto",
|
|
|
|
"//:source_context_proto",
|
|
|
|
"//:struct_proto",
|
|
|
|
"//:timestamp_proto",
|
|
|
|
"//:type_proto",
|
|
|
|
"//:wrappers_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
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",
|
2021-09-11 02:32:15 +00:00
|
|
|
"src/google/protobuf/map_lite_test_util.cc",
|
|
|
|
"src/google/protobuf/test_util_lite.cc",
|
2019-07-20 10:49:03 +00:00
|
|
|
"src/google/protobuf/map_test_util.inc",
|
2021-08-03 20:44:26 +00:00
|
|
|
"src/google/protobuf/reflection_tester.cc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"src/google/protobuf/test_util.cc",
|
2018-03-23 17:19:04 +00:00
|
|
|
"src/google/protobuf/test_util.inc",
|
2015-06-18 00:37:58 +00:00
|
|
|
"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",
|
2021-03-10 09:20:39 +00:00
|
|
|
testonly = True,
|
2015-06-18 23:45:27 +00:00
|
|
|
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",
|
2021-03-10 09:20:39 +00:00
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
],
|
2015-06-18 23:45:27 +00:00
|
|
|
)
|
|
|
|
|
2017-07-25 18:52:33 +00:00
|
|
|
cc_test(
|
|
|
|
name = "win32_test",
|
2019-04-09 13:48:01 +00:00
|
|
|
srcs = ["src/google/protobuf/io/io_win32_unittest.cc"],
|
2019-07-01 19:21:04 +00:00
|
|
|
tags = [
|
|
|
|
"manual",
|
|
|
|
"windows",
|
|
|
|
],
|
2017-07-25 18:52:33 +00:00
|
|
|
deps = [
|
|
|
|
":protobuf_lite",
|
2021-03-10 09:20:39 +00:00
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
2017-07-25 18:52:33 +00:00
|
|
|
)
|
|
|
|
|
2015-06-18 23:45:27 +00:00
|
|
|
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",
|
2017-10-18 21:31:23 +00:00
|
|
|
"src/google/protobuf/compiler/annotation_test_util.cc",
|
2021-08-18 17:25:22 +00:00
|
|
|
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
|
2017-07-19 19:10:43 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
|
|
|
|
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
|
2018-03-23 17:19:04 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/cpp_unittest.inc",
|
2016-04-18 21:12:08 +00:00
|
|
|
"src/google/protobuf/compiler/cpp/metadata_test.cc",
|
2017-03-29 21:01:40 +00:00
|
|
|
"src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.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",
|
2021-08-03 20:44:26 +00:00
|
|
|
"src/google/protobuf/inlined_string_field_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/io/coded_stream_unittest.cc",
|
2019-04-09 13:48:01 +00:00
|
|
|
"src/google/protobuf/io/io_win32_unittest.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"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",
|
2021-08-03 21:13:43 +00:00
|
|
|
"src/google/protobuf/map_test.inc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/message_unittest.cc",
|
2018-03-23 17:19:04 +00:00
|
|
|
"src/google/protobuf/message_unittest.inc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"src/google/protobuf/no_field_presence_test.cc",
|
|
|
|
"src/google/protobuf/preserve_unknown_enum_test.cc",
|
2016-04-15 16:23:50 +00:00
|
|
|
"src/google/protobuf/proto3_arena_lite_unittest.cc",
|
2016-04-28 21:43:22 +00:00
|
|
|
"src/google/protobuf/proto3_arena_unittest.cc",
|
2016-04-15 16:23:50 +00:00
|
|
|
"src/google/protobuf/proto3_lite_unittest.cc",
|
2018-08-13 19:58:55 +00:00
|
|
|
"src/google/protobuf/proto3_lite_unittest.inc",
|
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/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/text_format_unittest.cc",
|
|
|
|
"src/google/protobuf/unknown_field_set_unittest.cc",
|
2017-03-16 12:01:22 +00:00
|
|
|
"src/google/protobuf/util/delimited_message_util_test.cc",
|
2015-06-18 23:45:27 +00:00
|
|
|
"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",
|
2021-08-03 20:44:26 +00:00
|
|
|
"src/google/protobuf/wire_format_unittest.inc",
|
2018-12-14 11:53:36 +00:00
|
|
|
] + select({
|
2019-07-01 19:21:04 +00:00
|
|
|
"//conditions:default": [
|
2019-07-20 10:49:03 +00:00
|
|
|
# AUTOGEN(non_msvc_test_srcs)
|
2018-12-14 11:53:36 +00:00
|
|
|
],
|
2019-07-01 19:21:04 +00:00
|
|
|
":msvc": [],
|
2018-12-14 11:53:36 +00:00
|
|
|
}),
|
2021-08-04 13:10:22 +00:00
|
|
|
copts = COPTS + select({
|
|
|
|
":msvc": [],
|
|
|
|
"//conditions:default": [
|
|
|
|
"-Wno-deprecated-declarations",
|
|
|
|
],
|
|
|
|
}),
|
2015-06-18 23:45:27 +00:00
|
|
|
data = [
|
|
|
|
":test_plugin",
|
2015-10-21 18:19:16 +00:00
|
|
|
] + glob([
|
|
|
|
"src/google/protobuf/**/*",
|
2017-03-29 22:14:18 +00:00
|
|
|
# Files for csharp_bootstrap_unittest.cc.
|
|
|
|
"conformance/**/*",
|
|
|
|
"csharp/src/**/*",
|
2015-10-21 18:19:16 +00:00
|
|
|
]),
|
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",
|
2021-03-10 09:20:39 +00:00
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
] + PROTOBUF_DEPS,
|
2015-06-18 23:45:27 +00:00
|
|
|
)
|
2015-10-20 00:19:49 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Java support
|
|
|
|
################################################################################
|
2020-02-13 21:04:14 +00:00
|
|
|
|
2016-02-25 15:53:19 +00:00
|
|
|
internal_gen_well_known_protos_java(
|
2020-02-13 21:04:14 +00:00
|
|
|
name = "gen_well_known_protos_java",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
2021-08-04 12:03:24 +00:00
|
|
|
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
2015-10-20 00:19:49 +00:00
|
|
|
)
|
|
|
|
|
2021-04-20 18:36:32 +00:00
|
|
|
internal_gen_well_known_protos_java(
|
|
|
|
name = "gen_well_known_protos_javalite",
|
|
|
|
javalite = True,
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
2021-08-04 12:03:24 +00:00
|
|
|
deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()],
|
2021-04-20 18:36:32 +00:00
|
|
|
)
|
|
|
|
|
2020-02-13 21:04:14 +00:00
|
|
|
alias(
|
2015-10-21 17:56:38 +00:00
|
|
|
name = "protobuf_java",
|
2020-02-13 21:04:14 +00:00
|
|
|
actual = "//java/core",
|
2015-10-20 00:19:49 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2020-02-13 21:04:14 +00:00
|
|
|
alias(
|
2019-05-24 14:26:07 +00:00
|
|
|
name = "protobuf_javalite",
|
2020-02-13 21:04:14 +00:00
|
|
|
actual = "//java/lite",
|
2015-10-20 00:19:49 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2020-02-13 21:04:14 +00:00
|
|
|
alias(
|
2016-03-11 01:50:25 +00:00
|
|
|
name = "protobuf_java_util",
|
2020-02-13 21:04:14 +00:00
|
|
|
actual = "//java/util",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
|
|
|
name = "java_toolchain",
|
|
|
|
actual = "//java/core:toolchain",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
|
|
|
name = "javalite_toolchain",
|
|
|
|
actual = "//java/lite:toolchain",
|
2017-02-23 16:17:24 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2016-03-11 01:50:25 +00:00
|
|
|
)
|
|
|
|
|
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(
|
|
|
|
[
|
[bazel/py] Omit google/__init__.py from the Protobuf runtime. (#7908)
Since `google` is a Python namespace package, the google/__init__.py
file should be omitted to avoid collisions. For example, its presence
may cause other Pip packages in the google namespace not to be found.
This change narrows which __init__.py files are included in the
`//:protobuf_runtime` target to include only those under
`google/protobuf`. It also moves their canonical inclusion to the
internal `//:python_srcs` rule, eliminating the dual specification in
`python_protobuf.extra_srcs`.
This is the difference in files, lexicographically ordered:
```
$ bazel cquery 'labels(srcs, kind(py_library, deps(:protobuf_python)))' | sort > /tmp/deps-{before,after}.txt
$ diff /tmp/deps-{before,after}.txt
1,5d0
< //:python/compatibility_tests/v2.5.0/tests/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py (null)
< //:python/google/__init__.py (null)
51d45
< //:python/protobuf_distutils/protobuf_distutils/__init__.py (null)
```
This seems like a desirable change, since it avoids polluting other
packages, too.
This change is conceptually similar to #7877, but for Bazel.
2020-09-23 22:20:38 +00:00
|
|
|
"python/google/protobuf/**/*.py",
|
2015-10-20 00:19:49 +00:00
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"python/google/protobuf/internal/*_test.py",
|
|
|
|
"python/google/protobuf/internal/test_util.py",
|
|
|
|
],
|
|
|
|
),
|
2016-02-12 02:11:10 +00:00
|
|
|
imports = ["python"],
|
2017-02-23 16:17:24 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-20 00:19:49 +00:00
|
|
|
)
|
|
|
|
|
2015-12-07 21:08:21 +00:00
|
|
|
cc_binary(
|
2016-10-18 20:16:44 +00:00
|
|
|
name = "python/google/protobuf/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",
|
|
|
|
],
|
2021-08-04 12:03:24 +00:00
|
|
|
linkshared = 1,
|
|
|
|
linkstatic = 1,
|
2020-10-21 17:04:14 +00:00
|
|
|
tags = [
|
|
|
|
# Exclude this target from wildcard expansion (//...) because it may
|
|
|
|
# not even be buildable. It will be built if it is needed according
|
|
|
|
# to :use_fast_cpp_protos.
|
|
|
|
# https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes
|
|
|
|
"manual",
|
|
|
|
],
|
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(
|
2016-10-18 20:16:44 +00:00
|
|
|
name = "python/google/protobuf/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/",
|
|
|
|
],
|
2021-08-04 12:03:24 +00:00
|
|
|
linkshared = 1,
|
|
|
|
linkstatic = 1,
|
2020-10-21 17:04:14 +00:00
|
|
|
tags = [
|
|
|
|
# Exclude this target from wildcard expansion (//...) because it may
|
|
|
|
# not even be buildable. It will be built if it is needed according
|
|
|
|
# to :use_fast_cpp_protos.
|
|
|
|
# https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes
|
|
|
|
"manual",
|
|
|
|
],
|
2015-12-08 16:24:37 +00:00
|
|
|
deps = [
|
|
|
|
":protobuf",
|
2018-05-29 22:26:11 +00:00
|
|
|
":proto_api",
|
2015-12-08 16:24:37 +00:00
|
|
|
] + 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",
|
|
|
|
},
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
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",
|
|
|
|
},
|
2020-02-13 21:04:14 +00:00
|
|
|
visibility = [
|
|
|
|
# Public, but Protobuf only visibility.
|
|
|
|
"//:__subpackages__",
|
|
|
|
],
|
2016-02-16 23:17:10 +00:00
|
|
|
)
|
|
|
|
|
2016-05-20 23:49:04 +00:00
|
|
|
# Copy the builtin proto files from src/google/protobuf to
|
|
|
|
# python/google/protobuf. This way, the generated Python sources will be in the
|
|
|
|
# same directory as the Python runtime sources. This is necessary for the
|
|
|
|
# modules to be imported correctly since they are all part of the same Python
|
|
|
|
# package.
|
|
|
|
internal_copied_filegroup(
|
|
|
|
name = "protos_python",
|
|
|
|
srcs = WELL_KNOWN_PROTOS,
|
|
|
|
dest = "python",
|
2017-02-23 16:17:24 +00:00
|
|
|
strip_prefix = "src",
|
2016-05-20 23:49:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
|
|
|
|
# which case we can simply add :protos_python in srcs.
|
2019-07-18 13:55:47 +00:00
|
|
|
COPIED_WELL_KNOWN_PROTOS = ["python/" + s[4:] for s in WELL_KNOWN_PROTOS]
|
2016-05-20 23:49:04 +00:00
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
py_proto_library(
|
2015-10-21 17:56:38 +00:00
|
|
|
name = "protobuf_python",
|
2016-05-20 23:49:04 +00:00
|
|
|
srcs = COPIED_WELL_KNOWN_PROTOS,
|
|
|
|
include = "python",
|
2015-12-08 16:24:37 +00:00
|
|
|
data = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
":use_fast_cpp_protos": [
|
2016-10-18 20:16:44 +00:00
|
|
|
":python/google/protobuf/internal/_api_implementation.so",
|
|
|
|
":python/google/protobuf/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",
|
|
|
|
],
|
2015-12-07 21:08:21 +00:00
|
|
|
srcs_version = "PY2AND3",
|
2015-10-20 00:19:49 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2016-05-20 23:49:04 +00:00
|
|
|
# Copy the test proto files from src/google/protobuf to
|
|
|
|
# python/google/protobuf. This way, the generated Python sources will be in the
|
|
|
|
# same directory as the Python runtime sources. This is necessary for the
|
|
|
|
# modules to be imported correctly by the tests since they are all part of the
|
|
|
|
# same Python package.
|
|
|
|
internal_copied_filegroup(
|
|
|
|
name = "protos_python_test",
|
|
|
|
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
|
|
|
|
dest = "python",
|
2017-02-23 16:17:24 +00:00
|
|
|
strip_prefix = "src",
|
2016-05-20 23:49:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
|
|
|
|
# which case we can simply add :protos_python_test in srcs.
|
|
|
|
COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS]
|
2017-02-23 16:17:24 +00:00
|
|
|
|
2016-05-20 23:49:04 +00:00
|
|
|
COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS]
|
|
|
|
|
2015-10-20 00:19:49 +00:00
|
|
|
py_proto_library(
|
|
|
|
name = "python_common_test_protos",
|
2016-05-20 23:49:04 +00:00
|
|
|
srcs = COPIED_LITE_TEST_PROTOS + COPIED_TEST_PROTOS,
|
|
|
|
include = "python",
|
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",
|
2016-05-20 23:49:04 +00:00
|
|
|
"python/google/protobuf/internal/import_test_package/__init__.py",
|
2016-02-12 02:11:10 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
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"],
|
|
|
|
)
|
2016-12-03 00:40:50 +00:00
|
|
|
|
2018-05-29 22:26:11 +00:00
|
|
|
cc_library(
|
|
|
|
name = "proto_api",
|
|
|
|
hdrs = ["python/google/protobuf/proto_api.h"],
|
2019-07-01 19:21:04 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2018-05-29 22:26:11 +00:00
|
|
|
deps = [
|
|
|
|
"//external:python_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2016-12-03 00:40:50 +00:00
|
|
|
proto_lang_toolchain(
|
2017-02-23 16:17:24 +00:00
|
|
|
name = "cc_toolchain",
|
2020-06-26 17:07:17 +00:00
|
|
|
blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
2017-02-23 16:17:24 +00:00
|
|
|
command_line = "--cpp_out=$(OUT)",
|
|
|
|
runtime = ":protobuf",
|
|
|
|
visibility = ["//visibility:public"],
|
2016-12-03 00:40:50 +00:00
|
|
|
)
|
2017-01-12 17:51:04 +00:00
|
|
|
|
2018-11-01 13:37:14 +00:00
|
|
|
alias(
|
|
|
|
name = "objectivec",
|
2020-07-08 15:21:38 +00:00
|
|
|
actual = "//objectivec",
|
2018-11-01 13:37:14 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
2017-05-01 16:49:26 +00:00
|
|
|
|
2020-07-08 15:21:38 +00:00
|
|
|
alias(
|
2018-11-01 13:37:14 +00:00
|
|
|
name = "protobuf_objc",
|
2020-07-08 15:21:38 +00:00
|
|
|
actual = "//objectivec",
|
2017-05-01 16:49:26 +00:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
2018-03-27 02:08:26 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Test generated proto support
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "generated_protos",
|
|
|
|
srcs = ["src/google/protobuf/unittest_import.proto"],
|
|
|
|
outs = ["unittest_gen.proto"],
|
2019-07-01 19:21:04 +00:00
|
|
|
cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)",
|
2018-03-27 02:08:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "generated_protos_proto",
|
2018-05-08 00:36:34 +00:00
|
|
|
srcs = [
|
|
|
|
"src/google/protobuf/unittest_import_public.proto",
|
2019-07-01 19:21:04 +00:00
|
|
|
"unittest_gen.proto",
|
2018-05-08 00:36:34 +00:00
|
|
|
],
|
2018-03-27 02:08:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
py_proto_library(
|
|
|
|
name = "generated_protos_py",
|
|
|
|
srcs = [
|
|
|
|
"src/google/protobuf/unittest_import_public.proto",
|
2019-07-01 19:21:04 +00:00
|
|
|
"unittest_gen.proto",
|
2018-03-27 02:08:26 +00:00
|
|
|
],
|
|
|
|
default_runtime = "",
|
|
|
|
protoc = ":protoc",
|
|
|
|
)
|
2018-11-03 19:59:45 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Conformance tests
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "test_messages_proto2_proto",
|
2019-05-13 14:45:30 +00:00
|
|
|
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
2018-11-03 21:43:20 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2018-11-03 19:59:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "test_messages_proto3_proto",
|
2019-05-13 14:45:30 +00:00
|
|
|
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
2019-07-01 19:21:04 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2018-11-03 19:59:45 +00:00
|
|
|
deps = [
|
|
|
|
":any_proto",
|
|
|
|
":duration_proto",
|
|
|
|
":field_mask_proto",
|
|
|
|
":struct_proto",
|
|
|
|
":timestamp_proto",
|
|
|
|
":wrappers_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_proto_library(
|
|
|
|
name = "test_messages_proto2_proto_cc",
|
2019-05-13 14:45:30 +00:00
|
|
|
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
2018-11-03 19:59:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_proto_library(
|
|
|
|
name = "test_messages_proto3_proto_cc",
|
2019-05-13 14:45:30 +00:00
|
|
|
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
2018-11-03 19:59:45 +00:00
|
|
|
deps = [
|
|
|
|
":cc_wkt_protos",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "conformance_proto",
|
2019-05-13 14:45:30 +00:00
|
|
|
srcs = ["conformance/conformance.proto"],
|
2018-11-03 21:43:20 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2018-11-03 19:59:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_proto_library(
|
|
|
|
name = "conformance_proto_cc",
|
|
|
|
srcs = ["conformance/conformance.proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "jsoncpp",
|
|
|
|
srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"],
|
2019-07-01 19:21:04 +00:00
|
|
|
hdrs = ["conformance/third_party/jsoncpp/json.h"],
|
2018-11-03 19:59:45 +00:00
|
|
|
includes = ["conformance"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "conformance_test",
|
|
|
|
srcs = [
|
|
|
|
"conformance/conformance_test.cc",
|
2019-05-13 14:45:30 +00:00
|
|
|
"conformance/conformance_test_runner.cc",
|
2018-11-03 19:59:45 +00:00
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"conformance/conformance_test.h",
|
|
|
|
],
|
2019-07-01 19:21:04 +00:00
|
|
|
includes = [
|
|
|
|
"conformance",
|
|
|
|
"src",
|
|
|
|
],
|
2019-05-13 14:45:30 +00:00
|
|
|
deps = [":conformance_proto_cc"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "binary_json_conformance_suite",
|
|
|
|
srcs = ["conformance/binary_json_conformance_suite.cc"],
|
|
|
|
hdrs = ["conformance/binary_json_conformance_suite.h"],
|
2018-11-03 19:59:45 +00:00
|
|
|
deps = [
|
2019-05-13 14:45:30 +00:00
|
|
|
":conformance_test",
|
2018-11-03 19:59:45 +00:00
|
|
|
":jsoncpp",
|
|
|
|
":test_messages_proto2_proto_cc",
|
|
|
|
":test_messages_proto3_proto_cc",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-05-13 14:45:30 +00:00
|
|
|
cc_library(
|
|
|
|
name = "text_format_conformance_suite",
|
|
|
|
srcs = ["conformance/text_format_conformance_suite.cc"],
|
|
|
|
hdrs = ["conformance/text_format_conformance_suite.h"],
|
|
|
|
deps = [
|
|
|
|
":conformance_test",
|
|
|
|
":test_messages_proto2_proto_cc",
|
|
|
|
":test_messages_proto3_proto_cc",
|
2018-11-03 19:59:45 +00:00
|
|
|
],
|
2019-05-13 14:45:30 +00:00
|
|
|
)
|
|
|
|
|
2019-05-14 21:01:16 +00:00
|
|
|
cc_binary(
|
2019-05-13 14:45:30 +00:00
|
|
|
name = "conformance_test_runner",
|
|
|
|
srcs = ["conformance/conformance_test_main.cc"],
|
2019-07-01 19:21:04 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2018-11-03 19:59:45 +00:00
|
|
|
deps = [
|
2019-05-13 14:45:30 +00:00
|
|
|
":binary_json_conformance_suite",
|
2018-11-03 19:59:45 +00:00
|
|
|
":conformance_test",
|
2019-05-13 14:45:30 +00:00
|
|
|
":text_format_conformance_suite",
|
2018-11-03 21:43:20 +00:00
|
|
|
],
|
2018-11-03 19:59:45 +00:00
|
|
|
)
|
2019-07-20 10:49:03 +00:00
|
|
|
|
2021-09-09 19:21:44 +00:00
|
|
|
# TODO: re-enable this test if appropriate, or replace with something that
|
|
|
|
# uses the new setup.
|
|
|
|
# sh_test(
|
|
|
|
# name = "build_files_updated_unittest",
|
|
|
|
# srcs = [
|
|
|
|
# "build_files_updated_unittest.sh",
|
|
|
|
# ],
|
|
|
|
# data = [
|
|
|
|
# "BUILD",
|
|
|
|
# "cmake/extract_includes.bat.in",
|
|
|
|
# "cmake/libprotobuf.cmake",
|
|
|
|
# "cmake/libprotobuf-lite.cmake",
|
|
|
|
# "cmake/libprotoc.cmake",
|
|
|
|
# "cmake/tests.cmake",
|
|
|
|
# "src/Makefile.am",
|
|
|
|
# "update_file_lists.sh",
|
|
|
|
# ],
|
|
|
|
# )
|
2021-04-20 18:36:32 +00:00
|
|
|
|
|
|
|
java_proto_library(
|
|
|
|
name = "test_messages_proto2_java_proto",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [":test_messages_proto2_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_proto_library(
|
|
|
|
name = "test_messages_proto3_java_proto",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
2021-08-04 12:03:24 +00:00
|
|
|
],
|
2021-04-20 18:36:32 +00:00
|
|
|
deps = [":test_messages_proto3_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_proto_library(
|
|
|
|
name = "conformance_java_proto",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [":conformance_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_lite_proto_library(
|
|
|
|
name = "test_messages_proto2_java_proto_lite",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [":test_messages_proto2_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_lite_proto_library(
|
2021-08-04 12:03:24 +00:00
|
|
|
name = "conformance_java_proto_lite",
|
|
|
|
visibility = [
|
2021-04-20 18:36:32 +00:00
|
|
|
"//java:__subpackages__",
|
2021-08-04 12:03:24 +00:00
|
|
|
],
|
|
|
|
deps = [":conformance_proto"],
|
2021-04-20 18:36:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
java_lite_proto_library(
|
|
|
|
name = "test_messages_proto3_java_proto_lite",
|
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [":test_messages_proto3_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_binary(
|
|
|
|
name = "conformance_java",
|
|
|
|
srcs = ["conformance/ConformanceJava.java"],
|
2021-08-04 12:03:24 +00:00
|
|
|
main_class = "ConformanceJava",
|
2021-04-20 18:36:32 +00:00
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":conformance_java_proto",
|
|
|
|
":test_messages_proto2_java_proto",
|
|
|
|
":test_messages_proto3_java_proto",
|
|
|
|
"//:protobuf_java",
|
|
|
|
"//:protobuf_java_util",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
java_binary(
|
|
|
|
name = "conformance_java_lite",
|
|
|
|
srcs = ["conformance/ConformanceJavaLite.java"],
|
2021-08-04 12:03:24 +00:00
|
|
|
main_class = "ConformanceJavaLite",
|
2021-04-20 18:36:32 +00:00
|
|
|
visibility = [
|
|
|
|
"//java:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":conformance_java_proto_lite",
|
|
|
|
":test_messages_proto2_java_proto_lite",
|
|
|
|
":test_messages_proto3_java_proto_lite",
|
|
|
|
"//:protobuf_java_util",
|
2021-08-04 12:03:24 +00:00
|
|
|
"//:protobuf_javalite",
|
2021-04-20 18:36:32 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
exports_files([
|
|
|
|
"conformance/conformance_test_runner.sh",
|
|
|
|
"conformance/failure_list_java.txt",
|
|
|
|
"conformance/failure_list_java_lite.txt",
|
|
|
|
"conformance/text_format_failure_list_java.txt",
|
|
|
|
"conformance/text_format_failure_list_java_lite.txt",
|
|
|
|
])
|
2021-08-06 15:08:32 +00:00
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "bzl_srcs",
|
|
|
|
srcs = glob(["**/*.bzl"]),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|