Debian Codegraph @

third_party/upb/upbc/BUILD

raw
1 # Copyright (c) 2009-2021, Google LLC
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 # * Neither the name of Google LLC nor the
12 # names of its contributors may be used to endorse or promote products
13 # derived from this software without specific prior written permission.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 # DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
19 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 load(
27 "//bazel:build_defs.bzl",
28 "UPB_DEFAULT_CPPOPTS",
29 )
30 load(
31 "//bazel:upb_proto_library.bzl",
32 "upb_proto_library",
33 "upb_proto_reflection_library",
34 )
35
36 licenses(["notice"])
37
38 proto_library(
39 name = "code_generator_request",
40 srcs = ["code_generator_request.proto"],
41 visibility = ["//:friends"],
42 deps = ["@com_google_protobuf//:compiler_plugin_proto"],
43 )
44
45 upb_proto_library(
46 name = "code_generator_request_upb_proto",
47 visibility = ["//:friends"],
48 deps = [":code_generator_request"],
49 )
50
51 upb_proto_reflection_library(
52 name = "code_generator_request_upb_proto_reflection",
53 visibility = ["//:friends"],
54 deps = [":code_generator_request"],
55 )
56
57 upb_proto_library(
58 name = "plugin_upb_proto",
59 visibility = ["//:friends"],
60 deps = ["@com_google_protobuf//:compiler_plugin_proto"],
61 )
62
63 upb_proto_reflection_library(
64 name = "plugin_upb_proto_reflection",
65 visibility = ["//:friends"],
66 deps = ["@com_google_protobuf//:compiler_plugin_proto"],
67 )
68
69 cc_library(
70 name = "common",
71 srcs = ["common.cc"],
72 hdrs = ["common.h"],
73 copts = UPB_DEFAULT_CPPOPTS,
74 deps = [
75 "@com_google_absl//absl/strings",
76 "@com_google_protobuf//:protobuf",
77 ],
78 )
79
80 cc_binary(
81 name = "protoc-gen-upb",
82 srcs = ["protoc-gen-upb.cc"],
83 copts = UPB_DEFAULT_CPPOPTS,
84 visibility = ["//visibility:public"],
85 deps = [
86 ":common",
87 "//:mini_table",
88 "//:port",
89 "//:upb",
90 "@com_google_absl//absl/base:core_headers",
91 "@com_google_absl//absl/container:flat_hash_map",
92 "@com_google_absl//absl/container:flat_hash_set",
93 "@com_google_absl//absl/strings",
94 "@com_google_protobuf//:protobuf",
95 "@com_google_protobuf//:protoc_lib",
96 ],
97 )
98
99 cc_binary(
100 name = "protoc-gen-upbdefs",
101 srcs = [
102 "protoc-gen-upbdefs.cc",
103 ],
104 copts = UPB_DEFAULT_CPPOPTS,
105 visibility = ["//visibility:public"],
106 deps = [
107 ":common",
108 "@com_google_absl//absl/base:core_headers",
109 "@com_google_absl//absl/container:flat_hash_map",
110 "@com_google_absl//absl/strings",
111 "@com_google_protobuf//:protobuf",
112 "@com_google_protobuf//:protoc_lib",
113 ],
114 )
115
116 cc_binary(
117 name = "protoc-gen-upbdev",
118 srcs = [
119 "code_generator_request.c",
120 "code_generator_request.h",
121 "protoc-gen-upbdev.cc",
122 "subprocess.cc",
123 "subprocess.h",
124 ],
125 copts = UPB_DEFAULT_CPPOPTS,
126 visibility = ["//visibility:public"],
127 deps = [
128 ":code_generator_request_upb_proto",
129 ":code_generator_request_upb_proto_reflection",
130 ":plugin_upb_proto",
131 ":plugin_upb_proto_reflection",
132 "//:json",
133 "//:mini_descriptor",
134 "//:mini_table",
135 "//:port",
136 "//:reflection",
137 "//:upb",
138 "@com_google_absl//absl/strings",
139 ],
140 )