|
|
|
@ -18,7 +18,8 @@ COPTS = [ |
|
|
|
|
# Bazel should provide portable link_opts for pthread. |
|
|
|
|
LINK_OPTS = ["-lpthread"] |
|
|
|
|
|
|
|
|
|
load("protobuf", "cc_proto_library") |
|
|
|
|
load("protobuf", "cc_proto_library", "py_proto_library", "copied_srcs", |
|
|
|
|
"internal_protobuf_py_tests") |
|
|
|
|
|
|
|
|
|
cc_library( |
|
|
|
|
name = "protobuf_lite", |
|
|
|
@ -126,7 +127,7 @@ objc_library( |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
WELL_KNOWN_PROTOS = [ |
|
|
|
|
RELATIVE_WELL_KNOWN_PROTOS = [ |
|
|
|
|
# AUTOGEN(well_known_protos) |
|
|
|
|
"google/protobuf/any.proto", |
|
|
|
|
"google/protobuf/api.proto", |
|
|
|
@ -142,12 +143,14 @@ WELL_KNOWN_PROTOS = [ |
|
|
|
|
"google/protobuf/wrappers.proto", |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] |
|
|
|
|
|
|
|
|
|
cc_proto_library( |
|
|
|
|
name = "cc_wkt_protos", |
|
|
|
|
srcs = ["src/" + s for s in WELL_KNOWN_PROTOS], |
|
|
|
|
internal_bootstrap_hack = 1, |
|
|
|
|
srcs = WELL_KNOWN_PROTOS, |
|
|
|
|
include = "src", |
|
|
|
|
cc_libs = [":protobuf"], |
|
|
|
|
internal_bootstrap_hack = 1, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
@ -263,32 +266,11 @@ cc_binary( |
|
|
|
|
deps = [":protoc_lib"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
|
# Java support |
|
|
|
|
################################################################################ |
|
|
|
|
genrule( |
|
|
|
|
name = "generate_java_descriptor_proto", |
|
|
|
|
srcs = ["src/google/protobuf/descriptor.proto"], |
|
|
|
|
outs = ["com/google/protobuf/DescriptorProtos.java"], |
|
|
|
|
cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<", |
|
|
|
|
tools = [":protoc"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
java_library( |
|
|
|
|
name = "java_proto", |
|
|
|
|
srcs = glob([ |
|
|
|
|
"java/src/main/java/com/google/protobuf/*.java", |
|
|
|
|
]) + [ |
|
|
|
|
":generate_java_descriptor_proto", |
|
|
|
|
], |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
|
# Tests |
|
|
|
|
################################################################################ |
|
|
|
|
|
|
|
|
|
LITE_TEST_PROTOS = [ |
|
|
|
|
RELATIVE_LITE_TEST_PROTOS = [ |
|
|
|
|
# AUTOGEN(lite_test_protos) |
|
|
|
|
"google/protobuf/map_lite_unittest.proto", |
|
|
|
|
"google/protobuf/unittest_import_lite.proto", |
|
|
|
@ -297,7 +279,9 @@ LITE_TEST_PROTOS = [ |
|
|
|
|
"google/protobuf/unittest_no_arena_lite.proto", |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
TEST_PROTOS = [ |
|
|
|
|
LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS] |
|
|
|
|
|
|
|
|
|
RELATIVE_TEST_PROTOS = [ |
|
|
|
|
# AUTOGEN(test_protos) |
|
|
|
|
"google/protobuf/any_test.proto", |
|
|
|
|
"google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto", |
|
|
|
@ -337,9 +321,11 @@ TEST_PROTOS = [ |
|
|
|
|
"google/protobuf/util/json_format_proto3.proto", |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS] |
|
|
|
|
|
|
|
|
|
cc_proto_library( |
|
|
|
|
name = "cc_test_protos", |
|
|
|
|
srcs = ["src/" + s for s in (LITE_TEST_PROTOS + TEST_PROTOS)], |
|
|
|
|
srcs = LITE_TEST_PROTOS + TEST_PROTOS, |
|
|
|
|
include = "src", |
|
|
|
|
deps = [":cc_wkt_protos"], |
|
|
|
|
) |
|
|
|
@ -445,9 +431,114 @@ cc_test( |
|
|
|
|
], |
|
|
|
|
linkopts = LINK_OPTS, |
|
|
|
|
deps = [ |
|
|
|
|
":cc_test_protos", |
|
|
|
|
":protobuf", |
|
|
|
|
":protoc_lib", |
|
|
|
|
":cc_test_protos", |
|
|
|
|
"//external:gtest_main", |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
|
# Java support |
|
|
|
|
################################################################################ |
|
|
|
|
genrule( |
|
|
|
|
name = "generate_java_descriptor_proto", |
|
|
|
|
srcs = ["src/google/protobuf/descriptor.proto"], |
|
|
|
|
outs = ["com/google/protobuf/DescriptorProtos.java"], |
|
|
|
|
cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<", |
|
|
|
|
tools = [":protoc"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
java_library( |
|
|
|
|
name = "java_proto", |
|
|
|
|
srcs = glob([ |
|
|
|
|
"java/src/main/java/com/google/protobuf/*.java", |
|
|
|
|
]) + [ |
|
|
|
|
":generate_java_descriptor_proto", |
|
|
|
|
], |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
|
# Python support |
|
|
|
|
################################################################################ |
|
|
|
|
|
|
|
|
|
copied_srcs( |
|
|
|
|
name = "python_srcs", |
|
|
|
|
srcs = glob( |
|
|
|
|
[ |
|
|
|
|
"python/google/protobuf/*.py", |
|
|
|
|
"python/google/protobuf/**/*.py", |
|
|
|
|
], |
|
|
|
|
exclude = [ |
|
|
|
|
"python/google/protobuf/internal/*_test.py", |
|
|
|
|
"python/google/protobuf/internal/test_util.py", |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
include = "python", |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
py_proto_library( |
|
|
|
|
name = "python_proto", |
|
|
|
|
srcs = WELL_KNOWN_PROTOS, |
|
|
|
|
include = "src", |
|
|
|
|
py_extra_srcs = [":python_srcs"], |
|
|
|
|
visibility = ["//visibility:public"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
copied_srcs( |
|
|
|
|
name = "python_test_srcs", |
|
|
|
|
srcs = glob( |
|
|
|
|
[ |
|
|
|
|
"python/google/protobuf/internal/*_test.py", |
|
|
|
|
"python/google/protobuf/internal/test_util.py", |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
include = "python", |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
py_proto_library( |
|
|
|
|
name = "python_common_test_protos", |
|
|
|
|
srcs = LITE_TEST_PROTOS + TEST_PROTOS, |
|
|
|
|
include = "src", |
|
|
|
|
deps = [":python_proto"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
py_proto_library( |
|
|
|
|
name = "python_specific_test_protos", |
|
|
|
|
srcs = glob(["python/google/protobuf/internal/*.proto"]), |
|
|
|
|
include = "python", |
|
|
|
|
deps = [":python_common_test_protos"], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
py_library( |
|
|
|
|
name = "python_tests", |
|
|
|
|
srcs = [":python_test_srcs"], |
|
|
|
|
deps = [ |
|
|
|
|
":python_common_test_protos", |
|
|
|
|
":python_proto", |
|
|
|
|
":python_specific_test_protos", |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
internal_protobuf_py_tests( |
|
|
|
|
name = "python_tests", |
|
|
|
|
modules = [ |
|
|
|
|
"descriptor_database_test", |
|
|
|
|
"descriptor_pool_test", |
|
|
|
|
"descriptor_test", |
|
|
|
|
"generator_test", |
|
|
|
|
"json_format_test", |
|
|
|
|
"message_factory_test", |
|
|
|
|
# "message_test", # failed due to testdata path |
|
|
|
|
"proto_builder_test", |
|
|
|
|
# "reflection_test", # failed due to testdata path |
|
|
|
|
"service_reflection_test", |
|
|
|
|
"symbol_database_test", |
|
|
|
|
"text_encoding_test", |
|
|
|
|
# "text_format_test", # failed due to testdata path |
|
|
|
|
"unknown_fields_test", |
|
|
|
|
"wire_format_test", |
|
|
|
|
], |
|
|
|
|
deps = [":python_tests"], |
|
|
|
|
) |
|
|
|
|