Source release 16.4.0
This commit is contained in:
491
third_party/protobuf/BUILD
vendored
491
third_party/protobuf/BUILD
vendored
@@ -1,20 +1,52 @@
|
||||
# Bazel (https://bazel.build/) BUILD file for Protobuf.
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
|
||||
load("@rules_proto//proto/private:native.bzl", "native_proto_common")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
exports_files(["LICENSE"])
|
||||
|
||||
################################################################################
|
||||
# Java 9 configuration
|
||||
# build configuration
|
||||
################################################################################
|
||||
|
||||
string_flag(
|
||||
name = "incompatible_use_com_google_googletest",
|
||||
# TODO(yannic): Flip to `true` for `3.13.0`.
|
||||
build_setting_default = "false",
|
||||
values = ["true", "false"]
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "jdk9",
|
||||
values = {
|
||||
"java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9",
|
||||
name = "use_com_google_googletest",
|
||||
flag_values = {
|
||||
"//:incompatible_use_com_google_googletest": "true"
|
||||
},
|
||||
)
|
||||
|
||||
GTEST = select({
|
||||
"//:use_com_google_googletest": [
|
||||
"@com_google_googletest//:gtest",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"//external:gtest",
|
||||
],
|
||||
})
|
||||
|
||||
GTEST_MAIN = select({
|
||||
"//:use_com_google_googletest": [
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"//external:gtest_main",
|
||||
],
|
||||
})
|
||||
|
||||
################################################################################
|
||||
# ZLIB configuration
|
||||
################################################################################
|
||||
@@ -27,25 +59,25 @@ ZLIB_DEPS = ["@zlib//:zlib"]
|
||||
|
||||
MSVC_COPTS = [
|
||||
"/DHAVE_PTHREAD",
|
||||
"/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'
|
||||
"/wd4514", # -Wno-unused-function
|
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
"/wd4996", # The compiler encountered a deprecated declaration.
|
||||
"/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'
|
||||
"/wd4514", # -Wno-unused-function
|
||||
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
"/wd4996", # The compiler encountered a deprecated declaration.
|
||||
]
|
||||
|
||||
COPTS = select({
|
||||
":msvc" : MSVC_COPTS,
|
||||
":msvc": MSVC_COPTS,
|
||||
"//conditions:default": [
|
||||
"-DHAVE_PTHREAD",
|
||||
"-DHAVE_ZLIB",
|
||||
@@ -54,18 +86,30 @@ COPTS = select({
|
||||
"-Wno-unused-function",
|
||||
# Prevents ISO C++ const string assignment warnings for pyext sources.
|
||||
"-Wno-write-strings",
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
})
|
||||
|
||||
load(":compiler_config_setting.bzl", "create_compiler_config_setting")
|
||||
|
||||
create_compiler_config_setting(name = "msvc", value = "msvc-cl")
|
||||
create_compiler_config_setting(
|
||||
name = "msvc",
|
||||
value = "msvc-cl",
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "android",
|
||||
values = {
|
||||
"crosstool_top": "//external:android/crosstool",
|
||||
},
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
@@ -73,6 +117,10 @@ config_setting(
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:toolchain-libcpp",
|
||||
},
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
@@ -80,6 +128,10 @@ config_setting(
|
||||
values = {
|
||||
"crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp",
|
||||
},
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
# Android and MSVC builds do not need to link in a separate pthread library.
|
||||
@@ -91,16 +143,20 @@ LINK_OPTS = select({
|
||||
# Suppress linker warnings about files with no symbols defined.
|
||||
"-ignore:4221",
|
||||
],
|
||||
"//conditions:default": ["-lpthread", "-lm"],
|
||||
"//conditions:default": [
|
||||
"-lpthread",
|
||||
"-lm",
|
||||
],
|
||||
})
|
||||
|
||||
load(
|
||||
":protobuf.bzl",
|
||||
"adapt_proto_library",
|
||||
"cc_proto_library",
|
||||
"py_proto_library",
|
||||
"internal_copied_filegroup",
|
||||
"internal_gen_well_known_protos_java",
|
||||
"internal_protobuf_py_tests",
|
||||
"py_proto_library",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@@ -110,13 +166,15 @@ cc_library(
|
||||
"src/google/protobuf/any_lite.cc",
|
||||
"src/google/protobuf/arena.cc",
|
||||
"src/google/protobuf/extension_set.cc",
|
||||
"src/google/protobuf/generated_enum_util.cc",
|
||||
"src/google/protobuf/generated_message_table_driven_lite.cc",
|
||||
"src/google/protobuf/generated_message_util.cc",
|
||||
"src/google/protobuf/implicit_weak_message.cc",
|
||||
"src/google/protobuf/io/coded_stream.cc",
|
||||
"src/google/protobuf/io/strtod.cc",
|
||||
"src/google/protobuf/io/io_win32.cc",
|
||||
"src/google/protobuf/io/strtod.cc",
|
||||
"src/google/protobuf/io/zero_copy_stream.cc",
|
||||
"src/google/protobuf/io/zero_copy_stream_impl.cc",
|
||||
"src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
|
||||
"src/google/protobuf/message_lite.cc",
|
||||
"src/google/protobuf/parse_context.cc",
|
||||
@@ -133,7 +191,10 @@ cc_library(
|
||||
"src/google/protobuf/stubs/time.cc",
|
||||
"src/google/protobuf/wire_format_lite.cc",
|
||||
],
|
||||
hdrs = glob(["src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc"]),
|
||||
hdrs = glob([
|
||||
"src/google/protobuf/**/*.h",
|
||||
"src/google/protobuf/**/*.inc",
|
||||
]),
|
||||
copts = COPTS,
|
||||
includes = ["src/"],
|
||||
linkopts = LINK_OPTS,
|
||||
@@ -167,14 +228,12 @@ cc_library(
|
||||
"src/google/protobuf/io/gzip_stream.cc",
|
||||
"src/google/protobuf/io/printer.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",
|
||||
"src/google/protobuf/stubs/mathlimits.cc",
|
||||
"src/google/protobuf/stubs/substitute.cc",
|
||||
"src/google/protobuf/text_format.cc",
|
||||
"src/google/protobuf/timestamp.pb.cc",
|
||||
@@ -204,7 +263,10 @@ cc_library(
|
||||
"src/google/protobuf/wire_format.cc",
|
||||
"src/google/protobuf/wrappers.pb.cc",
|
||||
],
|
||||
hdrs = glob(["src/**/*.h", "src/**/*.inc"]),
|
||||
hdrs = glob([
|
||||
"src/**/*.h",
|
||||
"src/**/*.inc",
|
||||
]),
|
||||
copts = COPTS,
|
||||
includes = ["src/"],
|
||||
linkopts = LINK_OPTS,
|
||||
@@ -218,7 +280,10 @@ cc_library(
|
||||
# TODO(keveman): Remove this target once the support gets added to Bazel.
|
||||
cc_library(
|
||||
name = "protobuf_headers",
|
||||
hdrs = glob(["src/**/*.h"]),
|
||||
hdrs = glob([
|
||||
"src/**/*.h",
|
||||
"src/**/*.inc",
|
||||
]),
|
||||
includes = ["src/"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -226,23 +291,36 @@ cc_library(
|
||||
# Map of all well known protos.
|
||||
# name => (include path, imports)
|
||||
WELL_KNOWN_PROTO_MAP = {
|
||||
"any" : ("google/protobuf/any.proto", []),
|
||||
"api" : ("google/protobuf/api.proto", ["source_context", "type"]),
|
||||
"compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]),
|
||||
"descriptor" : ("google/protobuf/descriptor.proto", []),
|
||||
"duration" : ("google/protobuf/duration.proto", []),
|
||||
"empty" : ("google/protobuf/empty.proto", []),
|
||||
"field_mask" : ("google/protobuf/field_mask.proto", []),
|
||||
"source_context" : ("google/protobuf/source_context.proto", []),
|
||||
"struct" : ("google/protobuf/struct.proto", []),
|
||||
"timestamp" : ("google/protobuf/timestamp.proto", []),
|
||||
"type" : ("google/protobuf/type.proto", ["any", "source_context"]),
|
||||
"wrappers" : ("google/protobuf/wrappers.proto", []),
|
||||
"any": ("src/google/protobuf/any.proto", []),
|
||||
"api": (
|
||||
"src/google/protobuf/api.proto",
|
||||
[
|
||||
"source_context",
|
||||
"type",
|
||||
],
|
||||
),
|
||||
"compiler_plugin": (
|
||||
"src/google/protobuf/compiler/plugin.proto",
|
||||
["descriptor"],
|
||||
),
|
||||
"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", []),
|
||||
"type": (
|
||||
"src/google/protobuf/type.proto",
|
||||
[
|
||||
"any",
|
||||
"source_context",
|
||||
],
|
||||
),
|
||||
"wrappers": ("src/google/protobuf/wrappers.proto", []),
|
||||
}
|
||||
|
||||
RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
|
||||
|
||||
WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
|
||||
WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()]
|
||||
|
||||
filegroup(
|
||||
name = "well_known_protos",
|
||||
@@ -250,13 +328,15 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
adapt_proto_library(
|
||||
name = "cc_wkt_protos_genproto",
|
||||
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cc_wkt_protos",
|
||||
srcs = WELL_KNOWN_PROTOS,
|
||||
include = "src",
|
||||
default_runtime = ":protobuf",
|
||||
internal_bootstrap_hack = 1,
|
||||
protoc = ":protoc",
|
||||
deprecation = "Only for backward compatibility. Do not use.",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -272,20 +352,24 @@ cc_proto_library(
|
||||
# )
|
||||
################################################################################
|
||||
|
||||
internal_copied_filegroup(
|
||||
name = "_internal_wkt_protos",
|
||||
srcs = WELL_KNOWN_PROTOS,
|
||||
dest = "",
|
||||
strip_prefix = "src",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
[proto_library(
|
||||
name = proto[0] + "_proto",
|
||||
srcs = [proto[1][0]],
|
||||
deps = [dep + "_proto" for dep in proto[1][1]],
|
||||
strip_import_prefix = "src",
|
||||
visibility = ["//visibility:public"],
|
||||
) for proto in WELL_KNOWN_PROTO_MAP.items()]
|
||||
deps = [dep + "_proto" for dep in proto[1][1]],
|
||||
) for proto in WELL_KNOWN_PROTO_MAP.items()]
|
||||
|
||||
[native_cc_proto_library(
|
||||
name = proto + "_cc_proto",
|
||||
deps = [proto + "_proto"],
|
||||
visibility = ["//visibility:private"],
|
||||
) for proto in WELL_KNOWN_PROTO_MAP.keys()]
|
||||
|
||||
cc_proto_blacklist_test(
|
||||
name = "cc_proto_blacklist_test",
|
||||
deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()]
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Protocol Buffers Compiler
|
||||
@@ -379,25 +463,7 @@ cc_library(
|
||||
],
|
||||
copts = COPTS,
|
||||
includes = ["src/"],
|
||||
linkopts = LINK_OPTS + select({
|
||||
":msvc": [
|
||||
# Linking to setargv.obj makes the default command line argument
|
||||
# parser expand wildcards, so the main method's argv will contain the
|
||||
# expanded list instead of the wildcards.
|
||||
#
|
||||
# Adding dummy "-DEFAULTLIB:kernel32.lib", because:
|
||||
# - Microsoft ships this object file next to default libraries
|
||||
# - but this file is not a library, just a precompiled object
|
||||
# - "-WHOLEARCHIVE" and "-DEFAULTLIB" only accept library,
|
||||
# not precompiled object.
|
||||
# - Bazel would assume linkopt that does not start with "-" or "$"
|
||||
# as a label to a target, so we add a harmless "-DEFAULTLIB:kernel32.lib"
|
||||
# before "setargv.obj".
|
||||
# See https://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
|
||||
"-DEFAULTLIB:kernel32.lib setargv.obj",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
linkopts = LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":protobuf"],
|
||||
)
|
||||
@@ -458,6 +524,7 @@ RELATIVE_TEST_PROTOS = [
|
||||
"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",
|
||||
"google/protobuf/util/internal/testdata/anys.proto",
|
||||
"google/protobuf/util/internal/testdata/books.proto",
|
||||
@@ -489,7 +556,7 @@ cc_proto_library(
|
||||
COMMON_TEST_SRCS = [
|
||||
# AUTOGEN(common_test_srcs)
|
||||
"src/google/protobuf/arena_test_util.cc",
|
||||
"src/google/protobuf/map_test_util.cc",
|
||||
"src/google/protobuf/map_test_util.inc",
|
||||
"src/google/protobuf/test_util.cc",
|
||||
"src/google/protobuf/test_util.inc",
|
||||
"src/google/protobuf/testing/file.cc",
|
||||
@@ -507,18 +574,19 @@ cc_binary(
|
||||
deps = [
|
||||
":protobuf",
|
||||
":protoc_lib",
|
||||
"//external:gtest",
|
||||
],
|
||||
] + GTEST,
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "win32_test",
|
||||
srcs = ["src/google/protobuf/io/io_win32_unittest.cc"],
|
||||
tags = [
|
||||
"manual",
|
||||
"windows",
|
||||
],
|
||||
deps = [
|
||||
":protobuf_lite",
|
||||
"//external:gtest_main",
|
||||
],
|
||||
tags = ["manual", "windows"],
|
||||
] + GTEST_MAIN,
|
||||
)
|
||||
|
||||
cc_test(
|
||||
@@ -598,11 +666,11 @@ cc_test(
|
||||
"src/google/protobuf/well_known_types_unittest.cc",
|
||||
"src/google/protobuf/wire_format_unittest.cc",
|
||||
] + select({
|
||||
"//conditions:default" : [
|
||||
# Doesn't pass on Windows with MSVC
|
||||
"//conditions:default": [
|
||||
# AUTOGEN(non_msvc_test_srcs)
|
||||
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
|
||||
],
|
||||
":msvc": []
|
||||
":msvc": [],
|
||||
}),
|
||||
copts = COPTS,
|
||||
data = [
|
||||
@@ -621,44 +689,49 @@ cc_test(
|
||||
":cc_test_protos",
|
||||
":protobuf",
|
||||
":protoc_lib",
|
||||
"//external:gtest_main",
|
||||
] + PROTOBUF_DEPS,
|
||||
] + PROTOBUF_DEPS + GTEST_MAIN,
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Java support
|
||||
################################################################################
|
||||
|
||||
internal_gen_well_known_protos_java(
|
||||
srcs = WELL_KNOWN_PROTOS,
|
||||
name = "gen_well_known_protos_java",
|
||||
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
|
||||
visibility = [
|
||||
"//java:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
alias(
|
||||
name = "protobuf_java",
|
||||
srcs = glob([
|
||||
"java/core/src/main/java/com/google/protobuf/*.java",
|
||||
]) + [
|
||||
":gen_well_known_protos_java",
|
||||
],
|
||||
javacopts = select({
|
||||
"//:jdk9": ["--add-modules=jdk.unsupported"],
|
||||
"//conditions:default": ["-source 7", "-target 7"],
|
||||
}),
|
||||
actual = "//java/core",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "protobuf_java_util",
|
||||
srcs = glob([
|
||||
"java/util/src/main/java/com/google/protobuf/util/*.java",
|
||||
]),
|
||||
javacopts = ["-source 7", "-target 7"],
|
||||
alias(
|
||||
name = "protobuf_javalite",
|
||||
actual = "//java/lite",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "protobuf_java_util",
|
||||
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",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"protobuf_java",
|
||||
"//external:error_prone_annotations",
|
||||
"//external:gson",
|
||||
"//external:guava",
|
||||
],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
@@ -669,12 +742,9 @@ py_library(
|
||||
name = "python_srcs",
|
||||
srcs = glob(
|
||||
[
|
||||
"python/google/__init__.py",
|
||||
"python/google/protobuf/*.py",
|
||||
"python/google/protobuf/**/*.py",
|
||||
"python/google/**/*.py",
|
||||
],
|
||||
exclude = [
|
||||
"python/google/protobuf/__init__.py",
|
||||
"python/google/protobuf/**/__init__.py",
|
||||
"python/google/protobuf/internal/*_test.py",
|
||||
"python/google/protobuf/internal/test_util.py",
|
||||
@@ -730,6 +800,10 @@ config_setting(
|
||||
values = {
|
||||
"define": "use_fast_cpp_protos=true",
|
||||
},
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
@@ -737,6 +811,10 @@ config_setting(
|
||||
values = {
|
||||
"define": "allow_oversize_protos=true",
|
||||
},
|
||||
visibility = [
|
||||
# Public, but Protobuf only visibility.
|
||||
"//:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
# Copy the builtin proto files from src/google/protobuf to
|
||||
@@ -753,7 +831,7 @@ internal_copied_filegroup(
|
||||
|
||||
# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
|
||||
# which case we can simply add :protos_python in srcs.
|
||||
COPIED_WELL_KNOWN_PROTOS = ["python/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
|
||||
COPIED_WELL_KNOWN_PROTOS = ["python/" + s[4:] for s in WELL_KNOWN_PROTOS]
|
||||
|
||||
py_proto_library(
|
||||
name = "protobuf_python",
|
||||
@@ -768,11 +846,11 @@ py_proto_library(
|
||||
}),
|
||||
default_runtime = "",
|
||||
protoc = ":protoc",
|
||||
py_extra_srcs = glob(["python/**/__init__.py"]),
|
||||
py_libs = [
|
||||
":python_srcs",
|
||||
"//external:six",
|
||||
"@six//:six",
|
||||
],
|
||||
py_extra_srcs = glob(["python/**/__init__.py"]),
|
||||
srcs_version = "PY2AND3",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -864,25 +942,22 @@ internal_protobuf_py_tests(
|
||||
cc_library(
|
||||
name = "proto_api",
|
||||
hdrs = ["python/google/protobuf/proto_api.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//external:python_headers",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Note: We use `native_proto_common` here because we depend on an implementation-detail of
|
||||
# `proto_lang_toolchain`, which may not be available on `proto_common`.
|
||||
reject_blacklisted_files = hasattr(native_proto_common, "proto_lang_toolchain_rejects_files_do_not_use_or_we_will_break_you_without_mercy")
|
||||
cc_toolchain_blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()] if reject_blacklisted_files else [":well_known_protos"]
|
||||
proto_lang_toolchain(
|
||||
name = "cc_toolchain",
|
||||
blacklisted_protos = cc_toolchain_blacklisted_protos,
|
||||
command_line = "--cpp_out=$(OUT)",
|
||||
runtime = ":protobuf",
|
||||
visibility = ["//visibility:public"],
|
||||
blacklisted_protos = [":_internal_wkt_protos_genrule"],
|
||||
)
|
||||
|
||||
proto_lang_toolchain(
|
||||
name = "java_toolchain",
|
||||
command_line = "--java_out=$(OUT)",
|
||||
runtime = ":protobuf_java",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
@@ -894,6 +969,16 @@ alias(
|
||||
objc_library(
|
||||
name = "protobuf_objc",
|
||||
hdrs = [
|
||||
"objectivec/GPBAny.pbobjc.h",
|
||||
"objectivec/GPBApi.pbobjc.h",
|
||||
"objectivec/GPBDuration.pbobjc.h",
|
||||
"objectivec/GPBEmpty.pbobjc.h",
|
||||
"objectivec/GPBFieldMask.pbobjc.h",
|
||||
"objectivec/GPBSourceContext.pbobjc.h",
|
||||
"objectivec/GPBStruct.pbobjc.h",
|
||||
"objectivec/GPBTimestamp.pbobjc.h",
|
||||
"objectivec/GPBType.pbobjc.h",
|
||||
"objectivec/GPBWrappers.pbobjc.h",
|
||||
"objectivec/GPBArray.h",
|
||||
"objectivec/GPBBootstrap.h",
|
||||
"objectivec/GPBCodedInputStream.h",
|
||||
@@ -942,6 +1027,16 @@ objc_library(
|
||||
"objectivec",
|
||||
],
|
||||
non_arc_srcs = [
|
||||
"objectivec/GPBAny.pbobjc.m",
|
||||
"objectivec/GPBApi.pbobjc.m",
|
||||
"objectivec/GPBDuration.pbobjc.m",
|
||||
"objectivec/GPBEmpty.pbobjc.m",
|
||||
"objectivec/GPBFieldMask.pbobjc.m",
|
||||
"objectivec/GPBSourceContext.pbobjc.m",
|
||||
"objectivec/GPBStruct.pbobjc.m",
|
||||
"objectivec/GPBTimestamp.pbobjc.m",
|
||||
"objectivec/GPBType.pbobjc.m",
|
||||
"objectivec/GPBWrappers.pbobjc.m",
|
||||
"objectivec/GPBArray.m",
|
||||
"objectivec/GPBCodedInputStream.m",
|
||||
"objectivec/GPBCodedOutputStream.m",
|
||||
@@ -956,16 +1051,6 @@ objc_library(
|
||||
"objectivec/GPBUtilities.m",
|
||||
"objectivec/GPBWellKnownTypes.m",
|
||||
"objectivec/GPBWireFormat.m",
|
||||
"objectivec/google/protobuf/Any.pbobjc.m",
|
||||
"objectivec/google/protobuf/Api.pbobjc.m",
|
||||
"objectivec/google/protobuf/Duration.pbobjc.m",
|
||||
"objectivec/google/protobuf/Empty.pbobjc.m",
|
||||
"objectivec/google/protobuf/FieldMask.pbobjc.m",
|
||||
"objectivec/google/protobuf/SourceContext.pbobjc.m",
|
||||
"objectivec/google/protobuf/Struct.pbobjc.m",
|
||||
"objectivec/google/protobuf/Timestamp.pbobjc.m",
|
||||
"objectivec/google/protobuf/Type.pbobjc.m",
|
||||
"objectivec/google/protobuf/Wrappers.pbobjc.m",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -978,23 +1063,145 @@ genrule(
|
||||
name = "generated_protos",
|
||||
srcs = ["src/google/protobuf/unittest_import.proto"],
|
||||
outs = ["unittest_gen.proto"],
|
||||
cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)"
|
||||
cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "generated_protos_proto",
|
||||
srcs = [
|
||||
"unittest_gen.proto",
|
||||
"src/google/protobuf/unittest_import_public.proto",
|
||||
"unittest_gen.proto",
|
||||
],
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
name = "generated_protos_py",
|
||||
srcs = [
|
||||
"unittest_gen.proto",
|
||||
"src/google/protobuf/unittest_import_public.proto",
|
||||
"unittest_gen.proto",
|
||||
],
|
||||
default_runtime = "",
|
||||
protoc = ":protoc",
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Conformance tests
|
||||
################################################################################
|
||||
|
||||
proto_library(
|
||||
name = "test_messages_proto2_proto",
|
||||
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "test_messages_proto3_proto",
|
||||
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":any_proto",
|
||||
":duration_proto",
|
||||
":field_mask_proto",
|
||||
":struct_proto",
|
||||
":timestamp_proto",
|
||||
":wrappers_proto",
|
||||
],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto2_proto_cc",
|
||||
srcs = ["src/google/protobuf/test_messages_proto2.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "test_messages_proto3_proto_cc",
|
||||
srcs = ["src/google/protobuf/test_messages_proto3.proto"],
|
||||
deps = [
|
||||
":cc_wkt_protos",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "conformance_proto",
|
||||
srcs = ["conformance/conformance.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "conformance_proto_cc",
|
||||
srcs = ["conformance/conformance.proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "jsoncpp",
|
||||
srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"],
|
||||
hdrs = ["conformance/third_party/jsoncpp/json.h"],
|
||||
includes = ["conformance"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "conformance_test",
|
||||
srcs = [
|
||||
"conformance/conformance_test.cc",
|
||||
"conformance/conformance_test_runner.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"conformance/conformance_test.h",
|
||||
],
|
||||
includes = [
|
||||
"conformance",
|
||||
"src",
|
||||
],
|
||||
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"],
|
||||
deps = [
|
||||
":conformance_test",
|
||||
":jsoncpp",
|
||||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
],
|
||||
)
|
||||
|
||||
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",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "conformance_test_runner",
|
||||
srcs = ["conformance/conformance_test_main.cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":binary_json_conformance_suite",
|
||||
":conformance_test",
|
||||
":text_format_conformance_suite",
|
||||
],
|
||||
)
|
||||
|
||||
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",
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user