Use upstream WELL_KNOWN_PROTO_MAP to include dependencies
This commit is contained in:
parent
d2dcde5017
commit
9d14ce1814
109
third_party/systemlibs/protobuf.BUILD
vendored
109
third_party/systemlibs/protobuf.BUILD
vendored
@ -12,24 +12,28 @@ filegroup(
|
|||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
PROTO_FILES = [
|
# Map of all well known protos.
|
||||||
"google/protobuf/any.proto",
|
# name => (include path, imports)
|
||||||
"google/protobuf/api.proto",
|
WELL_KNOWN_PROTO_MAP = {
|
||||||
"google/protobuf/compiler/plugin.proto",
|
"any" : ("google/protobuf/any.proto", []),
|
||||||
"google/protobuf/descriptor.proto",
|
"api" : ("google/protobuf/api.proto", ["source_context", "type"]),
|
||||||
"google/protobuf/duration.proto",
|
"compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]),
|
||||||
"google/protobuf/empty.proto",
|
"descriptor" : ("google/protobuf/descriptor.proto", []),
|
||||||
"google/protobuf/field_mask.proto",
|
"duration" : ("google/protobuf/duration.proto", []),
|
||||||
"google/protobuf/source_context.proto",
|
"empty" : ("google/protobuf/empty.proto", []),
|
||||||
"google/protobuf/struct.proto",
|
"field_mask" : ("google/protobuf/field_mask.proto", []),
|
||||||
"google/protobuf/timestamp.proto",
|
"source_context" : ("google/protobuf/source_context.proto", []),
|
||||||
"google/protobuf/type.proto",
|
"struct" : ("google/protobuf/struct.proto", []),
|
||||||
"google/protobuf/wrappers.proto",
|
"timestamp" : ("google/protobuf/timestamp.proto", []),
|
||||||
]
|
"type" : ("google/protobuf/type.proto", ["any", "source_context"]),
|
||||||
|
"wrappers" : ("google/protobuf/wrappers.proto", []),
|
||||||
|
}
|
||||||
|
|
||||||
|
RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
|
||||||
|
|
||||||
genrule(
|
genrule(
|
||||||
name = "link_proto_files",
|
name = "link_proto_files",
|
||||||
outs = PROTO_FILES,
|
outs = RELATIVE_WELL_KNOWN_PROTOS,
|
||||||
cmd = """
|
cmd = """
|
||||||
for i in $(OUTS); do
|
for i in $(OUTS); do
|
||||||
f=$${i#$(@D)/}
|
f=$${i#$(@D)/}
|
||||||
@ -85,74 +89,9 @@ py_library(
|
|||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
proto_library(
|
[proto_library(
|
||||||
name = "any_proto",
|
name = proto[0] + "_proto",
|
||||||
srcs = ["google/protobuf/any.proto"],
|
srcs = [proto[1][0]],
|
||||||
|
deps = [dep + "_proto" for dep in proto[1][1]],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
) for proto in WELL_KNOWN_PROTO_MAP.items()]
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "api_proto",
|
|
||||||
srcs = ["google/protobuf/api.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "compiler_plugin_proto",
|
|
||||||
srcs = ["google/protobuf/compiler/plugin.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "descriptor_proto",
|
|
||||||
srcs = ["google/protobuf/descriptor.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "duration_proto",
|
|
||||||
srcs = ["google/protobuf/duration.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "empty_proto",
|
|
||||||
srcs = ["google/protobuf/empty.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "field_mask_proto",
|
|
||||||
srcs = ["google/protobuf/field_mask.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "source_context_proto",
|
|
||||||
srcs = ["google/protobuf/source_context.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "struct_proto",
|
|
||||||
srcs = ["google/protobuf/struct.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "timestamp_proto",
|
|
||||||
srcs = ["google/protobuf/timestamp.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "type_proto",
|
|
||||||
srcs = ["google/protobuf/type.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
proto_library(
|
|
||||||
name = "wrappers_proto",
|
|
||||||
srcs = ["google/protobuf/wrappers.proto"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user