1# 2# Copyright 2017 The Abseil Authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 17load( 18 "//absl:copts/configure_copts.bzl", 19 "ABSL_DEFAULT_COPTS", 20 "ABSL_TEST_COPTS", 21) 22 23package( 24 default_visibility = ["//visibility:public"], 25 features = ["parse_headers"], 26) 27 28licenses(["notice"]) 29 30cc_library( 31 name = "strings", 32 srcs = [ 33 "ascii.cc", 34 "charconv.cc", 35 "escaping.cc", 36 "internal/charconv_bigint.cc", 37 "internal/charconv_bigint.h", 38 "internal/charconv_parse.cc", 39 "internal/charconv_parse.h", 40 "internal/memutil.cc", 41 "internal/memutil.h", 42 "internal/stl_type_traits.h", 43 "internal/str_join_internal.h", 44 "internal/str_split_internal.h", 45 "match.cc", 46 "numbers.cc", 47 "str_cat.cc", 48 "str_replace.cc", 49 "str_split.cc", 50 "string_view.cc", 51 "substitute.cc", 52 ], 53 hdrs = [ 54 "ascii.h", 55 "charconv.h", 56 "escaping.h", 57 "match.h", 58 "numbers.h", 59 "str_cat.h", 60 "str_join.h", 61 "str_replace.h", 62 "str_split.h", 63 "string_view.h", 64 "strip.h", 65 "substitute.h", 66 ], 67 copts = ABSL_DEFAULT_COPTS, 68 deps = [ 69 ":internal", 70 "//absl/base", 71 "//absl/base:bits", 72 "//absl/base:config", 73 "//absl/base:core_headers", 74 "//absl/base:endian", 75 "//absl/base:raw_logging_internal", 76 "//absl/base:throw_delegate", 77 "//absl/memory", 78 "//absl/meta:type_traits", 79 "//absl/numeric:int128", 80 ], 81) 82 83cc_library( 84 name = "internal", 85 srcs = [ 86 "internal/escaping.cc", 87 "internal/ostringstream.cc", 88 "internal/utf8.cc", 89 ], 90 hdrs = [ 91 "internal/char_map.h", 92 "internal/escaping.h", 93 "internal/ostringstream.h", 94 "internal/resize_uninitialized.h", 95 "internal/utf8.h", 96 ], 97 copts = ABSL_DEFAULT_COPTS, 98 deps = [ 99 "//absl/base:config", 100 "//absl/base:core_headers", 101 "//absl/base:endian", 102 "//absl/base:raw_logging_internal", 103 "//absl/meta:type_traits", 104 ], 105) 106 107cc_test( 108 name = "match_test", 109 size = "small", 110 srcs = ["match_test.cc"], 111 copts = ABSL_TEST_COPTS, 112 visibility = ["//visibility:private"], 113 deps = [ 114 ":strings", 115 "@com_google_googletest//:gtest_main", 116 ], 117) 118 119cc_test( 120 name = "escaping_test", 121 size = "small", 122 srcs = [ 123 "escaping_test.cc", 124 "internal/escaping_test_common.h", 125 ], 126 copts = ABSL_TEST_COPTS, 127 visibility = ["//visibility:private"], 128 deps = [ 129 ":cord", 130 ":strings", 131 "//absl/base:core_headers", 132 "//absl/container:fixed_array", 133 "@com_google_googletest//:gtest_main", 134 ], 135) 136 137cc_test( 138 name = "escaping_benchmark", 139 srcs = [ 140 "escaping_benchmark.cc", 141 "internal/escaping_test_common.h", 142 ], 143 copts = ABSL_TEST_COPTS, 144 tags = ["benchmark"], 145 visibility = ["//visibility:private"], 146 deps = [ 147 ":strings", 148 "//absl/base:raw_logging_internal", 149 "@com_github_google_benchmark//:benchmark_main", 150 ], 151) 152 153cc_test( 154 name = "ascii_test", 155 size = "small", 156 srcs = ["ascii_test.cc"], 157 copts = ABSL_TEST_COPTS, 158 visibility = ["//visibility:private"], 159 deps = [ 160 ":strings", 161 "//absl/base:core_headers", 162 "@com_google_googletest//:gtest_main", 163 ], 164) 165 166cc_test( 167 name = "ascii_benchmark", 168 srcs = ["ascii_benchmark.cc"], 169 copts = ABSL_TEST_COPTS, 170 tags = ["benchmark"], 171 visibility = ["//visibility:private"], 172 deps = [ 173 ":strings", 174 "@com_github_google_benchmark//:benchmark_main", 175 ], 176) 177 178cc_test( 179 name = "memutil_benchmark", 180 srcs = [ 181 "internal/memutil.h", 182 "internal/memutil_benchmark.cc", 183 ], 184 copts = ABSL_TEST_COPTS, 185 tags = ["benchmark"], 186 visibility = ["//visibility:private"], 187 deps = [ 188 ":strings", 189 "//absl/base:core_headers", 190 "@com_github_google_benchmark//:benchmark_main", 191 ], 192) 193 194cc_test( 195 name = "memutil_test", 196 size = "small", 197 srcs = [ 198 "internal/memutil.h", 199 "internal/memutil_test.cc", 200 ], 201 copts = ABSL_TEST_COPTS, 202 visibility = ["//visibility:private"], 203 deps = [ 204 ":strings", 205 "//absl/base:core_headers", 206 "@com_google_googletest//:gtest_main", 207 ], 208) 209 210cc_test( 211 name = "utf8_test", 212 size = "small", 213 srcs = [ 214 "internal/utf8_test.cc", 215 ], 216 copts = ABSL_TEST_COPTS, 217 visibility = ["//visibility:private"], 218 deps = [ 219 ":internal", 220 "//absl/base:core_headers", 221 "@com_google_googletest//:gtest_main", 222 ], 223) 224 225cc_test( 226 name = "string_view_benchmark", 227 srcs = ["string_view_benchmark.cc"], 228 copts = ABSL_TEST_COPTS, 229 tags = ["benchmark"], 230 visibility = ["//visibility:private"], 231 deps = [ 232 ":strings", 233 "//absl/base:core_headers", 234 "//absl/base:raw_logging_internal", 235 "@com_github_google_benchmark//:benchmark_main", 236 ], 237) 238 239cc_test( 240 name = "string_view_test", 241 size = "small", 242 srcs = ["string_view_test.cc"], 243 copts = ABSL_TEST_COPTS, 244 visibility = ["//visibility:private"], 245 deps = [ 246 ":strings", 247 "//absl/base:config", 248 "//absl/base:core_headers", 249 "//absl/base:dynamic_annotations", 250 "@com_google_googletest//:gtest_main", 251 ], 252) 253 254cc_library( 255 name = "cord_internal", 256 hdrs = ["internal/cord_internal.h"], 257 copts = ABSL_DEFAULT_COPTS, 258 visibility = ["//visibility:private"], 259 deps = [ 260 ":strings", 261 "//absl/meta:type_traits", 262 ], 263) 264 265cc_library( 266 name = "cord", 267 srcs = [ 268 "cord.cc", 269 ], 270 hdrs = [ 271 "cord.h", 272 ], 273 copts = ABSL_DEFAULT_COPTS, 274 deps = [ 275 ":cord_internal", 276 ":internal", 277 ":str_format", 278 ":strings", 279 "//absl/base", 280 "//absl/base:base_internal", 281 "//absl/base:core_headers", 282 "//absl/base:endian", 283 "//absl/base:raw_logging_internal", 284 "//absl/container:fixed_array", 285 "//absl/container:inlined_vector", 286 "//absl/functional:function_ref", 287 "//absl/meta:type_traits", 288 ], 289) 290 291cc_library( 292 name = "cord_test_helpers", 293 testonly = 1, 294 hdrs = [ 295 "cord_test_helpers.h", 296 ], 297 copts = ABSL_DEFAULT_COPTS, 298 deps = [ 299 ":cord", 300 ], 301) 302 303cc_test( 304 name = "cord_test", 305 size = "medium", 306 srcs = ["cord_test.cc"], 307 copts = ABSL_TEST_COPTS, 308 visibility = ["//visibility:private"], 309 deps = [ 310 ":cord", 311 ":cord_test_helpers", 312 ":strings", 313 "//absl/base", 314 "//absl/base:config", 315 "//absl/base:endian", 316 "//absl/base:raw_logging_internal", 317 "//absl/container:fixed_array", 318 "@com_google_googletest//:gtest_main", 319 ], 320) 321 322cc_test( 323 name = "substitute_test", 324 size = "small", 325 srcs = ["substitute_test.cc"], 326 copts = ABSL_TEST_COPTS, 327 visibility = ["//visibility:private"], 328 deps = [ 329 ":strings", 330 "//absl/base:core_headers", 331 "@com_google_googletest//:gtest_main", 332 ], 333) 334 335cc_test( 336 name = "str_replace_benchmark", 337 srcs = ["str_replace_benchmark.cc"], 338 copts = ABSL_TEST_COPTS, 339 tags = ["benchmark"], 340 visibility = ["//visibility:private"], 341 deps = [ 342 ":strings", 343 "//absl/base:raw_logging_internal", 344 "@com_github_google_benchmark//:benchmark_main", 345 ], 346) 347 348cc_test( 349 name = "str_replace_test", 350 size = "small", 351 srcs = ["str_replace_test.cc"], 352 copts = ABSL_TEST_COPTS, 353 visibility = ["//visibility:private"], 354 deps = [ 355 ":strings", 356 "@com_google_googletest//:gtest_main", 357 ], 358) 359 360cc_test( 361 name = "str_split_test", 362 srcs = ["str_split_test.cc"], 363 copts = ABSL_TEST_COPTS, 364 visibility = ["//visibility:private"], 365 deps = [ 366 ":strings", 367 "//absl/base:core_headers", 368 "//absl/base:dynamic_annotations", 369 "@com_google_googletest//:gtest_main", 370 ], 371) 372 373cc_test( 374 name = "str_split_benchmark", 375 srcs = ["str_split_benchmark.cc"], 376 copts = ABSL_TEST_COPTS, 377 tags = ["benchmark"], 378 visibility = ["//visibility:private"], 379 deps = [ 380 ":strings", 381 "//absl/base:raw_logging_internal", 382 "@com_github_google_benchmark//:benchmark_main", 383 ], 384) 385 386cc_test( 387 name = "ostringstream_test", 388 size = "small", 389 srcs = ["internal/ostringstream_test.cc"], 390 copts = ABSL_TEST_COPTS, 391 visibility = ["//visibility:private"], 392 deps = [ 393 ":internal", 394 "@com_google_googletest//:gtest_main", 395 ], 396) 397 398cc_test( 399 name = "ostringstream_benchmark", 400 srcs = ["internal/ostringstream_benchmark.cc"], 401 copts = ABSL_TEST_COPTS, 402 tags = ["benchmark"], 403 visibility = ["//visibility:private"], 404 deps = [ 405 ":internal", 406 "@com_github_google_benchmark//:benchmark_main", 407 ], 408) 409 410cc_test( 411 name = "resize_uninitialized_test", 412 size = "small", 413 srcs = [ 414 "internal/resize_uninitialized.h", 415 "internal/resize_uninitialized_test.cc", 416 ], 417 copts = ABSL_TEST_COPTS, 418 visibility = ["//visibility:private"], 419 deps = [ 420 "//absl/base:core_headers", 421 "//absl/meta:type_traits", 422 "@com_google_googletest//:gtest_main", 423 ], 424) 425 426cc_test( 427 name = "str_join_test", 428 size = "small", 429 srcs = ["str_join_test.cc"], 430 copts = ABSL_TEST_COPTS, 431 visibility = ["//visibility:private"], 432 deps = [ 433 ":strings", 434 "//absl/base:core_headers", 435 "//absl/memory", 436 "@com_google_googletest//:gtest_main", 437 ], 438) 439 440cc_test( 441 name = "str_join_benchmark", 442 srcs = ["str_join_benchmark.cc"], 443 copts = ABSL_TEST_COPTS, 444 tags = ["benchmark"], 445 visibility = ["//visibility:private"], 446 deps = [ 447 ":strings", 448 "@com_github_google_benchmark//:benchmark_main", 449 ], 450) 451 452cc_test( 453 name = "str_cat_test", 454 size = "small", 455 srcs = ["str_cat_test.cc"], 456 copts = ABSL_TEST_COPTS, 457 visibility = ["//visibility:private"], 458 deps = [ 459 ":strings", 460 "//absl/base:core_headers", 461 "@com_google_googletest//:gtest_main", 462 ], 463) 464 465cc_test( 466 name = "str_cat_benchmark", 467 srcs = ["str_cat_benchmark.cc"], 468 copts = ABSL_TEST_COPTS, 469 tags = ["benchmark"], 470 visibility = ["//visibility:private"], 471 deps = [ 472 ":strings", 473 "@com_github_google_benchmark//:benchmark_main", 474 ], 475) 476 477cc_test( 478 name = "numbers_test", 479 size = "medium", 480 srcs = [ 481 "internal/numbers_test_common.h", 482 "numbers_test.cc", 483 ], 484 copts = ABSL_TEST_COPTS, 485 visibility = ["//visibility:private"], 486 deps = [ 487 ":pow10_helper", 488 ":strings", 489 "//absl/base:config", 490 "//absl/base:raw_logging_internal", 491 "//absl/random", 492 "//absl/random:distributions", 493 "@com_google_googletest//:gtest_main", 494 ], 495) 496 497cc_test( 498 name = "numbers_benchmark", 499 srcs = ["numbers_benchmark.cc"], 500 copts = ABSL_TEST_COPTS, 501 tags = ["benchmark"], 502 visibility = ["//visibility:private"], 503 deps = [ 504 ":strings", 505 "//absl/base:raw_logging_internal", 506 "//absl/random", 507 "//absl/random:distributions", 508 "@com_github_google_benchmark//:benchmark_main", 509 ], 510) 511 512cc_test( 513 name = "strip_test", 514 size = "small", 515 srcs = ["strip_test.cc"], 516 copts = ABSL_TEST_COPTS, 517 visibility = ["//visibility:private"], 518 deps = [ 519 ":strings", 520 "@com_google_googletest//:gtest_main", 521 ], 522) 523 524cc_test( 525 name = "char_map_test", 526 srcs = ["internal/char_map_test.cc"], 527 copts = ABSL_TEST_COPTS, 528 deps = [ 529 ":internal", 530 "@com_google_googletest//:gtest_main", 531 ], 532) 533 534cc_test( 535 name = "char_map_benchmark", 536 srcs = ["internal/char_map_benchmark.cc"], 537 copts = ABSL_TEST_COPTS, 538 tags = ["benchmark"], 539 deps = [ 540 ":internal", 541 "@com_github_google_benchmark//:benchmark_main", 542 ], 543) 544 545cc_test( 546 name = "charconv_test", 547 srcs = ["charconv_test.cc"], 548 copts = ABSL_TEST_COPTS, 549 deps = [ 550 ":pow10_helper", 551 ":str_format", 552 ":strings", 553 "@com_google_googletest//:gtest_main", 554 ], 555) 556 557cc_test( 558 name = "charconv_parse_test", 559 srcs = [ 560 "internal/charconv_parse.h", 561 "internal/charconv_parse_test.cc", 562 ], 563 copts = ABSL_TEST_COPTS, 564 deps = [ 565 ":strings", 566 "//absl/base:config", 567 "//absl/base:raw_logging_internal", 568 "@com_google_googletest//:gtest_main", 569 ], 570) 571 572cc_test( 573 name = "charconv_bigint_test", 574 srcs = [ 575 "internal/charconv_bigint.h", 576 "internal/charconv_bigint_test.cc", 577 "internal/charconv_parse.h", 578 ], 579 copts = ABSL_TEST_COPTS, 580 deps = [ 581 ":strings", 582 "//absl/base:config", 583 "@com_google_googletest//:gtest_main", 584 ], 585) 586 587cc_test( 588 name = "charconv_benchmark", 589 srcs = [ 590 "charconv_benchmark.cc", 591 ], 592 tags = [ 593 "benchmark", 594 ], 595 deps = [ 596 ":strings", 597 "@com_github_google_benchmark//:benchmark_main", 598 ], 599) 600 601cc_library( 602 name = "str_format", 603 hdrs = [ 604 "str_format.h", 605 ], 606 copts = ABSL_DEFAULT_COPTS, 607 deps = [ 608 ":str_format_internal", 609 ], 610) 611 612cc_library( 613 name = "str_format_internal", 614 srcs = [ 615 "internal/str_format/arg.cc", 616 "internal/str_format/bind.cc", 617 "internal/str_format/extension.cc", 618 "internal/str_format/float_conversion.cc", 619 "internal/str_format/output.cc", 620 "internal/str_format/parser.cc", 621 ], 622 hdrs = [ 623 "internal/str_format/arg.h", 624 "internal/str_format/bind.h", 625 "internal/str_format/checker.h", 626 "internal/str_format/extension.h", 627 "internal/str_format/float_conversion.h", 628 "internal/str_format/output.h", 629 "internal/str_format/parser.h", 630 ], 631 copts = ABSL_DEFAULT_COPTS, 632 visibility = ["//visibility:private"], 633 deps = [ 634 ":strings", 635 "//absl/base:config", 636 "//absl/base:core_headers", 637 "//absl/meta:type_traits", 638 "//absl/numeric:int128", 639 "//absl/types:span", 640 ], 641) 642 643cc_test( 644 name = "str_format_test", 645 srcs = ["str_format_test.cc"], 646 copts = ABSL_TEST_COPTS, 647 visibility = ["//visibility:private"], 648 deps = [ 649 ":str_format", 650 ":strings", 651 "//absl/base:core_headers", 652 "@com_google_googletest//:gtest_main", 653 ], 654) 655 656cc_test( 657 name = "str_format_extension_test", 658 srcs = [ 659 "internal/str_format/extension_test.cc", 660 ], 661 copts = ABSL_TEST_COPTS, 662 visibility = ["//visibility:private"], 663 deps = [ 664 ":str_format", 665 ":str_format_internal", 666 "@com_google_googletest//:gtest_main", 667 ], 668) 669 670cc_test( 671 name = "str_format_arg_test", 672 srcs = ["internal/str_format/arg_test.cc"], 673 copts = ABSL_TEST_COPTS, 674 visibility = ["//visibility:private"], 675 deps = [ 676 ":str_format", 677 ":str_format_internal", 678 "@com_google_googletest//:gtest_main", 679 ], 680) 681 682cc_test( 683 name = "str_format_bind_test", 684 srcs = ["internal/str_format/bind_test.cc"], 685 copts = ABSL_TEST_COPTS, 686 visibility = ["//visibility:private"], 687 deps = [ 688 ":str_format_internal", 689 "@com_google_googletest//:gtest_main", 690 ], 691) 692 693cc_test( 694 name = "str_format_checker_test", 695 srcs = ["internal/str_format/checker_test.cc"], 696 copts = ABSL_TEST_COPTS, 697 visibility = ["//visibility:private"], 698 deps = [ 699 ":str_format", 700 "@com_google_googletest//:gtest_main", 701 ], 702) 703 704cc_test( 705 name = "str_format_convert_test", 706 size = "medium", 707 srcs = ["internal/str_format/convert_test.cc"], 708 copts = ABSL_TEST_COPTS, 709 visibility = ["//visibility:private"], 710 deps = [ 711 ":str_format_internal", 712 "//absl/base:raw_logging_internal", 713 "//absl/numeric:int128", 714 "@com_google_googletest//:gtest_main", 715 ], 716) 717 718cc_test( 719 name = "str_format_output_test", 720 srcs = ["internal/str_format/output_test.cc"], 721 copts = ABSL_TEST_COPTS, 722 visibility = ["//visibility:private"], 723 deps = [ 724 ":str_format_internal", 725 "@com_google_googletest//:gtest_main", 726 ], 727) 728 729cc_test( 730 name = "str_format_parser_test", 731 srcs = ["internal/str_format/parser_test.cc"], 732 copts = ABSL_TEST_COPTS, 733 visibility = ["//visibility:private"], 734 deps = [ 735 ":str_format_internal", 736 "//absl/base:core_headers", 737 "@com_google_googletest//:gtest_main", 738 ], 739) 740 741cc_library( 742 name = "pow10_helper", 743 testonly = True, 744 srcs = ["internal/pow10_helper.cc"], 745 hdrs = ["internal/pow10_helper.h"], 746 visibility = ["//visibility:private"], 747 deps = ["//absl/base:config"], 748) 749 750cc_test( 751 name = "pow10_helper_test", 752 srcs = ["internal/pow10_helper_test.cc"], 753 copts = ABSL_TEST_COPTS, 754 visibility = ["//visibility:private"], 755 deps = [ 756 ":pow10_helper", 757 ":str_format", 758 "@com_google_googletest//:gtest_main", 759 ], 760) 761