| 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_COPTS", |
| 29 |
"UPB_DEFAULT_CPPOPTS", |
| 30 |
"make_shell_script", |
| 31 |
) |
| 32 |
load( |
| 33 |
"//bazel:upb_proto_library.bzl", |
| 34 |
"upb_fasttable_enabled", |
| 35 |
"upb_proto_library", |
| 36 |
"upb_proto_library_copts", |
| 37 |
"upb_proto_reflection_library", |
| 38 |
) |
| 39 |
|
| 40 |
# begin:github_only |
| 41 |
load( |
| 42 |
"//bazel:build_defs.bzl", |
| 43 |
"upb_amalgamation", |
| 44 |
) |
| 45 |
# end:github_only |
| 46 |
|
| 47 |
licenses(["notice"]) |
| 48 |
|
| 49 |
exports_files(["LICENSE"]) |
| 50 |
|
| 51 |
exports_files( |
| 52 |
[ |
| 53 |
"BUILD", |
| 54 |
"WORKSPACE", |
| 55 |
], |
| 56 |
visibility = ["//cmake:__pkg__"], |
| 57 |
) |
| 58 |
|
| 59 |
config_setting( |
| 60 |
name = "windows", |
| 61 |
constraint_values = ["@platforms//os:windows"], |
| 62 |
visibility = ["//visibility:public"], |
| 63 |
) |
| 64 |
|
| 65 |
upb_fasttable_enabled( |
| 66 |
name = "fasttable_enabled", |
| 67 |
build_setting_default = False, |
| 68 |
visibility = ["//visibility:public"], |
| 69 |
) |
| 70 |
|
| 71 |
config_setting( |
| 72 |
name = "fasttable_enabled_setting", |
| 73 |
flag_values = {"//:fasttable_enabled": "true"}, |
| 74 |
) |
| 75 |
|
| 76 |
upb_proto_library_copts( |
| 77 |
name = "upb_proto_library_copts__for_generated_code_only_do_not_use", |
| 78 |
copts = UPB_DEFAULT_COPTS, |
| 79 |
visibility = ["//visibility:public"], |
| 80 |
) |
| 81 |
|
| 82 |
package_group( |
| 83 |
name = "friends", |
| 84 |
packages = [], |
| 85 |
) |
| 86 |
|
| 87 |
# Public C/C++ libraries ####################################################### |
| 88 |
|
| 89 |
cc_library( |
| 90 |
name = "port", |
| 91 |
hdrs = [ |
| 92 |
"upb/internal/vsnprintf_compat.h", |
| 93 |
], |
| 94 |
copts = UPB_DEFAULT_COPTS, |
| 95 |
textual_hdrs = [ |
| 96 |
"upb/port_def.inc", |
| 97 |
"upb/port_undef.inc", |
| 98 |
], |
| 99 |
visibility = ["//:__subpackages__"], |
| 100 |
) |
| 101 |
|
| 102 |
cc_library( |
| 103 |
name = "upb", |
| 104 |
srcs = [ |
| 105 |
"upb/arena.c", |
| 106 |
"upb/decode.c", |
| 107 |
"upb/encode.c", |
| 108 |
"upb/internal/decode.h", |
| 109 |
"upb/internal/table.h", |
| 110 |
"upb/internal/upb.h", |
| 111 |
"upb/msg.c", |
| 112 |
"upb/msg_internal.h", |
| 113 |
"upb/status.c", |
| 114 |
"upb/table.c", |
| 115 |
"upb/upb.c", |
| 116 |
], |
| 117 |
hdrs = [ |
| 118 |
"upb/arena.h", |
| 119 |
"upb/decode.h", |
| 120 |
"upb/encode.h", |
| 121 |
"upb/extension_registry.h", |
| 122 |
"upb/msg.h", |
| 123 |
"upb/status.h", |
| 124 |
"upb/upb.h", |
| 125 |
"upb/upb.hpp", |
| 126 |
], |
| 127 |
copts = UPB_DEFAULT_COPTS, |
| 128 |
visibility = ["//visibility:public"], |
| 129 |
deps = [ |
| 130 |
":extension_registry", |
| 131 |
":fastdecode", |
| 132 |
":port", |
| 133 |
"//third_party/utf8_range", |
| 134 |
], |
| 135 |
) |
| 136 |
|
| 137 |
cc_library( |
| 138 |
name = "extension_registry", |
| 139 |
srcs = [ |
| 140 |
"upb/extension_registry.c", |
| 141 |
"upb/msg.h", |
| 142 |
"upb/msg_internal.h", |
| 143 |
"upb/upb.h", |
| 144 |
], |
| 145 |
hdrs = [ |
| 146 |
"upb/extension_registry.h", |
| 147 |
], |
| 148 |
copts = UPB_DEFAULT_COPTS, |
| 149 |
visibility = ["//visibility:public"], |
| 150 |
deps = [ |
| 151 |
":port", |
| 152 |
":table", |
| 153 |
], |
| 154 |
) |
| 155 |
|
| 156 |
cc_library( |
| 157 |
name = "mini_descriptor", |
| 158 |
srcs = [ |
| 159 |
"upb/mini_descriptor.c", |
| 160 |
], |
| 161 |
hdrs = [ |
| 162 |
"upb/mini_descriptor.h", |
| 163 |
], |
| 164 |
copts = UPB_DEFAULT_COPTS, |
| 165 |
visibility = ["//visibility:public"], |
| 166 |
deps = [ |
| 167 |
":descriptor_upb_proto", |
| 168 |
":mini_table", |
| 169 |
":port", |
| 170 |
":reflection", |
| 171 |
":table", |
| 172 |
":upb", |
| 173 |
], |
| 174 |
) |
| 175 |
|
| 176 |
cc_library( |
| 177 |
name = "mini_table_internal", |
| 178 |
hdrs = [ |
| 179 |
"upb/msg_internal.h", |
| 180 |
], |
| 181 |
deps = [ |
| 182 |
":extension_registry", |
| 183 |
":port", |
| 184 |
":table", |
| 185 |
":upb", |
| 186 |
], |
| 187 |
) |
| 188 |
|
| 189 |
cc_library( |
| 190 |
name = "mini_table", |
| 191 |
srcs = [ |
| 192 |
"upb/mini_table.c", |
| 193 |
], |
| 194 |
hdrs = [ |
| 195 |
"upb/mini_table.h", |
| 196 |
"upb/mini_table.hpp", |
| 197 |
], |
| 198 |
copts = UPB_DEFAULT_COPTS, |
| 199 |
visibility = ["//visibility:public"], |
| 200 |
deps = [ |
| 201 |
":extension_registry", |
| 202 |
":mini_table_internal", |
| 203 |
":port", |
| 204 |
":upb", |
| 205 |
], |
| 206 |
) |
| 207 |
|
| 208 |
cc_library( |
| 209 |
name = "mini_table_accessors", |
| 210 |
srcs = [ |
| 211 |
"upb/internal/mini_table_accessors.h", |
| 212 |
"upb/mini_table_accessors.c", |
| 213 |
], |
| 214 |
hdrs = [ |
| 215 |
"upb/mini_table_accessors.h", |
| 216 |
], |
| 217 |
copts = UPB_DEFAULT_COPTS, |
| 218 |
visibility = ["//visibility:public"], |
| 219 |
deps = [ |
| 220 |
":collections", |
| 221 |
":mini_table", |
| 222 |
":mini_table_internal", |
| 223 |
":port", |
| 224 |
":upb", |
| 225 |
], |
| 226 |
) |
| 227 |
|
| 228 |
cc_test( |
| 229 |
name = "mini_table_test", |
| 230 |
srcs = [ |
| 231 |
"upb/internal/table.h", |
| 232 |
"upb/mini_table_test.cc", |
| 233 |
], |
| 234 |
deps = [ |
| 235 |
":extension_registry", |
| 236 |
":mini_table", |
| 237 |
":mini_table_internal", |
| 238 |
":port", |
| 239 |
":upb", |
| 240 |
"@com_google_absl//absl/container:flat_hash_set", |
| 241 |
"@com_google_googletest//:gtest_main", |
| 242 |
"@com_google_protobuf//:protobuf", |
| 243 |
], |
| 244 |
) |
| 245 |
|
| 246 |
cc_test( |
| 247 |
name = "mini_table_accessors_test", |
| 248 |
srcs = ["upb/mini_table_accessors_test.cc"], |
| 249 |
deps = [ |
| 250 |
":collections", |
| 251 |
":mini_table", |
| 252 |
":mini_table_accessors", |
| 253 |
":mini_table_internal", |
| 254 |
":test_messages_proto2_proto_upb", |
| 255 |
":test_messages_proto3_proto_upb", |
| 256 |
":test_upb_proto", |
| 257 |
":upb", |
| 258 |
"@com_google_absl//absl/container:flat_hash_set", |
| 259 |
"@com_google_googletest//:gtest_main", |
| 260 |
"@com_google_protobuf//:protobuf", |
| 261 |
], |
| 262 |
) |
| 263 |
|
| 264 |
cc_library( |
| 265 |
name = "fastdecode", |
| 266 |
srcs = [ |
| 267 |
"upb/decode.h", |
| 268 |
"upb/decode_fast.c", |
| 269 |
"upb/decode_fast.h", |
| 270 |
"upb/internal/decode.h", |
| 271 |
"upb/internal/upb.h", |
| 272 |
"upb/msg.h", |
| 273 |
"upb/msg_internal.h", |
| 274 |
], |
| 275 |
copts = UPB_DEFAULT_COPTS, |
| 276 |
deps = [ |
| 277 |
":extension_registry", |
| 278 |
":port", |
| 279 |
":table", |
| 280 |
"//third_party/utf8_range", |
| 281 |
], |
| 282 |
) |
| 283 |
|
| 284 |
# Common support routines used by generated code. This library has no |
| 285 |
# implementation, but depends on :upb and exposes a few more hdrs. |
| 286 |
# |
| 287 |
# This is public only because we have no way of visibility-limiting it to |
| 288 |
# upb_proto_library() only. This interface is not stable and by using it you |
| 289 |
# give up any backward compatibility guarantees. |
| 290 |
cc_library( |
| 291 |
name = "generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", |
| 292 |
hdrs = [ |
| 293 |
"upb/decode.h", |
| 294 |
"upb/decode_fast.h", |
| 295 |
"upb/encode.h", |
| 296 |
"upb/extension_registry.h", |
| 297 |
"upb/msg.h", |
| 298 |
"upb/msg_internal.h", |
| 299 |
"upb/port_def.inc", |
| 300 |
"upb/port_undef.inc", |
| 301 |
], |
| 302 |
copts = UPB_DEFAULT_COPTS, |
| 303 |
visibility = ["//visibility:public"], |
| 304 |
deps = [ |
| 305 |
":table", |
| 306 |
":upb", |
| 307 |
], |
| 308 |
) |
| 309 |
|
| 310 |
cc_library( |
| 311 |
name = "generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", |
| 312 |
hdrs = [ |
| 313 |
"upb/def.h", |
| 314 |
"upb/port_def.inc", |
| 315 |
"upb/port_undef.inc", |
| 316 |
], |
| 317 |
copts = UPB_DEFAULT_COPTS, |
| 318 |
visibility = ["//visibility:public"], |
| 319 |
deps = [ |
| 320 |
":descriptor_upb_proto", |
| 321 |
":reflection", |
| 322 |
":table", |
| 323 |
], |
| 324 |
) |
| 325 |
|
| 326 |
upb_proto_library( |
| 327 |
name = "descriptor_upb_proto", |
| 328 |
visibility = ["//visibility:public"], |
| 329 |
deps = ["@com_google_protobuf//:descriptor_proto"], |
| 330 |
) |
| 331 |
|
| 332 |
upb_proto_reflection_library( |
| 333 |
name = "descriptor_upb_proto_reflection", |
| 334 |
visibility = ["//visibility:public"], |
| 335 |
deps = ["@com_google_protobuf//:descriptor_proto"], |
| 336 |
) |
| 337 |
|
| 338 |
cc_library( |
| 339 |
name = "collections", |
| 340 |
srcs = [ |
| 341 |
"upb/array.c", |
| 342 |
"upb/map.c", |
| 343 |
], |
| 344 |
hdrs = [ |
| 345 |
"upb/array.h", |
| 346 |
"upb/collections.h", |
| 347 |
"upb/map.h", |
| 348 |
"upb/message_value.h", |
| 349 |
], |
| 350 |
copts = UPB_DEFAULT_COPTS, |
| 351 |
visibility = ["//visibility:public"], |
| 352 |
deps = [ |
| 353 |
":descriptor_upb_proto", |
| 354 |
":mini_table", |
| 355 |
":port", |
| 356 |
":table", |
| 357 |
":upb", |
| 358 |
], |
| 359 |
) |
| 360 |
|
| 361 |
cc_library( |
| 362 |
name = "reflection", |
| 363 |
srcs = [ |
| 364 |
"upb/def.c", |
| 365 |
"upb/msg.h", |
| 366 |
"upb/reflection.c", |
| 367 |
], |
| 368 |
hdrs = [ |
| 369 |
"upb/def.h", |
| 370 |
"upb/def.hpp", |
| 371 |
"upb/reflection.h", |
| 372 |
"upb/reflection.hpp", |
| 373 |
], |
| 374 |
copts = UPB_DEFAULT_COPTS, |
| 375 |
visibility = ["//visibility:public"], |
| 376 |
deps = [ |
| 377 |
":collections", |
| 378 |
":descriptor_upb_proto", |
| 379 |
":mini_table", |
| 380 |
":port", |
| 381 |
":table", |
| 382 |
":upb", |
| 383 |
], |
| 384 |
) |
| 385 |
|
| 386 |
cc_library( |
| 387 |
name = "textformat", |
| 388 |
srcs = [ |
| 389 |
"upb/internal/upb.h", |
| 390 |
"upb/text_encode.c", |
| 391 |
], |
| 392 |
hdrs = [ |
| 393 |
"upb/text_encode.h", |
| 394 |
], |
| 395 |
copts = UPB_DEFAULT_COPTS, |
| 396 |
visibility = ["//visibility:public"], |
| 397 |
deps = [ |
| 398 |
":port", |
| 399 |
":reflection", |
| 400 |
":table", |
| 401 |
], |
| 402 |
) |
| 403 |
|
| 404 |
cc_library( |
| 405 |
name = "json", |
| 406 |
srcs = [ |
| 407 |
"upb/internal/upb.h", |
| 408 |
"upb/json_decode.c", |
| 409 |
"upb/json_encode.c", |
| 410 |
], |
| 411 |
hdrs = [ |
| 412 |
"upb/json_decode.h", |
| 413 |
"upb/json_encode.h", |
| 414 |
], |
| 415 |
copts = UPB_DEFAULT_COPTS, |
| 416 |
visibility = ["//visibility:public"], |
| 417 |
deps = [ |
| 418 |
":port", |
| 419 |
":reflection", |
| 420 |
":upb", |
| 421 |
], |
| 422 |
) |
| 423 |
|
| 424 |
# Tests ######################################################################## |
| 425 |
|
| 426 |
cc_test( |
| 427 |
name = "test_generated_code", |
| 428 |
srcs = ["upb/test_generated_code.cc"], |
| 429 |
deps = [ |
| 430 |
":empty_upbdefs_proto", |
| 431 |
":port", |
| 432 |
":test_messages_proto2_proto_upb", |
| 433 |
":test_messages_proto3_proto_upb", |
| 434 |
":test_upb_proto", |
| 435 |
":upb", |
| 436 |
"@com_google_googletest//:gtest_main", |
| 437 |
], |
| 438 |
) |
| 439 |
|
| 440 |
proto_library( |
| 441 |
name = "test_proto", |
| 442 |
testonly = 1, |
| 443 |
srcs = ["upb/test.proto"], |
| 444 |
) |
| 445 |
|
| 446 |
upb_proto_library( |
| 447 |
name = "test_upb_proto", |
| 448 |
testonly = 1, |
| 449 |
deps = [":test_proto"], |
| 450 |
) |
| 451 |
|
| 452 |
proto_library( |
| 453 |
name = "empty_proto", |
| 454 |
srcs = ["upb/empty.proto"], |
| 455 |
) |
| 456 |
|
| 457 |
upb_proto_reflection_library( |
| 458 |
name = "empty_upbdefs_proto", |
| 459 |
testonly = 1, |
| 460 |
deps = [":empty_proto"], |
| 461 |
) |
| 462 |
|
| 463 |
upb_proto_library( |
| 464 |
name = "test_messages_proto2_proto_upb", |
| 465 |
testonly = 1, |
| 466 |
deps = ["@com_google_protobuf//:test_messages_proto2_proto"], |
| 467 |
) |
| 468 |
|
| 469 |
upb_proto_library( |
| 470 |
name = "test_messages_proto3_proto_upb", |
| 471 |
testonly = 1, |
| 472 |
deps = ["@com_google_protobuf//:test_messages_proto3_proto"], |
| 473 |
) |
| 474 |
|
| 475 |
proto_library( |
| 476 |
name = "json_test_proto", |
| 477 |
testonly = 1, |
| 478 |
srcs = ["upb/json_test.proto"], |
| 479 |
deps = ["@com_google_protobuf//:struct_proto"], |
| 480 |
) |
| 481 |
|
| 482 |
upb_proto_library( |
| 483 |
name = "json_test_upb_proto", |
| 484 |
testonly = 1, |
| 485 |
deps = [":json_test_proto"], |
| 486 |
) |
| 487 |
|
| 488 |
upb_proto_reflection_library( |
| 489 |
name = "json_test_upb_proto_reflection", |
| 490 |
testonly = 1, |
| 491 |
deps = [":json_test_proto"], |
| 492 |
) |
| 493 |
|
| 494 |
cc_test( |
| 495 |
name = "json_test", |
| 496 |
srcs = ["upb/json_test.cc"], |
| 497 |
deps = [ |
| 498 |
":json", |
| 499 |
":json_test_upb_proto", |
| 500 |
":json_test_upb_proto_reflection", |
| 501 |
":reflection", |
| 502 |
":struct_upb_proto", |
| 503 |
":upb", |
| 504 |
"@com_google_googletest//:gtest_main", |
| 505 |
], |
| 506 |
) |
| 507 |
|
| 508 |
cc_test( |
| 509 |
name = "msg_test", |
| 510 |
srcs = ["upb/msg_test.cc"], |
| 511 |
deps = [ |
| 512 |
":json", |
| 513 |
":msg_test_upb_proto", |
| 514 |
":msg_test_upb_proto_reflection", |
| 515 |
":reflection", |
| 516 |
":test_messages_proto3_proto_upb", |
| 517 |
":upb", |
| 518 |
"@com_google_googletest//:gtest_main", |
| 519 |
], |
| 520 |
) |
| 521 |
|
| 522 |
proto_library( |
| 523 |
name = "msg_test_proto", |
| 524 |
testonly = 1, |
| 525 |
srcs = ["upb/msg_test.proto"], |
| 526 |
deps = ["@com_google_protobuf//:test_messages_proto3_proto"], |
| 527 |
) |
| 528 |
|
| 529 |
upb_proto_library( |
| 530 |
name = "msg_test_upb_proto", |
| 531 |
testonly = 1, |
| 532 |
deps = [":msg_test_proto"], |
| 533 |
) |
| 534 |
|
| 535 |
upb_proto_reflection_library( |
| 536 |
name = "msg_test_upb_proto_reflection", |
| 537 |
testonly = 1, |
| 538 |
deps = [":msg_test_proto"], |
| 539 |
) |
| 540 |
|
| 541 |
proto_library( |
| 542 |
name = "test_cpp_proto", |
| 543 |
srcs = ["upb/test_cpp.proto"], |
| 544 |
deps = ["@com_google_protobuf//:timestamp_proto"], |
| 545 |
) |
| 546 |
|
| 547 |
upb_proto_library( |
| 548 |
name = "test_cpp_upb_proto", |
| 549 |
deps = ["test_cpp_proto"], |
| 550 |
) |
| 551 |
|
| 552 |
upb_proto_reflection_library( |
| 553 |
name = "test_cpp_upb_proto_reflection", |
| 554 |
deps = ["test_cpp_proto"], |
| 555 |
) |
| 556 |
|
| 557 |
upb_proto_library( |
| 558 |
name = "struct_upb_proto", |
| 559 |
deps = ["@com_google_protobuf//:struct_proto"], |
| 560 |
) |
| 561 |
|
| 562 |
upb_proto_library( |
| 563 |
name = "timestamp_upb_proto", |
| 564 |
deps = ["@com_google_protobuf//:timestamp_proto"], |
| 565 |
) |
| 566 |
|
| 567 |
upb_proto_reflection_library( |
| 568 |
name = "timestamp_upb_proto_reflection", |
| 569 |
deps = ["@com_google_protobuf//:timestamp_proto"], |
| 570 |
) |
| 571 |
|
| 572 |
cc_test( |
| 573 |
name = "test_cpp", |
| 574 |
srcs = ["upb/test_cpp.cc"], |
| 575 |
copts = UPB_DEFAULT_CPPOPTS, |
| 576 |
deps = [ |
| 577 |
":test_cpp_upb_proto", |
| 578 |
":test_cpp_upb_proto_reflection", |
| 579 |
":timestamp_upb_proto", |
| 580 |
":timestamp_upb_proto_reflection", |
| 581 |
"//:json", |
| 582 |
"//:port", |
| 583 |
"//:reflection", |
| 584 |
"//:upb", |
| 585 |
"@com_google_googletest//:gtest_main", |
| 586 |
], |
| 587 |
) |
| 588 |
|
| 589 |
cc_test( |
| 590 |
name = "test_table", |
| 591 |
srcs = ["upb/test_table.cc"], |
| 592 |
copts = UPB_DEFAULT_CPPOPTS, |
| 593 |
deps = [ |
| 594 |
"//:port", |
| 595 |
"//:table", |
| 596 |
"//:upb", |
| 597 |
"@com_google_googletest//:gtest_main", |
| 598 |
], |
| 599 |
) |
| 600 |
|
| 601 |
upb_proto_library( |
| 602 |
name = "conformance_proto_upb", |
| 603 |
testonly = 1, |
| 604 |
deps = ["@com_google_protobuf//conformance:conformance_proto"], |
| 605 |
) |
| 606 |
|
| 607 |
upb_proto_reflection_library( |
| 608 |
name = "conformance_proto_upbdefs", |
| 609 |
testonly = 1, |
| 610 |
deps = ["@com_google_protobuf//conformance:conformance_proto"], |
| 611 |
) |
| 612 |
|
| 613 |
upb_proto_reflection_library( |
| 614 |
name = "test_messages_proto2_upbdefs", |
| 615 |
testonly = 1, |
| 616 |
deps = ["@com_google_protobuf//:test_messages_proto2_proto"], |
| 617 |
) |
| 618 |
|
| 619 |
upb_proto_reflection_library( |
| 620 |
name = "test_messages_proto3_upbdefs", |
| 621 |
testonly = 1, |
| 622 |
deps = ["@com_google_protobuf//:test_messages_proto3_proto"], |
| 623 |
) |
| 624 |
|
| 625 |
cc_binary( |
| 626 |
name = "conformance_upb", |
| 627 |
testonly = 1, |
| 628 |
srcs = ["upb/conformance_upb.c"], |
| 629 |
copts = UPB_DEFAULT_COPTS, |
| 630 |
data = ["upb/conformance_upb_failures.txt"], |
| 631 |
deps = [ |
| 632 |
":conformance_proto_upb", |
| 633 |
":conformance_proto_upbdefs", |
| 634 |
":test_messages_proto2_upbdefs", |
| 635 |
":test_messages_proto3_upbdefs", |
| 636 |
"//:json", |
| 637 |
"//:port", |
| 638 |
"//:reflection", |
| 639 |
"//:textformat", |
| 640 |
"//:upb", |
| 641 |
], |
| 642 |
) |
| 643 |
|
| 644 |
make_shell_script( |
| 645 |
name = "gen_test_conformance_upb", |
| 646 |
out = "test_conformance_upb.sh", |
| 647 |
contents = "external/com_google_protobuf/conformance/conformance_test_runner " + |
| 648 |
" --enforce_recommended " + |
| 649 |
" --failure_list ./upb/conformance_upb_failures.txt" + |
| 650 |
" ./conformance_upb", |
| 651 |
) |
| 652 |
|
| 653 |
sh_test( |
| 654 |
name = "test_conformance_upb", |
| 655 |
srcs = ["test_conformance_upb.sh"], |
| 656 |
data = [ |
| 657 |
"upb/conformance_upb_failures.txt", |
| 658 |
":conformance_upb", |
| 659 |
"@com_google_protobuf//conformance:conformance_test_runner", |
| 660 |
], |
| 661 |
deps = ["@bazel_tools//tools/bash/runfiles"], |
| 662 |
) |
| 663 |
|
| 664 |
cc_binary( |
| 665 |
name = "conformance_upb_dynamic_minitable", |
| 666 |
testonly = 1, |
| 667 |
srcs = ["upb/conformance_upb.c"], |
| 668 |
copts = UPB_DEFAULT_COPTS + [ |
| 669 |
"-DREBUILD_MINITABLES", |
| 670 |
], |
| 671 |
data = ["upb/conformance_upb_failures.txt"], |
| 672 |
deps = [ |
| 673 |
":conformance_proto_upb", |
| 674 |
":conformance_proto_upbdefs", |
| 675 |
":test_messages_proto2_upbdefs", |
| 676 |
":test_messages_proto3_upbdefs", |
| 677 |
"//:json", |
| 678 |
"//:port", |
| 679 |
"//:reflection", |
| 680 |
"//:textformat", |
| 681 |
"//:upb", |
| 682 |
], |
| 683 |
) |
| 684 |
|
| 685 |
make_shell_script( |
| 686 |
name = "gen_test_conformance_upb_dynamic_minitable", |
| 687 |
out = "test_conformance_upb_dynamic_minitable.sh", |
| 688 |
contents = "external/com_google_protobuf/conformance/conformance_test_runner " + |
| 689 |
" --enforce_recommended " + |
| 690 |
" --failure_list ./upb/conformance_upb_failures.txt" + |
| 691 |
" ./conformance_upb_dynamic_minitable", |
| 692 |
) |
| 693 |
|
| 694 |
sh_test( |
| 695 |
name = "test_conformance_upb_dynamic_minitable", |
| 696 |
srcs = ["test_conformance_upb_dynamic_minitable.sh"], |
| 697 |
data = [ |
| 698 |
"upb/conformance_upb_failures.txt", |
| 699 |
":conformance_upb_dynamic_minitable", |
| 700 |
"@com_google_protobuf//conformance:conformance_test_runner", |
| 701 |
], |
| 702 |
deps = ["@bazel_tools//tools/bash/runfiles"], |
| 703 |
) |
| 704 |
|
| 705 |
# Internal C/C++ libraries ##################################################### |
| 706 |
|
| 707 |
cc_library( |
| 708 |
name = "table", |
| 709 |
hdrs = [ |
| 710 |
"upb/arena.h", |
| 711 |
"upb/internal/table.h", |
| 712 |
"upb/status.h", |
| 713 |
"upb/table_internal.h", |
| 714 |
"upb/upb.h", |
| 715 |
], |
| 716 |
visibility = [ |
| 717 |
"//python:__pkg__", |
| 718 |
"//tests:__pkg__", |
| 719 |
], |
| 720 |
deps = [ |
| 721 |
":port", |
| 722 |
], |
| 723 |
) |
| 724 |
|
| 725 |
# Amalgamation ################################################################# |
| 726 |
|
| 727 |
# begin:github_only |
| 728 |
|
| 729 |
upb_amalgamation( |
| 730 |
name = "gen_amalgamation", |
| 731 |
outs = [ |
| 732 |
"upb.c", |
| 733 |
"upb.h", |
| 734 |
], |
| 735 |
libs = [ |
| 736 |
":collections", |
| 737 |
":descriptor_upb_proto", |
| 738 |
":extension_registry", |
| 739 |
":fastdecode", |
| 740 |
":mini_table", |
| 741 |
":port", |
| 742 |
":reflection", |
| 743 |
":upb", |
| 744 |
], |
| 745 |
) |
| 746 |
|
| 747 |
cc_library( |
| 748 |
name = "amalgamation", |
| 749 |
srcs = ["upb.c"], |
| 750 |
hdrs = ["upb.h"], |
| 751 |
copts = UPB_DEFAULT_COPTS, |
| 752 |
deps = ["//third_party/utf8_range"], |
| 753 |
) |
| 754 |
|
| 755 |
upb_amalgamation( |
| 756 |
name = "gen_php_amalgamation", |
| 757 |
outs = [ |
| 758 |
"php-upb.c", |
| 759 |
"php-upb.h", |
| 760 |
], |
| 761 |
libs = [ |
| 762 |
":collections", |
| 763 |
":descriptor_upb_proto", |
| 764 |
":descriptor_upb_proto_reflection", |
| 765 |
":extension_registry", |
| 766 |
":fastdecode", |
| 767 |
":json", |
| 768 |
":mini_table", |
| 769 |
":port", |
| 770 |
":reflection", |
| 771 |
":upb", |
| 772 |
], |
| 773 |
prefix = "php-", |
| 774 |
) |
| 775 |
|
| 776 |
cc_library( |
| 777 |
name = "php_amalgamation", |
| 778 |
srcs = ["php-upb.c"], |
| 779 |
hdrs = ["php-upb.h"], |
| 780 |
copts = UPB_DEFAULT_COPTS, |
| 781 |
deps = ["//third_party/utf8_range"], |
| 782 |
) |
| 783 |
|
| 784 |
upb_amalgamation( |
| 785 |
name = "gen_ruby_amalgamation", |
| 786 |
outs = [ |
| 787 |
"ruby-upb.c", |
| 788 |
"ruby-upb.h", |
| 789 |
], |
| 790 |
libs = [ |
| 791 |
":collections", |
| 792 |
":descriptor_upb_proto", |
| 793 |
":extension_registry", |
| 794 |
":fastdecode", |
| 795 |
":json", |
| 796 |
":mini_table", |
| 797 |
":port", |
| 798 |
":reflection", |
| 799 |
":upb", |
| 800 |
], |
| 801 |
prefix = "ruby-", |
| 802 |
) |
| 803 |
|
| 804 |
cc_library( |
| 805 |
name = "ruby_amalgamation", |
| 806 |
srcs = ["ruby-upb.c"], |
| 807 |
hdrs = ["ruby-upb.h"], |
| 808 |
copts = UPB_DEFAULT_COPTS, |
| 809 |
deps = ["//third_party/utf8_range"], |
| 810 |
) |
| 811 |
|
| 812 |
exports_files( |
| 813 |
[ |
| 814 |
"third_party/lunit/console.lua", |
| 815 |
"third_party/lunit/lunit.lua", |
| 816 |
], |
| 817 |
visibility = ["//upb/bindings/lua:__pkg__"], |
| 818 |
) |
| 819 |
|
| 820 |
filegroup( |
| 821 |
name = "cmake_files", |
| 822 |
srcs = glob([ |
| 823 |
"upbc/**/*", |
| 824 |
"upb/**/*", |
| 825 |
"third_party/**/*", |
| 826 |
]), |
| 827 |
visibility = ["//cmake:__pkg__"], |
| 828 |
) |
| 829 |
|
| 830 |
# end:github_only |
| 831 |
|
| 832 |
# begin:google_only |
| 833 |
# |
| 834 |
# py_binary( |
| 835 |
# name = "update_check_runs", |
| 836 |
# srcs = ["update_check_runs.py"], |
| 837 |
# main = "update_check_runs.py", |
| 838 |
# deps = [ |
| 839 |
# "//third_party/py/absl:app", |
| 840 |
# ], |
| 841 |
# ) |
| 842 |
# |
| 843 |
# end:google_only |