kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/common/BUILD (about) 1 load("//:visibility.bzl", "PUBLIC_VISIBILITY") 2 3 package( 4 default_visibility = ["//kythe:default_visibility"], 5 features = ["layering_check"], 6 ) 7 8 licenses(["notice"]) 9 10 cc_library( 11 name = "re2_flag", 12 srcs = ["re2_flag.cc"], 13 hdrs = ["re2_flag.h"], 14 deps = [ 15 "@com_google_absl//absl/flags:flag", 16 "@com_google_absl//absl/strings", 17 "@com_googlesource_code_re2//:re2", 18 ], 19 ) 20 21 cc_library( 22 name = "scope_guard", 23 hdrs = ["scope_guard.h"], 24 deps = [ 25 "@com_google_absl//absl/base", 26 "@com_google_absl//absl/log:check", 27 ], 28 ) 29 30 cc_test( 31 name = "scope_guard_test", 32 srcs = ["scope_guard_test.cc"], 33 deps = [ 34 ":scope_guard", 35 "//third_party:gtest", 36 "//third_party:gtest_main", 37 ], 38 ) 39 40 cc_library( 41 name = "json_proto", 42 srcs = [ 43 "json_proto.cc", 44 ], 45 hdrs = [ 46 "json_proto.h", 47 ], 48 copts = [ 49 "-Wno-non-virtual-dtor", 50 "-Wno-unused-variable", 51 "-Wno-implicit-fallthrough", 52 ], 53 features = [ 54 "-layering_check", # TODO: protocolbuffers/protobuf#10889 55 ], 56 visibility = [PUBLIC_VISIBILITY], 57 deps = [ 58 "@com_google_absl//absl/log", 59 "@com_google_absl//absl/log:check", 60 "@com_google_absl//absl/status", 61 "@com_google_absl//absl/status:statusor", 62 "@com_google_absl//absl/strings", 63 "@com_google_protobuf//:protobuf", 64 "@com_google_protobuf//src/google/protobuf/io", 65 ], 66 ) 67 68 cc_library( 69 name = "kythe_uri", 70 srcs = ["kythe_uri.cc"], 71 hdrs = ["kythe_uri.h"], 72 visibility = [PUBLIC_VISIBILITY], 73 deps = [ 74 ":path_utils", 75 ":vname_ordering", 76 "//kythe/proto:storage_cc_proto", 77 "@com_google_absl//absl/strings", 78 ], 79 ) 80 81 cc_library( 82 name = "path_utils", 83 srcs = ["path_utils.cc"], 84 hdrs = ["path_utils.h"], 85 visibility = [PUBLIC_VISIBILITY], 86 deps = [ 87 ":common_status", 88 ":regex", 89 "@com_google_absl//absl/algorithm:container", 90 "@com_google_absl//absl/container:flat_hash_map", 91 "@com_google_absl//absl/log", 92 "@com_google_absl//absl/memory", 93 "@com_google_absl//absl/status", 94 "@com_google_absl//absl/status:statusor", 95 "@com_google_absl//absl/strings", 96 "@com_google_absl//absl/synchronization", 97 "@com_google_absl//absl/types:span", 98 ], 99 ) 100 101 cc_test( 102 name = "path_utils_test", 103 srcs = ["path_utils_test.cc"], 104 deps = [ 105 ":path_utils", 106 ":regex", 107 "//third_party:gtest", 108 "//third_party:gtest_main", 109 "@com_google_absl//absl/log:check", 110 "@com_google_absl//absl/status", 111 "@com_google_absl//absl/status:statusor", 112 ], 113 ) 114 115 cc_library( 116 name = "file_utils", 117 srcs = ["file_utils.cc"], 118 hdrs = ["file_utils.h"], 119 deps = [ 120 "@com_google_absl//absl/log:check", 121 ], 122 ) 123 124 cc_library( 125 name = "vname_ordering", 126 hdrs = ["vname_ordering.h"], 127 visibility = [PUBLIC_VISIBILITY], 128 deps = [ 129 "//kythe/proto:storage_cc_proto", 130 ], 131 ) 132 133 cc_library( 134 name = "lib", 135 srcs = [ 136 "kythe_metadata_file.cc", 137 "protobuf_metadata_file.cc", 138 ], 139 hdrs = [ 140 "kythe_metadata_file.h", 141 "protobuf_metadata_file.h", 142 "vname_ordering.h", 143 ], 144 copts = [ 145 "-Wno-non-virtual-dtor", 146 "-Wno-unused-variable", 147 "-Wno-implicit-fallthrough", 148 ], 149 features = [ 150 "-layering_check", # TODO: protocolbuffers/protobuf#10889 151 ], 152 visibility = [PUBLIC_VISIBILITY], 153 deps = [ 154 ":file_vname_generator", 155 ":json_proto", 156 "//external:zlib", 157 "//kythe/cxx/common/schema:edges", 158 "//kythe/proto:analysis_cc_proto", 159 "//kythe/proto:metadata_cc_proto", 160 "//kythe/proto:storage_cc_proto", 161 "@com_google_absl//absl/base", 162 "@com_google_absl//absl/log", 163 "@com_google_absl//absl/memory", 164 "@com_google_absl//absl/strings", 165 "@com_google_protobuf//:protobuf", 166 "@com_google_protobuf//src/google/protobuf/io", 167 "@com_googlesource_code_re2//:re2", 168 ], 169 ) 170 171 cc_library( 172 name = "net_client", 173 srcs = [ 174 "net_client.cc", 175 ], 176 hdrs = [ 177 "net_client.h", 178 ], 179 copts = [ 180 "-Wno-non-virtual-dtor", 181 "-Wno-unused-variable", 182 "-Wno-implicit-fallthrough", 183 ], 184 features = [ 185 "-layering_check", # TODO: protocolbuffers/protobuf#10889 186 ], 187 deps = [ 188 ":json_proto", 189 ":lib", 190 "//external:zlib", 191 "//kythe/proto:graph_cc_proto", 192 "//kythe/proto:storage_cc_proto", 193 "//kythe/proto:xref_cc_proto", 194 "@com_github_tencent_rapidjson//:rapidjson", 195 "@com_google_absl//absl/log", 196 "@com_google_absl//absl/log:check", 197 "@com_google_protobuf//:protobuf", 198 "@com_google_protobuf//src/google/protobuf/io", 199 "@se_haxx_curl//:curl", 200 ], 201 ) 202 203 cc_library( 204 name = "file_vname_generator", 205 srcs = ["file_vname_generator.cc"], 206 hdrs = ["file_vname_generator.h"], 207 deps = [ 208 ":json_proto", 209 "//kythe/proto:storage_cc_proto", 210 "//kythe/proto:vnames_config_cc_proto", 211 "@com_google_absl//absl/log", 212 "@com_google_absl//absl/status", 213 "@com_google_absl//absl/status:statusor", 214 "@com_google_absl//absl/strings", 215 "@com_google_protobuf//src/google/protobuf/io", 216 "@com_googlesource_code_re2//:re2", 217 ], 218 ) 219 220 cc_test( 221 name = "file_vname_generator_test", 222 size = "small", 223 srcs = [ 224 "file_vname_generator_test.cc", 225 ], 226 features = [ 227 "-layering_check", # TODO: protocolbuffers/protobuf#10889 228 ], 229 deps = [ 230 ":file_vname_generator", 231 "//third_party:gtest", 232 "@com_github_inazarenko_protobuf_matchers//protobuf-matchers", 233 "@com_google_protobuf//:protobuf", 234 "@com_googlesource_code_re2//:re2", 235 ], 236 ) 237 238 cc_library( 239 name = "json_proto_testlib", 240 testonly = 1, 241 srcs = [ 242 "json_proto_test.cc", 243 ], 244 copts = [ 245 "-Wno-non-virtual-dtor", 246 "-Wno-unused-variable", 247 "-Wno-implicit-fallthrough", 248 ], 249 features = [ 250 "-layering_check", # TODO: protocolbuffers/protobuf#10889 251 ], 252 deps = [ 253 ":json_proto", 254 "//kythe/proto:analysis_cc_proto", 255 "//third_party:gtest", 256 "@com_google_absl//absl/log:initialize", 257 "@com_google_protobuf//:protobuf", 258 "@com_googlesource_code_re2//:re2", 259 ], 260 ) 261 262 cc_test( 263 name = "json_proto_test", 264 size = "small", 265 deps = [ 266 ":json_proto_testlib", 267 "@com_google_absl//absl/log:initialize", 268 ], 269 ) 270 271 cc_library( 272 name = "net_client_testlib", 273 testonly = 1, 274 srcs = [ 275 "net_client_test.cc", 276 ], 277 copts = [ 278 "-Wno-non-virtual-dtor", 279 "-Wno-unused-variable", 280 "-Wno-implicit-fallthrough", 281 ], 282 features = [ 283 "-layering_check", # TODO: protocolbuffers/protobuf#10889 284 ], 285 deps = [ 286 ":json_proto", 287 ":net_client", 288 "//external:zlib", 289 "//kythe/proto:common_cc_proto", 290 "//kythe/proto:graph_cc_proto", 291 "@com_google_absl//absl/flags:flag", 292 "@com_google_absl//absl/flags:parse", 293 "@com_google_absl//absl/log", 294 "@com_google_absl//absl/log:check", 295 "@com_google_absl//absl/log:initialize", 296 "@com_google_absl//absl/memory", 297 "@com_google_protobuf//:protobuf", 298 ], 299 ) 300 301 cc_binary( 302 name = "net_client_test", 303 testonly = 1, 304 deps = [":net_client_testlib"], 305 ) 306 307 cc_library( 308 name = "kythe_uri_testlib", 309 testonly = 1, 310 srcs = ["kythe_uri_test.cc"], 311 copts = [ 312 "-Wno-non-virtual-dtor", 313 "-Wno-unused-variable", 314 "-Wno-implicit-fallthrough", 315 ], 316 features = [ 317 "-layering_check", # TODO: protocolbuffers/protobuf#10889 318 ], 319 deps = [ 320 ":kythe_uri", 321 ":vname_ordering", 322 "//third_party:gtest", 323 "@com_github_inazarenko_protobuf_matchers//protobuf-matchers", 324 "@com_google_absl//absl/log", 325 "@com_google_absl//absl/log:initialize", 326 "@com_google_protobuf//:protobuf", 327 ], 328 ) 329 330 cc_test( 331 name = "kythe_uri_test", 332 size = "small", 333 deps = [":kythe_uri_testlib"], 334 ) 335 336 cc_library( 337 name = "index_writer", 338 srcs = ["index_writer.cc"], 339 hdrs = ["index_writer.h"], 340 visibility = [PUBLIC_VISIBILITY], 341 deps = [ 342 "//kythe/proto:analysis_cc_proto", 343 "@com_google_absl//absl/status", 344 "@com_google_absl//absl/status:statusor", 345 "@com_google_absl//absl/strings", 346 ], 347 ) 348 349 cc_library( 350 name = "index_reader", 351 srcs = ["index_reader.cc"], 352 hdrs = ["index_reader.h"], 353 deps = [ 354 "//kythe/proto:analysis_cc_proto", 355 "@com_google_absl//absl/status", 356 "@com_google_absl//absl/status:statusor", 357 "@com_google_absl//absl/strings", 358 ], 359 ) 360 361 cc_library( 362 name = "kzip_encoding", 363 hdrs = ["kzip_encoding.h"], 364 visibility = [ 365 "//visibility:private", 366 ], 367 ) 368 369 cc_library( 370 name = "kzip_reader", 371 srcs = ["kzip_reader.cc"], 372 hdrs = ["kzip_reader.h"], 373 features = [ 374 "-layering_check", # TODO: protocolbuffers/protobuf#10889 375 ], 376 visibility = [ 377 "//visibility:public", 378 ], 379 deps = [ 380 ":index_reader", 381 ":json_proto", 382 ":kzip_encoding", 383 ":libzip/error", 384 "//kythe/proto:analysis_cc_proto", 385 "@boringssl//:crypto", 386 "@com_google_absl//absl/container:flat_hash_set", 387 "@com_google_absl//absl/log", 388 "@com_google_absl//absl/log:check", 389 "@com_google_absl//absl/memory", 390 "@com_google_absl//absl/status", 391 "@com_google_absl//absl/status:statusor", 392 "@com_google_absl//absl/strings", 393 "@com_google_protobuf//:protobuf", 394 "@com_google_protobuf//src/google/protobuf/io", 395 "@org_libzip//:zip", 396 ], 397 ) 398 399 cc_test( 400 name = "kzip_reader_test", 401 srcs = ["kzip_reader_test.cc"], 402 data = [ 403 "//kythe/testdata/platform:empty.kzip", 404 "//kythe/testdata/platform:malformed.kzip", 405 "//kythe/testdata/platform:missing-pbunit.kzip", 406 "//kythe/testdata/platform:missing-unit.kzip", 407 "//kythe/testdata/platform:stringset.kzip", 408 ], 409 deps = [ 410 ":index_reader", 411 ":kzip_reader", 412 ":libzip/error", 413 ":testutil", 414 "//kythe/proto:go_cc_proto", # Used in stringset.kzip. 415 "//third_party:gtest", 416 "//third_party:gtest_main", 417 "@com_google_absl//absl/log", 418 "@com_google_absl//absl/status", 419 "@com_google_absl//absl/status:statusor", 420 "@com_google_absl//absl/strings", 421 "@org_libzip//:zip", 422 ], 423 ) 424 425 cc_library( 426 name = "kzip_writer", 427 srcs = ["kzip_writer.cc"], 428 hdrs = ["kzip_writer.h"], 429 features = [ 430 "-layering_check", # TODO: protocolbuffers/protobuf#10889 431 ], 432 visibility = [ 433 "//visibility:public", 434 ], 435 deps = [ 436 ":index_writer", 437 ":json_proto", 438 ":kzip_encoding", 439 ":libzip/error", 440 "//kythe/proto:analysis_cc_proto", 441 "@boringssl//:crypto", 442 "@com_google_absl//absl/log", 443 "@com_google_absl//absl/log:check", 444 "@com_google_absl//absl/memory", 445 "@com_google_absl//absl/status", 446 "@com_google_absl//absl/status:statusor", 447 "@com_google_absl//absl/strings", 448 "@com_google_protobuf//:protobuf", 449 "@org_libzip//:zip", 450 ], 451 ) 452 453 cc_test( 454 name = "kzip_writer_test", 455 srcs = ["kzip_writer_test.cc"], 456 data = [ 457 "//kythe/testdata/platform:stringset.kzip", 458 ], 459 deps = [ 460 ":index_reader", 461 ":index_writer", 462 ":kzip_encoding", 463 ":kzip_reader", 464 ":kzip_writer", 465 ":libzip/error", 466 ":testutil", 467 "//kythe/proto:go_cc_proto", # Used in stringset.kzip. 468 "//third_party:gtest", 469 "//third_party:gtest_main", 470 "@com_google_absl//absl/log", 471 "@com_google_absl//absl/status", 472 "@com_google_absl//absl/status:statusor", 473 "@com_google_absl//absl/strings", 474 "@org_libzip//:zip", 475 ], 476 ) 477 478 cc_library( 479 name = "kzip_writer_c_api", 480 srcs = ["kzip_writer_c_api.cc"], 481 hdrs = ["kzip_writer_c_api.h"], 482 features = [ 483 "-layering_check", # TODO: protocolbuffers/protobuf#10889 484 ], 485 visibility = [ 486 "//visibility:public", 487 ], 488 deps = [ 489 ":index_writer", 490 ":kzip_writer", 491 "//kythe/proto:analysis_cc_proto", 492 "@com_google_absl//absl/log", 493 "@com_google_absl//absl/log:check", 494 "@com_google_absl//absl/status", 495 "@com_google_absl//absl/status:statusor", 496 "@com_google_absl//absl/strings", 497 "@com_google_protobuf//:protobuf", 498 ], 499 ) 500 501 cc_test( 502 name = "kzip_writer_c_api_test", 503 srcs = ["kzip_writer_c_api_test.cc"], 504 data = [ 505 "//kythe/testdata/platform:stringset.kzip", 506 ], 507 deps = [ 508 ":kzip_reader", 509 ":kzip_writer_c_api", 510 ":libzip/error", 511 "//kythe/proto:analysis_cc_proto", 512 "//kythe/proto:go_cc_proto", # Used in stringset.kzip. 513 "//third_party:gtest", 514 "//third_party:gtest_main", 515 "@com_google_absl//absl/log", 516 "@com_google_absl//absl/status", 517 "@com_google_absl//absl/strings", 518 "@org_libzip//:zip", 519 ], 520 ) 521 522 cc_library( 523 # Having this library be named "status" just as that of absl status 524 # affects linking this library with Rust FFI code. 525 # See for details: https://github.com/bazelbuild/rules_rust/issues/385. 526 name = "common_status", 527 srcs = ["status.cc"], 528 hdrs = ["status.h"], 529 visibility = [PUBLIC_VISIBILITY], 530 deps = [ 531 "@com_google_absl//absl/status", 532 ], 533 ) 534 535 cc_library( 536 name = "libzip/error", 537 srcs = ["libzip/error.cc"], 538 hdrs = ["libzip/error.h"], 539 deps = [ 540 ":common_status", 541 "@com_google_absl//absl/status", 542 "@org_libzip//:zip", 543 ], 544 ) 545 546 cc_library( 547 name = "testutil", 548 testonly = 1, 549 srcs = ["testutil.cc"], 550 hdrs = ["testutil.h"], 551 deps = [ 552 "@com_google_absl//absl/log:die_if_null", 553 "@com_google_absl//absl/strings", 554 ], 555 ) 556 557 cc_library( 558 name = "utf8_line_index", 559 srcs = ["utf8_line_index.cc"], 560 hdrs = ["utf8_line_index.h"], 561 visibility = [PUBLIC_VISIBILITY], 562 deps = [ 563 "@com_google_absl//absl/algorithm:container", 564 "@com_google_absl//absl/log", 565 "@com_google_absl//absl/log:check", 566 "@com_google_absl//absl/strings", 567 ], 568 ) 569 570 cc_test( 571 name = "utf8_line_index_test", 572 size = "small", 573 srcs = ["utf8_line_index_test.cc"], 574 deps = [ 575 ":utf8_line_index", 576 "//third_party:gtest", 577 "//third_party:gtest_main", 578 "@com_google_absl//absl/log", 579 "@com_google_absl//absl/log:check", 580 "@com_google_absl//absl/strings", 581 ], 582 ) 583 584 cc_library( 585 name = "init", 586 srcs = ["init.cc"], 587 hdrs = ["init.h"], 588 local_defines = ["KYTHE_OVERRIDE_ASSERT_FAIL"], 589 deps = [ 590 "@com_google_absl//absl/debugging:failure_signal_handler", 591 "@com_google_absl//absl/debugging:symbolize", 592 "@com_google_absl//absl/log", 593 "@com_google_absl//absl/log:flags", 594 "@com_google_absl//absl/log:initialize", 595 ], 596 ) 597 598 cc_library( 599 name = "regex", 600 srcs = ["regex.cc"], 601 hdrs = ["regex.h"], 602 deps = [ 603 "@com_google_absl//absl/base:no_destructor", 604 "@com_google_absl//absl/log", 605 "@com_google_absl//absl/log:check", 606 "@com_google_absl//absl/status", 607 "@com_google_absl//absl/status:statusor", 608 "@com_google_absl//absl/strings", 609 "@com_google_absl//absl/types:span", 610 "@com_googlesource_code_re2//:re2", 611 ], 612 ) 613 614 cc_test( 615 name = "regex_test", 616 srcs = ["regex_test.cc"], 617 deps = [ 618 ":regex", 619 "//third_party:gtest", 620 "//third_party:gtest_main", 621 "@com_google_absl//absl/log", 622 "@com_googlesource_code_re2//:re2", 623 ], 624 ) 625 626 cc_library( 627 name = "sha256_hasher", 628 srcs = ["sha256_hasher.cc"], 629 hdrs = ["sha256_hasher.h"], 630 deps = [ 631 "@boringssl//:crypto", 632 "@com_google_absl//absl/strings", 633 "@com_google_absl//absl/types:span", 634 ], 635 )