github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/systemlibs/protobuf.BUILD (about) 1 load( 2 "@com_google_protobuf//:protobuf.bzl", 3 "proto_gen", 4 "py_proto_library", 5 "cc_proto_library", 6 ) 7 8 licenses(["notice"]) 9 10 filegroup( 11 name = "LICENSE", 12 visibility = ["//visibility:public"], 13 ) 14 15 HEADERS = [ 16 "google/protobuf/any.pb.h", 17 "google/protobuf/any.proto", 18 "google/protobuf/arena.h", 19 "google/protobuf/compiler/importer.h", 20 "google/protobuf/descriptor.h", 21 "google/protobuf/descriptor.pb.h", 22 "google/protobuf/descriptor.proto", 23 "google/protobuf/duration.pb.h", 24 "google/protobuf/duration.proto", 25 "google/protobuf/dynamic_message.h", 26 "google/protobuf/empty.pb.h", 27 "google/protobuf/empty.proto", 28 "google/protobuf/field_mask.pb.h", 29 "google/protobuf/field_mask.proto", 30 "google/protobuf/io/coded_stream.h", 31 "google/protobuf/io/zero_copy_stream.h", 32 "google/protobuf/io/zero_copy_stream_impl_lite.h", 33 "google/protobuf/map.h", 34 "google/protobuf/port_def.inc", 35 "google/protobuf/repeated_field.h", 36 "google/protobuf/text_format.h", 37 "google/protobuf/timestamp.pb.h", 38 "google/protobuf/timestamp.proto", 39 "google/protobuf/util/json_util.h", 40 "google/protobuf/util/type_resolver_util.h", 41 "google/protobuf/wrappers.pb.h", 42 "google/protobuf/wrappers.proto", 43 ] 44 45 genrule( 46 name = "link_headers", 47 outs = HEADERS, 48 cmd = """ 49 for i in $(OUTS); do 50 f=$${i#$(@D)/} 51 mkdir -p $(@D)/$${f%/*} 52 ln -sf $(INCLUDEDIR)/$$f $(@D)/$$f 53 done 54 """, 55 ) 56 57 cc_library( 58 name = "protobuf", 59 hdrs = HEADERS, 60 linkopts = ["-lprotobuf"], 61 visibility = ["//visibility:public"], 62 ) 63 64 cc_library( 65 name = "protobuf_headers", 66 hdrs = HEADERS, 67 linkopts = ["-lprotobuf"], 68 visibility = ["//visibility:public"], 69 ) 70 71 cc_library( 72 name = "protoc_lib", 73 linkopts = ["-lprotoc"], 74 visibility = ["//visibility:public"], 75 ) 76 77 genrule( 78 name = "protoc", 79 outs = ["protoc.bin"], 80 cmd = "ln -s $$(which protoc) $@", 81 executable = 1, 82 visibility = ["//visibility:public"], 83 ) 84 85 cc_proto_library( 86 name = "cc_wkt_protos", 87 hdrs = HEADERS, 88 internal_bootstrap_hack = 1, 89 protoc = ":protoc", 90 visibility = ["//visibility:public"], 91 ) 92 93 proto_gen( 94 name = "protobuf_python_genproto", 95 includes = ["."], 96 protoc = "@com_google_protobuf//:protoc", 97 visibility = ["//visibility:public"], 98 ) 99 100 py_library( 101 name = "protobuf_python", 102 data = [":link_headers"], 103 srcs_version = "PY2AND3", 104 visibility = ["//visibility:public"], 105 )