|
@@ -18,6 +18,8 @@ COPTS = [
|
|
# Bazel should provide portable link_opts for pthread.
|
|
# Bazel should provide portable link_opts for pthread.
|
|
LINK_OPTS = ["-lpthread"]
|
|
LINK_OPTS = ["-lpthread"]
|
|
|
|
|
|
|
|
+load("protobuf", "cc_proto_library")
|
|
|
|
+
|
|
cc_library(
|
|
cc_library(
|
|
name = "protobuf_lite",
|
|
name = "protobuf_lite",
|
|
srcs = [
|
|
srcs = [
|
|
@@ -140,6 +142,14 @@ WELL_KNOWN_PROTOS = [
|
|
"google/protobuf/wrappers.proto",
|
|
"google/protobuf/wrappers.proto",
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+cc_proto_library(
|
|
|
|
+ name = "cc_wkt_protos",
|
|
|
|
+ srcs = ["src/" + s for s in WELL_KNOWN_PROTOS],
|
|
|
|
+ internal_bootstrap_hack = 1,
|
|
|
|
+ include = "src",
|
|
|
|
+ cc_libs = [":protobuf"],
|
|
|
|
+)
|
|
|
|
+
|
|
################################################################################
|
|
################################################################################
|
|
# Protocol Buffers Compiler
|
|
# Protocol Buffers Compiler
|
|
################################################################################
|
|
################################################################################
|
|
@@ -258,23 +268,22 @@ cc_binary(
|
|
################################################################################
|
|
################################################################################
|
|
genrule(
|
|
genrule(
|
|
name = "generate_java_descriptor_proto",
|
|
name = "generate_java_descriptor_proto",
|
|
- tools = [":protoc"],
|
|
|
|
- srcs = [ "src/google/protobuf/descriptor.proto", ],
|
|
|
|
- outs = [ "com/google/protobuf/DescriptorProtos.java" ],
|
|
|
|
|
|
+ srcs = ["src/google/protobuf/descriptor.proto"],
|
|
|
|
+ outs = ["com/google/protobuf/DescriptorProtos.java"],
|
|
cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<",
|
|
cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<",
|
|
|
|
+ tools = [":protoc"],
|
|
)
|
|
)
|
|
|
|
|
|
java_library(
|
|
java_library(
|
|
name = "java_proto",
|
|
name = "java_proto",
|
|
- visibility = ["//visibility:public"],
|
|
|
|
srcs = glob([
|
|
srcs = glob([
|
|
- "java/src/main/java/com/google/protobuf/*.java"
|
|
|
|
|
|
+ "java/src/main/java/com/google/protobuf/*.java",
|
|
]) + [
|
|
]) + [
|
|
- ":generate_java_descriptor_proto",
|
|
|
|
- ]
|
|
|
|
|
|
+ ":generate_java_descriptor_proto",
|
|
|
|
+ ],
|
|
|
|
+ visibility = ["//visibility:public"],
|
|
)
|
|
)
|
|
|
|
|
|
-
|
|
|
|
################################################################################
|
|
################################################################################
|
|
# Tests
|
|
# Tests
|
|
################################################################################
|
|
################################################################################
|
|
@@ -328,22 +337,11 @@ TEST_PROTOS = [
|
|
"google/protobuf/util/json_format_proto3.proto",
|
|
"google/protobuf/util/json_format_proto3.proto",
|
|
]
|
|
]
|
|
|
|
|
|
-PROTOS = LITE_TEST_PROTOS + TEST_PROTOS
|
|
|
|
-
|
|
|
|
-INPUTS = PROTOS + WELL_KNOWN_PROTOS
|
|
|
|
-
|
|
|
|
-OUTPUTS = ["src/" + x[:-5] + "pb.h" for x in PROTOS] + \
|
|
|
|
- ["src/" + x[:-5] + "pb.cc" for x in PROTOS]
|
|
|
|
-
|
|
|
|
-genrule(
|
|
|
|
- name = "gen_test_protos",
|
|
|
|
- srcs = ["src/" + x for x in INPUTS],
|
|
|
|
- outs = OUTPUTS,
|
|
|
|
- cmd =
|
|
|
|
- "$(location :protoc) --cpp_out=$(@D)/src" +
|
|
|
|
- "".join([" -I" + x + "=$(location src/" + x + ")" for x in INPUTS]) +
|
|
|
|
- "".join([" $(location src/" + x + ")" for x in PROTOS]),
|
|
|
|
- tools = [":protoc"],
|
|
|
|
|
|
+cc_proto_library(
|
|
|
|
+ name = "cc_test_protos",
|
|
|
|
+ srcs = ["src/" + s for s in (LITE_TEST_PROTOS + TEST_PROTOS)],
|
|
|
|
+ include = "src",
|
|
|
|
+ deps = [":cc_wkt_protos"],
|
|
)
|
|
)
|
|
|
|
|
|
COMMON_TEST_SRCS = [
|
|
COMMON_TEST_SRCS = [
|
|
@@ -372,7 +370,7 @@ cc_binary(
|
|
|
|
|
|
cc_test(
|
|
cc_test(
|
|
name = "protobuf_test",
|
|
name = "protobuf_test",
|
|
- srcs = OUTPUTS + COMMON_TEST_SRCS + [
|
|
|
|
|
|
+ srcs = COMMON_TEST_SRCS + [
|
|
# AUTOGEN(test_srcs)
|
|
# AUTOGEN(test_srcs)
|
|
"src/google/protobuf/any_test.cc",
|
|
"src/google/protobuf/any_test.cc",
|
|
"src/google/protobuf/arena_unittest.cc",
|
|
"src/google/protobuf/arena_unittest.cc",
|
|
@@ -449,6 +447,7 @@ cc_test(
|
|
deps = [
|
|
deps = [
|
|
":protobuf",
|
|
":protobuf",
|
|
":protoc_lib",
|
|
":protoc_lib",
|
|
|
|
+ ":cc_test_protos",
|
|
"//external:gtest_main",
|
|
"//external:gtest_main",
|
|
],
|
|
],
|
|
)
|
|
)
|