blob: 5f113ed4bfb6e2a321b7a217c28688ecad79beb3 [file] [log] [blame]
Joshua Haberman823eb092021-04-05 12:26:41 -07001# Copyright (c) 2009-2021, Google LLC
Joshua Habermane59d2c82021-04-05 10:47:53 -07002# 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
Josh Haberman2655ed92018-11-03 13:04:10 -070026load(
Joshua Haberman5611ff22019-05-16 11:35:00 -070027 "//bazel:build_defs.bzl",
Joshua Habermane3f41de2020-10-17 13:15:58 -070028 "UPB_DEFAULT_COPTS",
Joshua Haberman11b6df02022-02-15 19:55:44 -080029 "UPB_DEFAULT_CPPOPTS",
30 "make_shell_script",
Joshua Haberman06b90f92019-05-14 15:58:58 -070031)
Joshua Haberman06b90f92019-05-14 15:58:58 -070032load(
Joshua Haberman5611ff22019-05-16 11:35:00 -070033 "//bazel:upb_proto_library.bzl",
Joshua Habermana345af92020-10-18 13:39:13 -070034 "upb_fasttable_enabled",
Josh Habermana7ebe542018-11-03 18:18:47 -070035 "upb_proto_library",
Joshua Habermana274ad72020-10-28 13:06:30 -070036 "upb_proto_library_copts",
Joshua Habermane8f9eac2020-10-28 22:50:03 -070037 "upb_proto_reflection_library",
Josh Haberman2655ed92018-11-03 13:04:10 -070038)
Joshua Haberman0dc23942020-06-05 09:17:33 -070039
Protobuf Team Botbe98a912022-10-11 12:14:01 -070040# begin:google_only
41# load(
42# "//third_party/bazel_rules/rules_kotlin/kotlin/native:native_interop_hint.bzl",
43# "kt_native_interop_hint",
44# )
45# end:google_only
46
Protobuf Teamb8edc712022-03-16 08:24:52 -070047# begin:github_only
48load(
49 "//bazel:build_defs.bzl",
50 "upb_amalgamation",
51)
52# end:github_only
53
Joshua Haberman83c0edb2021-02-28 16:56:49 -080054licenses(["notice"])
Joshua Haberman7f9f7222019-01-23 17:10:22 -080055
Joshua Habermana5243ff2022-03-30 14:20:07 -070056exports_files(["LICENSE"])
57
58exports_files(
59 [
60 "BUILD",
61 "WORKSPACE",
62 ],
63 visibility = ["//cmake:__pkg__"],
64)
Joshua Haberman7f9f7222019-01-23 17:10:22 -080065
Joshua Haberman00f96cb2019-03-27 12:13:59 -070066config_setting(
Nicolas "Pixel" Noblece3ba4d2019-07-18 01:12:00 +020067 name = "windows",
Protobuf Teame5f26012022-06-01 14:40:00 -070068 constraint_values = ["@platforms//os:windows"],
Eli Schleifer231daa32021-12-20 16:01:23 -080069 visibility = ["//visibility:public"],
Nicolas "Pixel" Noblece3ba4d2019-07-18 01:12:00 +020070)
71
Joshua Habermana345af92020-10-18 13:39:13 -070072upb_fasttable_enabled(
73 name = "fasttable_enabled",
Joshua Habermanb9286962020-10-26 21:23:16 -070074 build_setting_default = False,
Joshua Habermana345af92020-10-18 13:39:13 -070075 visibility = ["//visibility:public"],
76)
77
Joshua Habermane8f9eac2020-10-28 22:50:03 -070078config_setting(
79 name = "fasttable_enabled_setting",
80 flag_values = {"//:fasttable_enabled": "true"},
Protobuf Team Bot0f4fffe2022-11-04 14:25:29 -070081 visibility = ["//visibility:public"],
Joshua Habermane8f9eac2020-10-28 22:50:03 -070082)
83
Joshua Habermana274ad72020-10-28 13:06:30 -070084upb_proto_library_copts(
85 name = "upb_proto_library_copts__for_generated_code_only_do_not_use",
86 copts = UPB_DEFAULT_COPTS,
87 visibility = ["//visibility:public"],
88)
89
Protobuf Team Bota4779ef2022-11-04 18:33:20 -070090# Please update copy.bara.sky target = ":friends" if
91# you make changes to this list.
Joshua Haberman6df55172022-05-24 11:41:56 -070092package_group(
93 name = "friends",
94 packages = [],
95)
96
Joshua Haberman928ef7f2019-03-27 12:52:33 -070097# Public C/C++ libraries #######################################################
Josh Haberman01ed4ce2018-11-02 12:49:15 -070098
99cc_library(
Anna Rde1bc112020-01-07 15:45:19 -0800100 name = "port",
Joshua Habermana60e9a32022-05-13 17:32:17 -0700101 hdrs = [
Eric Salof6307872022-11-05 16:16:27 -0700102 "upb/port/vsnprintf_compat.h",
Joshua Habermana60e9a32022-05-13 17:32:17 -0700103 ],
Joshua Haberman558315a2020-10-28 17:13:13 -0700104 copts = UPB_DEFAULT_COPTS,
Anna Rde1bc112020-01-07 15:45:19 -0800105 textual_hdrs = [
Eric Salof6307872022-11-05 16:16:27 -0700106 "upb/port/def.inc",
107 "upb/port/undef.inc",
Anna Rde1bc112020-01-07 15:45:19 -0800108 ],
Matt Kulukundisc49e6df2022-02-21 20:12:58 -0500109 visibility = ["//:__subpackages__"],
Anna Rde1bc112020-01-07 15:45:19 -0800110)
111
112cc_library(
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700113 name = "upb",
114 srcs = [
Eric Salofd143162022-11-03 17:17:17 -0700115 "upb/collections/map_sorter_internal.h",
116 "upb/collections/message_value.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700117 "upb/internal/table.h",
Eric Salo410143b2022-07-08 16:27:56 -0700118 "upb/internal/unicode.h",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700119 "upb/msg.c",
Joshua Haberman38813932021-04-05 16:00:25 -0700120 "upb/msg_internal.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700121 "upb/status.c",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700122 "upb/upb.c",
Eric Saloe1371752022-11-03 16:46:34 +0000123 "upb/wire/decode.c",
124 "upb/wire/encode.c",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700125 ],
126 hdrs = [
Protobuf Team Bot7b05f252022-06-22 09:18:12 -0700127 "upb/alloc.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700128 "upb/arena.h",
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700129 "upb/array.h",
Eric Salofd143162022-11-03 17:17:17 -0700130 "upb/collections/array.h",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700131 "upb/decode.h",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700132 "upb/encode.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700133 "upb/extension_registry.h",
Eric Salof409c992022-11-03 15:48:59 +0000134 "upb/mem/alloc.h",
135 "upb/mem/arena.h",
Joshua Haberman1674f282021-04-04 18:43:24 -0700136 "upb/msg.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700137 "upb/status.h",
Protobuf Team Bote153b522022-06-23 14:12:45 -0700138 "upb/string_view.h",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700139 "upb/upb.h",
Joshua Haberman2559e782020-04-09 14:36:24 -0700140 "upb/upb.hpp",
Eric Saloe1371752022-11-03 16:46:34 +0000141 "upb/wire/decode.h",
142 "upb/wire/encode.h",
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700143 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -0700144 copts = UPB_DEFAULT_COPTS,
Joshua Habermanba29af32019-06-01 19:27:49 -0700145 visibility = ["//visibility:public"],
Joshua Habermanefd576b2020-10-26 21:37:17 -0700146 deps = [
Eric Salofd143162022-11-03 17:17:17 -0700147 ":collections_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700148 ":extension_registry",
Joshua Habermanefd576b2020-10-26 21:37:17 -0700149 ":fastdecode",
Eric Salof409c992022-11-03 15:48:59 +0000150 ":mem",
Joshua Habermanefd576b2020-10-26 21:37:17 -0700151 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700152 ":table_internal",
Eric Salo410143b2022-07-08 16:27:56 -0700153 ":unicode_internal",
Eric Saloe1371752022-11-03 16:46:34 +0000154 ":wire_internal",
Joshua Habermanefd576b2020-10-26 21:37:17 -0700155 ],
Joshua Habermancb234e62020-10-17 17:48:32 -0700156)
157
158cc_library(
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700159 name = "extension_registry",
160 srcs = [
161 "upb/extension_registry.c",
162 "upb/msg.h",
163 "upb/msg_internal.h",
Protobuf Team Bote153b522022-06-23 14:12:45 -0700164 "upb/string_view.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700165 "upb/upb.h",
166 ],
167 hdrs = [
168 "upb/extension_registry.h",
169 ],
170 copts = UPB_DEFAULT_COPTS,
171 visibility = ["//visibility:public"],
172 deps = [
Eric Salofd040a82022-11-04 22:08:16 -0700173 ":collections_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700174 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700175 ":table_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700176 ],
177)
178
179cc_library(
Joshua Haberman970c6452022-03-08 17:44:06 -0800180 name = "mini_table_internal",
Eric Saloc033eff2022-10-27 14:36:38 -0700181 srcs = [
182 "upb/mini_table/common.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700183 "upb/msg_internal.h",
184 ],
Eric Saloc033eff2022-10-27 14:36:38 -0700185 hdrs = [
186 "upb/mini_table/common_internal.h",
Eric Salod9b6f132022-11-03 11:35:20 -0700187 "upb/mini_table/encode_internal.h",
188 "upb/mini_table/encode_internal.hpp",
Eric Saloc033eff2022-10-27 14:36:38 -0700189 ],
Eric Salo00765002022-09-14 20:27:24 -0700190 visibility = ["//:__subpackages__"],
Joshua Haberman970c6452022-03-08 17:44:06 -0800191 deps = [
Eric Salofd040a82022-11-04 22:08:16 -0700192 ":collections_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700193 ":extension_registry",
Joshua Haberman970c6452022-03-08 17:44:06 -0800194 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700195 ":table_internal",
Joshua Haberman970c6452022-03-08 17:44:06 -0800196 ":upb",
197 ],
198)
199
200cc_library(
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800201 name = "mini_table",
Protobuf Teame5468b42022-04-19 14:09:14 -0700202 srcs = [
Eric Saloc033eff2022-10-27 14:36:38 -0700203 "upb/mini_table/common.c",
204 "upb/mini_table/common.h",
205 "upb/mini_table/common_internal.h",
206 "upb/mini_table/decode.c",
207 "upb/mini_table/encode.c",
Eric Salod9b6f132022-11-03 11:35:20 -0700208 "upb/mini_table/encode_internal.h",
Eric Saloc033eff2022-10-27 14:36:38 -0700209 "upb/msg_internal.h",
Protobuf Teame5468b42022-04-19 14:09:14 -0700210 ],
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800211 hdrs = [
212 "upb/mini_table.h",
Eric Saloc033eff2022-10-27 14:36:38 -0700213 "upb/mini_table/decode.h",
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800214 ],
215 copts = UPB_DEFAULT_COPTS,
216 visibility = ["//visibility:public"],
Joshua Haberman970c6452022-03-08 17:44:06 -0800217 deps = [
Eric Salofd040a82022-11-04 22:08:16 -0700218 ":collections_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700219 ":extension_registry",
Joshua Haberman970c6452022-03-08 17:44:06 -0800220 ":mini_table_internal",
221 ":port",
Eric Saloc033eff2022-10-27 14:36:38 -0700222 ":table_internal",
Joshua Haberman970c6452022-03-08 17:44:06 -0800223 ":upb",
224 ],
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800225)
226
Protobuf Teame5468b42022-04-19 14:09:14 -0700227cc_library(
228 name = "mini_table_accessors",
229 srcs = [
Eric Saloc033eff2022-10-27 14:36:38 -0700230 "upb/mini_table/accessors.c",
231 "upb/mini_table/common.h",
232 "upb/msg_internal.h",
Protobuf Teame5468b42022-04-19 14:09:14 -0700233 ],
234 hdrs = [
Eric Saloc033eff2022-10-27 14:36:38 -0700235 "upb/mini_table/accessors.h",
Protobuf Teame5468b42022-04-19 14:09:14 -0700236 ],
237 copts = UPB_DEFAULT_COPTS,
Joshua Haberman6df55172022-05-24 11:41:56 -0700238 visibility = ["//visibility:public"],
Protobuf Teame5468b42022-04-19 14:09:14 -0700239 deps = [
Protobuf Teamc7620a42022-04-29 13:21:20 -0700240 ":collections",
Eric Salofd143162022-11-03 17:17:17 -0700241 ":collections_internal",
Protobuf Teame5468b42022-04-19 14:09:14 -0700242 ":mini_table",
243 ":mini_table_internal",
244 ":port",
Eric Saloc033eff2022-10-27 14:36:38 -0700245 ":table_internal",
Protobuf Teame5468b42022-04-19 14:09:14 -0700246 ":upb",
247 ],
248)
249
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800250cc_test(
Eric Saloc033eff2022-10-27 14:36:38 -0700251 name = "mini_table_encode_test",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700252 srcs = [
253 "upb/internal/table.h",
Eric Saloc033eff2022-10-27 14:36:38 -0700254 "upb/mini_table/encode_test.cc",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700255 ],
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800256 deps = [
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700257 ":extension_registry",
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800258 ":mini_table",
Joshua Haberman970c6452022-03-08 17:44:06 -0800259 ":mini_table_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700260 ":port",
Joshua Haberman970c6452022-03-08 17:44:06 -0800261 ":upb",
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800262 "@com_google_absl//absl/container:flat_hash_set",
Joshua Haberman970c6452022-03-08 17:44:06 -0800263 "@com_google_googletest//:gtest_main",
Joshua Haberman8d148f02022-03-13 18:45:50 -0700264 "@com_google_protobuf//:protobuf",
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800265 ],
266)
267
Protobuf Teame5468b42022-04-19 14:09:14 -0700268cc_test(
269 name = "mini_table_accessors_test",
Eric Saloc033eff2022-10-27 14:36:38 -0700270 srcs = ["upb/mini_table/accessors_test.cc"],
Protobuf Teame5468b42022-04-19 14:09:14 -0700271 deps = [
Protobuf Teamc7620a42022-04-29 13:21:20 -0700272 ":collections",
Protobuf Teame5468b42022-04-19 14:09:14 -0700273 ":mini_table",
274 ":mini_table_accessors",
275 ":mini_table_internal",
276 ":test_messages_proto2_proto_upb",
277 ":test_messages_proto3_proto_upb",
Protobuf Team459059e2022-05-09 14:13:02 -0700278 ":test_upb_proto",
Protobuf Teame5468b42022-04-19 14:09:14 -0700279 ":upb",
280 "@com_google_absl//absl/container:flat_hash_set",
281 "@com_google_googletest//:gtest_main",
282 "@com_google_protobuf//:protobuf",
283 ],
284)
285
Joshua Haberman8ede0d52022-03-05 18:33:27 -0800286cc_library(
Joshua Habermancb234e62020-10-17 17:48:32 -0700287 name = "fastdecode",
288 srcs = [
Joshua Haberman3d437bb2021-10-13 09:53:36 -0700289 "upb/decode.h",
Joshua Habermancb234e62020-10-17 17:48:32 -0700290 "upb/decode_fast.h",
Joshua Habermancb234e62020-10-17 17:48:32 -0700291 "upb/msg.h",
Joshua Haberman38813932021-04-05 16:00:25 -0700292 "upb/msg_internal.h",
Eric Saloe1371752022-11-03 16:46:34 +0000293 "upb/wire/decode.h",
294 "upb/wire/decode_fast.c",
295 "upb/wire/decode_fast.h",
Joshua Habermancb234e62020-10-17 17:48:32 -0700296 ],
Joshua Habermane86541a2020-10-28 17:53:09 -0700297 copts = UPB_DEFAULT_COPTS,
Joshua Habermanefd576b2020-10-26 21:37:17 -0700298 deps = [
Eric Salofd143162022-11-03 17:17:17 -0700299 ":collections_internal",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700300 ":extension_registry",
Eric Salof409c992022-11-03 15:48:59 +0000301 ":mem_internal",
Joshua Habermanefd576b2020-10-26 21:37:17 -0700302 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700303 ":table_internal",
Eric Saloe1371752022-11-03 16:46:34 +0000304 ":wire_internal",
Joshua Habermanefd576b2020-10-26 21:37:17 -0700305 ],
Joshua Habermanba29af32019-06-01 19:27:49 -0700306)
307
308# Common support routines used by generated code. This library has no
309# implementation, but depends on :upb and exposes a few more hdrs.
310#
311# This is public only because we have no way of visibility-limiting it to
312# upb_proto_library() only. This interface is not stable and by using it you
313# give up any backward compatibility guarantees.
314cc_library(
315 name = "generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
Joshua Habermanba29af32019-06-01 19:27:49 -0700316 hdrs = [
Eric Salofd143162022-11-03 17:17:17 -0700317 "upb/collections/array.h",
318 "upb/collections/array_internal.h",
Eric Salofd040a82022-11-04 22:08:16 -0700319 "upb/collections/map_gencode_util.h",
Eric Salofd143162022-11-03 17:17:17 -0700320 "upb/collections/message_value.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700321 "upb/extension_registry.h",
Joshua Habermanba29af32019-06-01 19:27:49 -0700322 "upb/msg.h",
Joshua Haberman42bdfcb2021-04-06 09:25:28 -0700323 "upb/msg_internal.h",
Eric Salof6307872022-11-05 16:16:27 -0700324 "upb/port/def.inc",
325 "upb/port/undef.inc",
Eric Saloe1371752022-11-03 16:46:34 +0000326 "upb/wire/decode.h",
327 "upb/wire/decode_fast.h",
328 "upb/wire/encode.h",
Joshua Habermanba29af32019-06-01 19:27:49 -0700329 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -0700330 copts = UPB_DEFAULT_COPTS,
Vishal Powar7031f772018-11-28 15:32:16 -0800331 visibility = ["//visibility:public"],
Anna Rde1bc112020-01-07 15:45:19 -0800332 deps = [
Eric Salofd040a82022-11-04 22:08:16 -0700333 ":collections_internal",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700334 ":table_internal",
Anna Rde1bc112020-01-07 15:45:19 -0800335 ":upb",
336 ],
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700337)
338
Protobuf Team Botff463792022-07-06 09:06:27 -0700339# Common support code for C++ generated code.
340cc_library(
341 name = "generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
342 hdrs = [
Protobuf Team Botff463792022-07-06 09:06:27 -0700343 "upb/msg.h",
344 "upb/msg_internal.h",
Eric Salof6307872022-11-05 16:16:27 -0700345 "upb/port/def.inc",
346 "upb/port/undef.inc",
Protobuf Team Botff463792022-07-06 09:06:27 -0700347 "upb/upb.hpp",
Eric Saloe1371752022-11-03 16:46:34 +0000348 "upb/wire/decode.h",
349 "upb/wire/decode_fast.h",
350 "upb/wire/encode.h",
Protobuf Team Botff463792022-07-06 09:06:27 -0700351 ],
352 copts = UPB_DEFAULT_COPTS,
353 visibility = ["//visibility:public"],
354 deps = [
Eric Salofd040a82022-11-04 22:08:16 -0700355 ":collections_internal",
Protobuf Team Botff463792022-07-06 09:06:27 -0700356 ":mini_table",
357 ":table_internal",
358 ":upb",
359 ],
360)
361
Joshua Haberman8c530f92022-02-22 14:50:55 -0800362cc_library(
363 name = "generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
Eric Saloedecfd52022-09-15 10:26:14 -0700364 srcs = [
365 "upb/reflection/common.h",
366 "upb/reflection/def_pool.h",
367 "upb/reflection/def_type.h",
368 "upb/reflection/enum_def.h",
369 "upb/reflection/enum_value_def.h",
370 "upb/reflection/extension_range.h",
371 "upb/reflection/field_def.h",
372 "upb/reflection/file_def.h",
373 "upb/reflection/message_def.h",
374 "upb/reflection/method_def.h",
375 "upb/reflection/oneof_def.h",
376 "upb/reflection/service_def.h",
377 ],
Joshua Haberman8c530f92022-02-22 14:50:55 -0800378 hdrs = [
Eric Salof6307872022-11-05 16:16:27 -0700379 "upb/port/def.inc",
380 "upb/port/undef.inc",
Eric Saloedecfd52022-09-15 10:26:14 -0700381 "upb/reflection/def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700382 "upb/reflection/def_pool_internal.h",
Joshua Haberman8c530f92022-02-22 14:50:55 -0800383 ],
384 copts = UPB_DEFAULT_COPTS,
385 visibility = ["//visibility:public"],
386 deps = [
Eric Saloedecfd52022-09-15 10:26:14 -0700387 ":descriptor_upb_proto",
Joshua Haberman8c530f92022-02-22 14:50:55 -0800388 ":reflection",
Eric Salo44916d72022-10-04 17:22:07 -0700389 ":reflection_internal",
Eric Saloedecfd52022-09-15 10:26:14 -0700390 ":table_internal",
Joshua Haberman8c530f92022-02-22 14:50:55 -0800391 ],
392)
393
Josh Habermancd9e1e62019-04-17 15:23:00 -0700394upb_proto_library(
Joshua Haberman543a0ce2020-05-26 22:30:50 -0700395 name = "descriptor_upb_proto",
396 visibility = ["//visibility:public"],
397 deps = ["@com_google_protobuf//:descriptor_proto"],
398)
399
400upb_proto_reflection_library(
401 name = "descriptor_upb_proto_reflection",
Joshua Habermanc58541e2019-05-15 09:49:29 -0700402 visibility = ["//visibility:public"],
Google-Autofuzz8f196672019-06-25 20:14:14 -0400403 deps = ["@com_google_protobuf//:descriptor_proto"],
Josh Habermancd9e1e62019-04-17 15:23:00 -0700404)
405
Josh Haberman01ed4ce2018-11-02 12:49:15 -0700406cc_library(
Protobuf Team823ed182022-04-28 16:07:14 -0700407 name = "collections",
408 srcs = [
Eric Salofd143162022-11-03 17:17:17 -0700409 "upb/collections/array.c",
410 "upb/collections/array_internal.h",
411 "upb/collections/map.c",
Eric Salofd040a82022-11-04 22:08:16 -0700412 "upb/collections/map_internal.h",
Eric Salofd143162022-11-03 17:17:17 -0700413 "upb/collections/map_sorter.c",
414 "upb/collections/message_value.h",
415 "upb/extension_registry.h",
416 "upb/msg.h",
Protobuf Team Bot79759452022-06-23 16:51:15 -0700417 "upb/msg_internal.h",
Protobuf Team823ed182022-04-28 16:07:14 -0700418 ],
419 hdrs = [
Eric Salofd143162022-11-03 17:17:17 -0700420 "upb/array.h",
Protobuf Team823ed182022-04-28 16:07:14 -0700421 "upb/collections.h",
Eric Salofd143162022-11-03 17:17:17 -0700422 "upb/collections/array.h",
423 "upb/collections/map.h",
424 "upb/collections/map_sorter_internal.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -0700425 "upb/map.h",
Protobuf Team823ed182022-04-28 16:07:14 -0700426 ],
427 copts = UPB_DEFAULT_COPTS,
428 visibility = ["//visibility:public"],
429 deps = [
Protobuf Team823ed182022-04-28 16:07:14 -0700430 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700431 ":table_internal",
Protobuf Team823ed182022-04-28 16:07:14 -0700432 ],
433)
434
Eric Salo00765002022-09-14 20:27:24 -0700435# TODO(b/232091617): Once we can delete the deprecated forwarding headers
436# (= everything in upb/) we can move this build target down into reflection/
Protobuf Team823ed182022-04-28 16:07:14 -0700437cc_library(
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700438 name = "reflection",
439 srcs = [
Eric Salo00765002022-09-14 20:27:24 -0700440 "upb/reflection/common.h",
441 "upb/reflection/def_builder.c",
Eric Salo44916d72022-10-04 17:22:07 -0700442 "upb/reflection/def_builder_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700443 "upb/reflection/def_pool.c",
444 "upb/reflection/def_pool.h",
Eric Salo44916d72022-10-04 17:22:07 -0700445 "upb/reflection/def_pool_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700446 "upb/reflection/def_type.c",
447 "upb/reflection/def_type.h",
Eric Salob8bec582022-09-30 11:22:10 -0700448 "upb/reflection/desc_state.c",
Eric Salo44916d72022-10-04 17:22:07 -0700449 "upb/reflection/desc_state_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700450 "upb/reflection/enum_def.c",
451 "upb/reflection/enum_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700452 "upb/reflection/enum_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700453 "upb/reflection/enum_value_def.c",
454 "upb/reflection/enum_value_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700455 "upb/reflection/enum_value_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700456 "upb/reflection/extension_range.c",
457 "upb/reflection/extension_range.h",
Eric Salo44916d72022-10-04 17:22:07 -0700458 "upb/reflection/extension_range_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700459 "upb/reflection/field_def.c",
460 "upb/reflection/field_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700461 "upb/reflection/field_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700462 "upb/reflection/file_def.c",
463 "upb/reflection/file_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700464 "upb/reflection/file_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700465 "upb/reflection/message.c",
466 "upb/reflection/message_def.c",
467 "upb/reflection/message_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700468 "upb/reflection/message_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700469 "upb/reflection/method_def.c",
470 "upb/reflection/method_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700471 "upb/reflection/method_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700472 "upb/reflection/oneof_def.c",
473 "upb/reflection/oneof_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700474 "upb/reflection/oneof_def_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700475 "upb/reflection/service_def.c",
476 "upb/reflection/service_def.h",
Eric Salo44916d72022-10-04 17:22:07 -0700477 "upb/reflection/service_def_internal.h",
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700478 ],
479 hdrs = [
480 "upb/def.h",
Joshua Haberman2559e782020-04-09 14:36:24 -0700481 "upb/def.hpp",
Joshua Haberman9a360ad2019-11-12 08:08:46 -0800482 "upb/reflection.h",
Joshua Haberman5e550e82021-01-09 15:45:44 -0800483 "upb/reflection.hpp",
Eric Salo00765002022-09-14 20:27:24 -0700484 "upb/reflection/def.h",
485 "upb/reflection/def.hpp",
486 "upb/reflection/message.h",
487 "upb/reflection/message.hpp",
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700488 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -0700489 copts = UPB_DEFAULT_COPTS,
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700490 visibility = ["//visibility:public"],
Josh Habermancd9e1e62019-04-17 15:23:00 -0700491 deps = [
Protobuf Team823ed182022-04-28 16:07:14 -0700492 ":collections",
Joshua Haberman543a0ce2020-05-26 22:30:50 -0700493 ":descriptor_upb_proto",
Joshua Habermanfa8b6052022-04-19 13:15:55 -0700494 ":mini_table",
Eric Salo00765002022-09-14 20:27:24 -0700495 ":mini_table_internal",
Anna Rfc494112020-01-09 14:16:25 -0800496 ":port",
Protobuf Team Bot15596be2022-06-24 10:38:27 -0700497 ":table_internal",
Joshua Haberman9a663562019-05-13 16:13:39 -0700498 ":upb",
Josh Habermancd9e1e62019-04-17 15:23:00 -0700499 ],
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700500)
501
Joshua Habermance1a3992020-02-04 06:22:09 -0800502cc_library(
Eric Salo44916d72022-10-04 17:22:07 -0700503 name = "reflection_internal",
504 srcs = [
505 "upb/reflection/common.h",
506 "upb/reflection/def_builder_internal.h",
507 "upb/reflection/def_pool.h",
508 "upb/reflection/def_type.h",
509 "upb/reflection/desc_state_internal.h",
510 "upb/reflection/enum_def.h",
511 "upb/reflection/enum_value_def.h",
512 "upb/reflection/extension_range.h",
513 "upb/reflection/field_def.h",
514 "upb/reflection/file_def.h",
515 "upb/reflection/message.h",
516 "upb/reflection/message_def.h",
517 "upb/reflection/method_def.h",
518 "upb/reflection/oneof_def.h",
519 "upb/reflection/service_def.h",
520 ],
521 hdrs = [
522 "upb/reflection/def_pool_internal.h",
523 "upb/reflection/enum_def_internal.h",
524 "upb/reflection/enum_value_def_internal.h",
525 "upb/reflection/extension_range_internal.h",
526 "upb/reflection/field_def_internal.h",
527 "upb/reflection/file_def_internal.h",
528 "upb/reflection/message_def_internal.h",
529 "upb/reflection/method_def_internal.h",
530 "upb/reflection/oneof_def_internal.h",
531 "upb/reflection/service_def_internal.h",
532 ],
533 copts = UPB_DEFAULT_COPTS,
534 visibility = ["//visibility:public"],
535 deps = [
536 ":collections",
537 ":descriptor_upb_proto",
538 ":mini_table",
539 ":mini_table_internal",
540 ":port",
541 ":reflection",
542 ":table_internal",
543 ":upb",
544 ],
545)
546
547cc_library(
Joshua Habermance1a3992020-02-04 06:22:09 -0800548 name = "textformat",
549 srcs = [
Eric Salo0bb46632022-11-03 10:33:57 -0700550 "upb/text/encode.c",
Joshua Habermance1a3992020-02-04 06:22:09 -0800551 ],
552 hdrs = [
Eric Salo0bb46632022-11-03 10:33:57 -0700553 "upb/text/encode.h",
Joshua Haberman02c89a82020-02-10 14:56:27 -0800554 "upb/text_encode.h",
Joshua Habermance1a3992020-02-04 06:22:09 -0800555 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -0700556 copts = UPB_DEFAULT_COPTS,
Joshua Habermance1a3992020-02-04 06:22:09 -0800557 visibility = ["//visibility:public"],
558 deps = [
Eric Salo85534bb2022-09-06 21:04:59 -0700559 ":collections",
Joshua Haberman4b8c04e2020-02-18 16:50:25 -0800560 ":port",
Joshua Habermance1a3992020-02-04 06:22:09 -0800561 ":reflection",
Eric Saloe1371752022-11-03 16:46:34 +0000562 ":wire_internal",
Joshua Habermance1a3992020-02-04 06:22:09 -0800563 ],
564)
565
Eric Salo8cc3e072022-09-25 20:19:42 -0700566# TODO(b/232091617): Once we can delete the deprecated forwarding headers
567# (= everything in upb/) we can move this build target down into json/
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800568cc_library(
569 name = "json",
570 srcs = [
Eric Salo8cc3e072022-09-25 20:19:42 -0700571 "upb/json/decode.c",
572 "upb/json/encode.c",
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800573 ],
574 hdrs = [
Eric Salo8cc3e072022-09-25 20:19:42 -0700575 "upb/json/decode.h",
576 "upb/json/encode.h",
Joshua Habermand49c1db2020-02-23 19:49:39 -0800577 "upb/json_decode.h",
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800578 "upb/json_encode.h",
579 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -0700580 copts = UPB_DEFAULT_COPTS,
Lidi Zhengf72c26c2020-12-10 16:23:08 -0800581 visibility = ["//visibility:public"],
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800582 deps = [
Eric Saloc67021f2022-08-23 11:21:55 -0700583 ":atoi_internal",
Eric Salo85534bb2022-09-06 21:04:59 -0700584 ":collections",
Joshua Haberman4b8c04e2020-02-18 16:50:25 -0800585 ":port",
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800586 ":reflection",
Eric Salo410143b2022-07-08 16:27:56 -0700587 ":unicode_internal",
Joshua Haberman4b8c04e2020-02-18 16:50:25 -0800588 ":upb",
Eric Saloe1371752022-11-03 16:46:34 +0000589 ":wire_internal",
Joshua Haberman6e9db7d2020-02-15 19:31:51 -0800590 ],
591)
592
Joshua Haberman11b6df02022-02-15 19:55:44 -0800593# Tests ########################################################################
594
595cc_test(
Eric Salo00765002022-09-14 20:27:24 -0700596 name = "def_builder_test",
597 srcs = [
598 "upb/reflection/common.h",
Eric Salo44916d72022-10-04 17:22:07 -0700599 "upb/reflection/def_builder_internal.h",
Eric Salo00765002022-09-14 20:27:24 -0700600 "upb/reflection/def_builder_test.cc",
Eric Salo00765002022-09-14 20:27:24 -0700601 "upb/reflection/def_type.h",
602 ],
603 deps = [
604 ":descriptor_upb_proto",
605 ":port",
606 ":reflection",
Eric Salo44916d72022-10-04 17:22:07 -0700607 ":reflection_internal",
Eric Salo00765002022-09-14 20:27:24 -0700608 ":table_internal",
609 ":upb",
610 "@com_google_googletest//:gtest_main",
611 ],
612)
613
614cc_test(
Joshua Haberman11b6df02022-02-15 19:55:44 -0800615 name = "test_generated_code",
616 srcs = ["upb/test_generated_code.cc"],
617 deps = [
618 ":empty_upbdefs_proto",
Joshua Haberman1cf82142022-05-12 13:57:50 -0700619 ":port",
Protobuf Teambef53682022-04-04 11:18:39 -0700620 ":test_messages_proto2_proto_upb",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800621 ":test_messages_proto3_proto_upb",
622 ":test_upb_proto",
Matt Kulukundisedd1dd32022-02-20 17:44:27 -0500623 ":upb",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800624 "@com_google_googletest//:gtest_main",
625 ],
626)
627
628proto_library(
629 name = "test_proto",
630 testonly = 1,
631 srcs = ["upb/test.proto"],
632)
633
634upb_proto_library(
635 name = "test_upb_proto",
636 testonly = 1,
637 deps = [":test_proto"],
638)
639
640proto_library(
641 name = "empty_proto",
642 srcs = ["upb/empty.proto"],
643)
644
645upb_proto_reflection_library(
646 name = "empty_upbdefs_proto",
647 testonly = 1,
648 deps = [":empty_proto"],
649)
650
651upb_proto_library(
Protobuf Teambef53682022-04-04 11:18:39 -0700652 name = "test_messages_proto2_proto_upb",
653 testonly = 1,
Protobuf Team Bot04363f72022-10-07 11:49:51 -0700654 deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto2_proto"],
Protobuf Teambef53682022-04-04 11:18:39 -0700655)
656
657upb_proto_library(
Joshua Haberman11b6df02022-02-15 19:55:44 -0800658 name = "test_messages_proto3_proto_upb",
659 testonly = 1,
Protobuf Team Bot04363f72022-10-07 11:49:51 -0700660 deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto3_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800661)
Matt Kulukundis61b09052022-02-19 19:35:58 -0500662
Protobuf Team Bot6e1aa9f2022-06-08 11:17:20 -0700663proto_library(
664 name = "json_test_proto",
665 testonly = 1,
Eric Salo8cc3e072022-09-25 20:19:42 -0700666 srcs = ["upb/json/test.proto"],
Protobuf Team Bot6e1aa9f2022-06-08 11:17:20 -0700667 deps = ["@com_google_protobuf//:struct_proto"],
668)
669
670upb_proto_library(
671 name = "json_test_upb_proto",
672 testonly = 1,
673 deps = [":json_test_proto"],
674)
675
676upb_proto_reflection_library(
677 name = "json_test_upb_proto_reflection",
678 testonly = 1,
679 deps = [":json_test_proto"],
680)
681
682cc_test(
Eric Salo4215bc82022-09-07 14:21:18 -0700683 name = "json_decode_test",
Eric Salo8cc3e072022-09-25 20:19:42 -0700684 srcs = ["upb/json/decode_test.cc"],
Eric Salo4215bc82022-09-07 14:21:18 -0700685 deps = [
686 ":json",
687 ":json_test_upb_proto",
688 ":json_test_upb_proto_reflection",
689 ":reflection",
690 ":struct_upb_proto",
691 ":upb",
692 "@com_google_googletest//:gtest_main",
693 ],
694)
695
696cc_test(
697 name = "json_encode_test",
Eric Salo8cc3e072022-09-25 20:19:42 -0700698 srcs = ["upb/json/encode_test.cc"],
Protobuf Team Bot6e1aa9f2022-06-08 11:17:20 -0700699 deps = [
700 ":json",
701 ":json_test_upb_proto",
702 ":json_test_upb_proto_reflection",
703 ":reflection",
704 ":struct_upb_proto",
705 ":upb",
706 "@com_google_googletest//:gtest_main",
707 ],
708)
709
Joshua Habermance012b72021-10-01 16:34:42 -0700710cc_test(
711 name = "msg_test",
712 srcs = ["upb/msg_test.cc"],
713 deps = [
Joshua Haberman125db892022-06-30 09:07:48 -0700714 ":fuzz_test_util",
Joshua Habermance012b72021-10-01 16:34:42 -0700715 ":json",
Matt Kulukundisa3bd5f82022-02-21 23:47:27 -0500716 ":msg_test_upb_proto",
Matt Kulukundis61b09052022-02-19 19:35:58 -0500717 ":msg_test_upb_proto_reflection",
Matt Kulukundisa3bd5f82022-02-21 23:47:27 -0500718 ":reflection",
Matt Kulukundis42c121e2022-02-21 23:58:17 -0500719 ":test_messages_proto3_proto_upb",
Matt Kulukundisa3bd5f82022-02-21 23:47:27 -0500720 ":upb",
Matt Kulukundis61b09052022-02-19 19:35:58 -0500721 "@com_google_googletest//:gtest_main",
Joshua Habermance012b72021-10-01 16:34:42 -0700722 ],
723)
724
725proto_library(
726 name = "msg_test_proto",
Matt Kulukundis61b09052022-02-19 19:35:58 -0500727 testonly = 1,
Joshua Habermance012b72021-10-01 16:34:42 -0700728 srcs = ["upb/msg_test.proto"],
Protobuf Team Bot04363f72022-10-07 11:49:51 -0700729 deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto3_proto"],
Joshua Habermance012b72021-10-01 16:34:42 -0700730)
731
Matt Kulukundisa3bd5f82022-02-21 23:47:27 -0500732upb_proto_library(
733 name = "msg_test_upb_proto",
734 testonly = 1,
735 deps = [":msg_test_proto"],
736)
737
Eric Salo0f585c62022-10-03 09:36:17 -0700738proto_library(
739 name = "proto3_test_proto",
740 testonly = 1,
741 srcs = ["upb/proto3_test.proto"],
742 deps = ["@com_google_protobuf//:descriptor_proto"],
743)
744
745upb_proto_library(
746 name = "proto3_test_upb_proto",
747 testonly = 1,
748 deps = [":proto3_test_proto"],
749)
750
751upb_proto_reflection_library(
752 name = "proto3_test_upb_proto_reflection",
753 testonly = 1,
754 deps = [":proto3_test_proto"],
755)
756
Joshua Habermance012b72021-10-01 16:34:42 -0700757upb_proto_reflection_library(
758 name = "msg_test_upb_proto_reflection",
Matt Kulukundis61b09052022-02-19 19:35:58 -0500759 testonly = 1,
Joshua Habermance012b72021-10-01 16:34:42 -0700760 deps = [":msg_test_proto"],
761)
762
Joshua Haberman11b6df02022-02-15 19:55:44 -0800763proto_library(
764 name = "test_cpp_proto",
765 srcs = ["upb/test_cpp.proto"],
Matt Kulukundis61b09052022-02-19 19:35:58 -0500766 deps = ["@com_google_protobuf//:timestamp_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800767)
768
769upb_proto_library(
770 name = "test_cpp_upb_proto",
771 deps = ["test_cpp_proto"],
772)
773
774upb_proto_reflection_library(
775 name = "test_cpp_upb_proto_reflection",
776 deps = ["test_cpp_proto"],
777)
778
Matt Kulukundis92d71a42022-02-20 15:20:48 -0500779upb_proto_library(
Protobuf Team Bot6e1aa9f2022-06-08 11:17:20 -0700780 name = "struct_upb_proto",
781 deps = ["@com_google_protobuf//:struct_proto"],
782)
783
784upb_proto_library(
Matt Kulukundis92d71a42022-02-20 15:20:48 -0500785 name = "timestamp_upb_proto",
786 deps = ["@com_google_protobuf//:timestamp_proto"],
787)
788
789upb_proto_reflection_library(
790 name = "timestamp_upb_proto_reflection",
791 deps = ["@com_google_protobuf//:timestamp_proto"],
792)
793
Joshua Haberman11b6df02022-02-15 19:55:44 -0800794cc_test(
Eric Saloc67021f2022-08-23 11:21:55 -0700795 name = "atoi_test",
796 srcs = ["upb/internal/atoi_test.cc"],
797 copts = UPB_DEFAULT_CPPOPTS,
798 deps = [
799 ":atoi_internal",
800 "@com_google_absl//absl/strings",
801 "@com_google_googletest//:gtest_main",
802 ],
803)
804
805cc_test(
Eric Salo0f585c62022-10-03 09:36:17 -0700806 name = "proto3_test",
807 srcs = ["upb/proto3_test.cc"],
808 copts = UPB_DEFAULT_CPPOPTS,
809 deps = [
810 ":proto3_test_upb_proto",
811 ":proto3_test_upb_proto_reflection",
812 ":reflection",
813 "@com_google_googletest//:gtest_main",
814 ],
815)
816
817cc_test(
Joshua Haberman11b6df02022-02-15 19:55:44 -0800818 name = "test_cpp",
819 srcs = ["upb/test_cpp.cc"],
820 copts = UPB_DEFAULT_CPPOPTS,
821 deps = [
Eric Salo00765002022-09-14 20:27:24 -0700822 ":json",
823 ":port",
824 ":reflection",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800825 ":test_cpp_upb_proto",
826 ":test_cpp_upb_proto_reflection",
Matt Kulukundis92d71a42022-02-20 15:20:48 -0500827 ":timestamp_upb_proto",
828 ":timestamp_upb_proto_reflection",
Eric Salo00765002022-09-14 20:27:24 -0700829 ":upb",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800830 "@com_google_googletest//:gtest_main",
831 ],
832)
833
834cc_test(
835 name = "test_table",
836 srcs = ["upb/test_table.cc"],
837 copts = UPB_DEFAULT_CPPOPTS,
838 deps = [
Eric Salo00765002022-09-14 20:27:24 -0700839 ":port",
840 ":table_internal",
841 ":upb",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800842 "@com_google_googletest//:gtest_main",
843 ],
844)
845
Joshua Haberman11b6df02022-02-15 19:55:44 -0800846upb_proto_library(
847 name = "conformance_proto_upb",
848 testonly = 1,
Joshua Haberman32f45b52022-05-09 22:00:33 -0700849 deps = ["@com_google_protobuf//conformance:conformance_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800850)
851
852upb_proto_reflection_library(
853 name = "conformance_proto_upbdefs",
854 testonly = 1,
Joshua Haberman32f45b52022-05-09 22:00:33 -0700855 deps = ["@com_google_protobuf//conformance:conformance_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800856)
857
858upb_proto_reflection_library(
859 name = "test_messages_proto2_upbdefs",
860 testonly = 1,
Protobuf Team Bot04363f72022-10-07 11:49:51 -0700861 deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto2_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800862)
863
864upb_proto_reflection_library(
865 name = "test_messages_proto3_upbdefs",
866 testonly = 1,
Protobuf Team Bot04363f72022-10-07 11:49:51 -0700867 deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto3_proto"],
Joshua Haberman11b6df02022-02-15 19:55:44 -0800868)
869
870cc_binary(
871 name = "conformance_upb",
872 testonly = 1,
873 srcs = ["upb/conformance_upb.c"],
874 copts = UPB_DEFAULT_COPTS,
875 data = ["upb/conformance_upb_failures.txt"],
876 deps = [
877 ":conformance_proto_upb",
878 ":conformance_proto_upbdefs",
Eric Salo00765002022-09-14 20:27:24 -0700879 ":json",
880 ":port",
881 ":reflection",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800882 ":test_messages_proto2_upbdefs",
883 ":test_messages_proto3_upbdefs",
Eric Salo00765002022-09-14 20:27:24 -0700884 ":textformat",
885 ":upb",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800886 ],
887)
888
889make_shell_script(
890 name = "gen_test_conformance_upb",
891 out = "test_conformance_upb.sh",
Joshua Haberman32f45b52022-05-09 22:00:33 -0700892 contents = "external/com_google_protobuf/conformance/conformance_test_runner " +
Joshua Haberman11b6df02022-02-15 19:55:44 -0800893 " --enforce_recommended " +
894 " --failure_list ./upb/conformance_upb_failures.txt" +
895 " ./conformance_upb",
896)
897
898sh_test(
899 name = "test_conformance_upb",
900 srcs = ["test_conformance_upb.sh"],
901 data = [
902 "upb/conformance_upb_failures.txt",
903 ":conformance_upb",
Joshua Haberman32f45b52022-05-09 22:00:33 -0700904 "@com_google_protobuf//conformance:conformance_test_runner",
Joshua Haberman11b6df02022-02-15 19:55:44 -0800905 ],
906 deps = ["@bazel_tools//tools/bash/runfiles"],
907)
908
Joshua Haberman50c12982022-03-08 15:52:37 -0800909cc_binary(
910 name = "conformance_upb_dynamic_minitable",
911 testonly = 1,
912 srcs = ["upb/conformance_upb.c"],
913 copts = UPB_DEFAULT_COPTS + [
Joshua Haberman970c6452022-03-08 17:44:06 -0800914 "-DREBUILD_MINITABLES",
Joshua Haberman50c12982022-03-08 15:52:37 -0800915 ],
916 data = ["upb/conformance_upb_failures.txt"],
917 deps = [
918 ":conformance_proto_upb",
919 ":conformance_proto_upbdefs",
Eric Salo00765002022-09-14 20:27:24 -0700920 ":json",
921 ":port",
922 ":reflection",
Joshua Haberman50c12982022-03-08 15:52:37 -0800923 ":test_messages_proto2_upbdefs",
924 ":test_messages_proto3_upbdefs",
Eric Salo00765002022-09-14 20:27:24 -0700925 ":textformat",
926 ":upb",
Joshua Haberman50c12982022-03-08 15:52:37 -0800927 ],
928)
929
930make_shell_script(
931 name = "gen_test_conformance_upb_dynamic_minitable",
932 out = "test_conformance_upb_dynamic_minitable.sh",
Joshua Haberman32f45b52022-05-09 22:00:33 -0700933 contents = "external/com_google_protobuf/conformance/conformance_test_runner " +
Joshua Haberman50c12982022-03-08 15:52:37 -0800934 " --enforce_recommended " +
935 " --failure_list ./upb/conformance_upb_failures.txt" +
936 " ./conformance_upb_dynamic_minitable",
937)
938
939sh_test(
940 name = "test_conformance_upb_dynamic_minitable",
941 srcs = ["test_conformance_upb_dynamic_minitable.sh"],
942 data = [
943 "upb/conformance_upb_failures.txt",
944 ":conformance_upb_dynamic_minitable",
Joshua Haberman32f45b52022-05-09 22:00:33 -0700945 "@com_google_protobuf//conformance:conformance_test_runner",
Joshua Haberman50c12982022-03-08 15:52:37 -0800946 ],
947 deps = ["@bazel_tools//tools/bash/runfiles"],
948)
949
Joshua Haberman125db892022-06-30 09:07:48 -0700950cc_library(
951 name = "fuzz_test_util",
952 testonly = 1,
953 srcs = ["upb/fuzz_test_util.cc"],
954 hdrs = ["upb/fuzz_test_util.h"],
955 deps = [
956 ":mini_table",
Eric Saloc033eff2022-10-27 14:36:38 -0700957 ":mini_table_internal",
Joshua Haberman125db892022-06-30 09:07:48 -0700958 ":upb",
959 ],
960)
961
Joshua Haberman928ef7f2019-03-27 12:52:33 -0700962# Internal C/C++ libraries #####################################################
963
964cc_library(
Eric Salofd143162022-11-03 17:17:17 -0700965 name = "collections_internal",
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700966 srcs = [
Eric Salofd143162022-11-03 17:17:17 -0700967 "upb/collections/array.h",
Eric Salofd040a82022-11-04 22:08:16 -0700968 "upb/collections/map_gencode_util.h",
Eric Salofd143162022-11-03 17:17:17 -0700969 "upb/collections/message_value.h",
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700970 "upb/msg.h",
971 "upb/status.h",
972 "upb/string_view.h",
973 "upb/upb.h",
974 ],
Eric Salofd040a82022-11-04 22:08:16 -0700975 hdrs = [
976 "upb/collections/array_internal.h",
977 "upb/collections/map_internal.h",
978 ],
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700979 copts = UPB_DEFAULT_COPTS,
980 visibility = ["//:__subpackages__"],
981 deps = [
Eric Salofd143162022-11-03 17:17:17 -0700982 ":collections",
Eric Salof409c992022-11-03 15:48:59 +0000983 ":mem",
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700984 ":port",
Eric Salofd040a82022-11-04 22:08:16 -0700985 ":table_internal",
Protobuf Team Bot8c44f042022-06-30 10:35:56 -0700986 ],
987)
988
989cc_library(
Eric Salof409c992022-11-03 15:48:59 +0000990 name = "mem",
Protobuf Team Bot8d0d13f2022-06-23 13:43:40 -0700991 srcs = [
Eric Salof409c992022-11-03 15:48:59 +0000992 "upb/mem/alloc.c",
993 "upb/mem/arena.c",
994 "upb/mem/arena_internal.h",
Protobuf Team Bot8d0d13f2022-06-23 13:43:40 -0700995 ],
Eric Salof409c992022-11-03 15:48:59 +0000996 hdrs = [
997 "upb/mem/alloc.h",
998 "upb/mem/arena.h",
999 ],
Protobuf Team Bot8d0d13f2022-06-23 13:43:40 -07001000 copts = UPB_DEFAULT_COPTS,
1001 visibility = ["//:__subpackages__"],
Protobuf Team Bot15596be2022-06-24 10:38:27 -07001002 deps = [":port"],
Protobuf Team Bot8d0d13f2022-06-23 13:43:40 -07001003)
1004
1005cc_library(
Eric Salof409c992022-11-03 15:48:59 +00001006 name = "mem_internal",
1007 hdrs = ["upb/mem/arena_internal.h"],
1008 copts = UPB_DEFAULT_COPTS,
1009 visibility = ["//:__subpackages__"],
1010 deps = [
1011 ":mem",
1012 ":port",
1013 ],
1014)
1015
1016cc_library(
Eric Saloc67021f2022-08-23 11:21:55 -07001017 name = "atoi_internal",
1018 srcs = ["upb/internal/atoi.c"],
1019 hdrs = ["upb/internal/atoi.h"],
1020 copts = UPB_DEFAULT_COPTS,
1021 visibility = ["//:__subpackages__"],
1022 deps = [":port"],
1023)
1024
1025cc_library(
Eric Saloe1371752022-11-03 16:46:34 +00001026 name = "wire_internal",
Protobuf Team Botca08ff52022-06-24 16:32:40 -07001027 srcs = [
Protobuf Team Botca08ff52022-06-24 16:32:40 -07001028 "upb/extension_registry.h",
1029 "upb/msg.h",
1030 "upb/msg_internal.h",
Eric Saloe1371752022-11-03 16:46:34 +00001031 "upb/wire/decode.h",
Protobuf Team Botca08ff52022-06-24 16:32:40 -07001032 ],
Eric Saloe1371752022-11-03 16:46:34 +00001033 hdrs = [
Eric Salo46699b72022-11-05 09:51:07 -07001034 "upb/wire/common_internal.h",
Eric Saloe1371752022-11-03 16:46:34 +00001035 "upb/wire/decode_internal.h",
1036 "upb/wire/encode_internal.h",
1037 ],
Protobuf Team Botca08ff52022-06-24 16:32:40 -07001038 copts = UPB_DEFAULT_COPTS,
1039 visibility = ["//:__subpackages__"],
1040 deps = [
Eric Salofd040a82022-11-04 22:08:16 -07001041 ":collections_internal",
Eric Salof409c992022-11-03 15:48:59 +00001042 ":mem_internal",
Protobuf Team Botca08ff52022-06-24 16:32:40 -07001043 ":port",
1044 ":table_internal",
1045 "//third_party/utf8_range",
1046 ],
1047)
1048
1049cc_library(
Protobuf Team Bot15596be2022-06-24 10:38:27 -07001050 name = "table_internal",
1051 srcs = [
1052 "upb/internal/table.c",
1053 ],
Joshua Habermancb234e62020-10-17 17:48:32 -07001054 hdrs = [
Protobuf Team Bote4635f22022-06-21 10:43:08 -07001055 "upb/internal/table.h",
Eric Salof409c992022-11-03 15:48:59 +00001056 "upb/mem/alloc.h",
1057 "upb/mem/arena.h",
Protobuf Team Bote4635f22022-06-21 10:43:08 -07001058 "upb/status.h",
Protobuf Team Bote153b522022-06-23 14:12:45 -07001059 "upb/string_view.h",
Joshua Habermanefd576b2020-10-26 21:37:17 -07001060 "upb/upb.h",
Joshua Habermancb234e62020-10-17 17:48:32 -07001061 ],
Protobuf Team Bot15596be2022-06-24 10:38:27 -07001062 copts = UPB_DEFAULT_COPTS,
1063 visibility = ["//:__subpackages__"],
1064 deps = [":port"],
Joshua Haberman928ef7f2019-03-27 12:52:33 -07001065)
1066
Eric Salo410143b2022-07-08 16:27:56 -07001067cc_library(
1068 name = "unicode_internal",
1069 srcs = [
1070 "upb/internal/unicode.c",
1071 ],
1072 hdrs = [
1073 "upb/internal/unicode.h",
1074 ],
1075 copts = UPB_DEFAULT_COPTS,
1076 visibility = ["//:__subpackages__"],
1077 deps = [":port"],
1078)
1079
Joshua Haberman77371f02019-01-23 16:26:13 -08001080# Amalgamation #################################################################
1081
Protobuf Teamb8edc712022-03-16 08:24:52 -07001082# begin:github_only
Joshua Haberman83c0edb2021-02-28 16:56:49 -08001083
Joshua Haberman77371f02019-01-23 16:26:13 -08001084upb_amalgamation(
1085 name = "gen_amalgamation",
1086 outs = [
1087 "upb.c",
1088 "upb.h",
1089 ],
Joshua Haberman77371f02019-01-23 16:26:13 -08001090 libs = [
Eric Saloc67021f2022-08-23 11:21:55 -07001091 ":atoi_internal",
Protobuf Team823ed182022-04-28 16:07:14 -07001092 ":collections",
Eric Salofd143162022-11-03 17:17:17 -07001093 ":collections_internal",
Joshua Haberman543a0ce2020-05-26 22:30:50 -07001094 ":descriptor_upb_proto",
Protobuf Team Bote4635f22022-06-21 10:43:08 -07001095 ":extension_registry",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001096 ":fastdecode",
Eric Salof409c992022-11-03 15:48:59 +00001097 ":mem",
1098 ":mem_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001099 ":mini_table",
Anna Rde1bc112020-01-07 15:45:19 -08001100 ":port",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001101 ":reflection",
Eric Salo44916d72022-10-04 17:22:07 -07001102 ":reflection_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001103 ":upb",
Eric Saloe1371752022-11-03 16:46:34 +00001104 ":wire_internal",
Joshua Haberman77371f02019-01-23 16:26:13 -08001105 ],
Mike Kruskal17b64512022-07-13 15:00:01 -07001106 strip_import_prefix = ["src"],
Joshua Haberman77371f02019-01-23 16:26:13 -08001107)
1108
1109cc_library(
1110 name = "amalgamation",
1111 srcs = ["upb.c"],
1112 hdrs = ["upb.h"],
Joshua Habermane86541a2020-10-28 17:53:09 -07001113 copts = UPB_DEFAULT_COPTS,
Joshua Haberman4307f5d2021-10-11 23:02:32 -07001114 deps = ["//third_party/utf8_range"],
Joshua Haberman77371f02019-01-23 16:26:13 -08001115)
1116
Joshua Haberman16facab2020-05-08 16:40:24 -07001117upb_amalgamation(
Joshua Haberman543a0ce2020-05-26 22:30:50 -07001118 name = "gen_php_amalgamation",
Joshua Haberman16facab2020-05-08 16:40:24 -07001119 outs = [
Joshua Haberman543a0ce2020-05-26 22:30:50 -07001120 "php-upb.c",
1121 "php-upb.h",
Joshua Haberman16facab2020-05-08 16:40:24 -07001122 ],
Joshua Haberman16facab2020-05-08 16:40:24 -07001123 libs = [
Eric Saloc67021f2022-08-23 11:21:55 -07001124 ":atoi_internal",
Protobuf Team823ed182022-04-28 16:07:14 -07001125 ":collections",
Eric Salofd143162022-11-03 17:17:17 -07001126 ":collections_internal",
Joshua Haberman543a0ce2020-05-26 22:30:50 -07001127 ":descriptor_upb_proto",
1128 ":descriptor_upb_proto_reflection",
Protobuf Team Bote4635f22022-06-21 10:43:08 -07001129 ":extension_registry",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001130 ":fastdecode",
Joshua Haberman16facab2020-05-08 16:40:24 -07001131 ":json",
Eric Salof409c992022-11-03 15:48:59 +00001132 ":mem",
1133 ":mem_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001134 ":mini_table",
1135 ":port",
1136 ":reflection",
Eric Salo44916d72022-10-04 17:22:07 -07001137 ":reflection_internal",
Joshua Haberman81e716d2022-09-30 17:41:33 +00001138 ":table_internal",
Joshua Haberman32c6e9b2022-10-03 09:49:03 -07001139 ":unicode_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001140 ":upb",
Eric Saloe1371752022-11-03 16:46:34 +00001141 ":wire_internal",
Joshua Haberman16facab2020-05-08 16:40:24 -07001142 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -07001143 prefix = "php-",
Mike Kruskal17b64512022-07-13 15:00:01 -07001144 strip_import_prefix = ["src"],
Joshua Haberman32c6e9b2022-10-03 09:49:03 -07001145 visibility = ["@com_google_protobuf//php:__pkg__"],
Joshua Haberman16facab2020-05-08 16:40:24 -07001146)
1147
1148cc_library(
Joshua Haberman543a0ce2020-05-26 22:30:50 -07001149 name = "php_amalgamation",
1150 srcs = ["php-upb.c"],
1151 hdrs = ["php-upb.h"],
Joshua Habermane86541a2020-10-28 17:53:09 -07001152 copts = UPB_DEFAULT_COPTS,
Joshua Haberman4307f5d2021-10-11 23:02:32 -07001153 deps = ["//third_party/utf8_range"],
Joshua Haberman16facab2020-05-08 16:40:24 -07001154)
1155
Joshua Habermanefefbff2020-08-03 10:12:31 -07001156upb_amalgamation(
1157 name = "gen_ruby_amalgamation",
Joshua Habermanefefbff2020-08-03 10:12:31 -07001158 outs = [
1159 "ruby-upb.c",
1160 "ruby-upb.h",
1161 ],
Joshua Habermanefefbff2020-08-03 10:12:31 -07001162 libs = [
Eric Saloc67021f2022-08-23 11:21:55 -07001163 ":atoi_internal",
Protobuf Team823ed182022-04-28 16:07:14 -07001164 ":collections",
Eric Salofd143162022-11-03 17:17:17 -07001165 ":collections_internal",
Joshua Habermanefefbff2020-08-03 10:12:31 -07001166 ":descriptor_upb_proto",
Protobuf Team Bote4635f22022-06-21 10:43:08 -07001167 ":extension_registry",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001168 ":fastdecode",
Joshua Habermanefefbff2020-08-03 10:12:31 -07001169 ":json",
Eric Salof409c992022-11-03 15:48:59 +00001170 ":mem",
1171 ":mem_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001172 ":mini_table",
1173 ":port",
1174 ":reflection",
Eric Salo44916d72022-10-04 17:22:07 -07001175 ":reflection_internal",
Joshua Haberman81e716d2022-09-30 17:41:33 +00001176 ":table_internal",
Joshua Haberman82c6c482022-09-30 17:21:49 -07001177 ":unicode_internal",
Joshua Habermanfa8b6052022-04-19 13:15:55 -07001178 ":upb",
Eric Saloe1371752022-11-03 16:46:34 +00001179 ":wire_internal",
Joshua Habermanefefbff2020-08-03 10:12:31 -07001180 ],
Joshua Habermane3f41de2020-10-17 13:15:58 -07001181 prefix = "ruby-",
Mike Kruskal17b64512022-07-13 15:00:01 -07001182 strip_import_prefix = ["src"],
Joshua Habermanccd88d52022-09-03 01:52:54 +00001183 visibility = ["@com_google_protobuf//ruby:__pkg__"],
Joshua Habermanefefbff2020-08-03 10:12:31 -07001184)
1185
1186cc_library(
1187 name = "ruby_amalgamation",
1188 srcs = ["ruby-upb.c"],
1189 hdrs = ["ruby-upb.h"],
Joshua Habermane86541a2020-10-28 17:53:09 -07001190 copts = UPB_DEFAULT_COPTS,
Joshua Haberman4307f5d2021-10-11 23:02:32 -07001191 deps = ["//third_party/utf8_range"],
Joshua Habermanefefbff2020-08-03 10:12:31 -07001192)
1193
Joshua Habermane3f41de2020-10-17 13:15:58 -07001194exports_files(
1195 [
Joshua Habermanbfc86d32019-12-04 16:56:40 -08001196 "third_party/lunit/console.lua",
1197 "third_party/lunit/lunit.lua",
1198 ],
Joshua Haberman11b6df02022-02-15 19:55:44 -08001199 visibility = ["//upb/bindings/lua:__pkg__"],
Josh Haberman01ed4ce2018-11-02 12:49:15 -07001200)
1201
Joshua Haberman985145c2019-04-24 17:36:17 +00001202filegroup(
1203 name = "cmake_files",
1204 srcs = glob([
Joshua Haberman985145c2019-04-24 17:36:17 +00001205 "upb/**/*",
Joshua Haberman4f901b62020-10-14 16:32:43 -07001206 "third_party/**/*",
Joshua Haberman9a663562019-05-13 16:13:39 -07001207 ]),
Joshua Habermane3f41de2020-10-17 13:15:58 -07001208 visibility = ["//cmake:__pkg__"],
Josh Haberman01ed4ce2018-11-02 12:49:15 -07001209)
Joshua Haberman83c0edb2021-02-28 16:56:49 -08001210
Protobuf Teamb8edc712022-03-16 08:24:52 -07001211# end:github_only
Joshua Haberman4ffeaa62022-06-01 12:25:11 -07001212
1213# begin:google_only
1214#
1215# py_binary(
1216# name = "update_check_runs",
1217# srcs = ["update_check_runs.py"],
1218# main = "update_check_runs.py",
1219# deps = [
1220# "//third_party/py/absl:app",
Mike Kruskale1b11b62022-09-30 13:28:24 -07001221# "//third_party/py/absl/flags",
Joshua Haberman4ffeaa62022-06-01 12:25:11 -07001222# ],
1223# )
1224#
Protobuf Team Botbe98a912022-10-11 12:14:01 -07001225# kt_native_interop_hint(
1226# name = "upb_kotlin_native_hint",
1227# compatible_with = ["//buildenv/target:non_prod"],
1228# headers_to_exclude = glob([
1229# "**/*.hpp",
1230# ]) + [
1231# "upb/extension_registry.h",
1232# ],
1233# no_string_conversion = ["upb_MiniTable_Build"],
1234# strict_enums = ["upb_FieldType"],
1235# )
1236#
1237# kt_native_interop_hint(
1238# name = "suppress_kotlin_interop",
1239# compatible_with = ["//buildenv/target:non_prod"],
1240# suppressed = True,
1241# )
1242#
Joshua Haberman4ffeaa62022-06-01 12:25:11 -07001243# end:google_only