Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 1 | # Common libraries used in multiple Crubit tools. |
| 2 | |
| 3 | load( |
| 4 | "@rules_rust//rust:defs.bzl", |
| 5 | "rust_library", |
| 6 | "rust_test", |
| 7 | ) |
| 8 | |
Marco Poletti | 6669c69 | 2022-04-07 14:42:56 -0700 | [diff] [blame] | 9 | licenses(["notice"]) |
| 10 | |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 11 | package(default_visibility = ["//:__subpackages__"]) |
Marco Poletti | 6669c69 | 2022-04-07 14:42:56 -0700 | [diff] [blame] | 12 | |
| 13 | cc_library( |
| 14 | name = "file_io", |
| 15 | srcs = ["file_io.cc"], |
| 16 | hdrs = ["file_io.h"], |
| 17 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 18 | "@absl//absl/status:statusor", |
| 19 | "@llvm-project//llvm:Support", |
Marco Poletti | 6669c69 | 2022-04-07 14:42:56 -0700 | [diff] [blame] | 20 | ], |
| 21 | ) |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 22 | |
| 23 | cc_library( |
Googler | 0611ea7 | 2022-05-04 07:03:07 -0700 | [diff] [blame] | 24 | name = "cc_ffi_types", |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 25 | srcs = ["ffi_types.cc"], |
| 26 | hdrs = ["ffi_types.h"], |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 27 | visibility = ["//:__subpackages__"], |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 28 | deps = [ |
Googler | 0611ea7 | 2022-05-04 07:03:07 -0700 | [diff] [blame] | 29 | ":ffi_types", # buildcleaner: keep |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 30 | "@absl//absl/strings", |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 31 | ], |
| 32 | ) |
| 33 | |
| 34 | rust_library( |
Googler | 0611ea7 | 2022-05-04 07:03:07 -0700 | [diff] [blame] | 35 | name = "ffi_types", |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 36 | srcs = ["ffi_types.rs"], |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 37 | visibility = ["//:__subpackages__"], |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 38 | ) |
| 39 | |
| 40 | rust_test( |
Googler | 0611ea7 | 2022-05-04 07:03:07 -0700 | [diff] [blame] | 41 | name = "ffi_types_test", |
| 42 | crate = ":ffi_types", |
Marcel Hlopko | 65978eb | 2022-04-08 07:40:18 -0700 | [diff] [blame] | 43 | ) |
Marco Poletti | c61bcc4 | 2022-04-08 12:54:30 -0700 | [diff] [blame] | 44 | |
| 45 | cc_library( |
| 46 | name = "check", |
| 47 | hdrs = ["check.h"], |
| 48 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 49 | "@absl//absl/base:core_headers", |
| 50 | "@llvm-project//llvm:Support", |
Marco Poletti | c61bcc4 | 2022-04-08 12:54:30 -0700 | [diff] [blame] | 51 | ], |
| 52 | ) |
| 53 | |
| 54 | cc_library( |
| 55 | name = "strong_int", |
| 56 | hdrs = ["strong_int.h"], |
| 57 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 58 | "@absl//absl/base:core_headers", |
| 59 | "@absl//absl/meta:type_traits", |
Marco Poletti | c61bcc4 | 2022-04-08 12:54:30 -0700 | [diff] [blame] | 60 | ], |
| 61 | ) |
| 62 | |
| 63 | cc_library( |
| 64 | name = "string_type", |
| 65 | hdrs = ["string_type.h"], |
| 66 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 67 | "@absl//absl/container:flat_hash_set", |
| 68 | "@absl//absl/flags:marshalling", |
| 69 | "@absl//absl/meta:type_traits", |
| 70 | "@absl//absl/strings", |
Marco Poletti | c61bcc4 | 2022-04-08 12:54:30 -0700 | [diff] [blame] | 71 | ], |
| 72 | ) |
| 73 | |
| 74 | cc_library( |
| 75 | name = "status_macros", |
| 76 | hdrs = ["status_macros.h"], |
| 77 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 78 | "@absl//absl/base:core_headers", |
| 79 | "@absl//absl/status", |
| 80 | "@absl//absl/status:statusor", |
Marco Poletti | c61bcc4 | 2022-04-08 12:54:30 -0700 | [diff] [blame] | 81 | ], |
| 82 | ) |
Marcel Hlopko | 7f14b4c | 2022-04-13 00:54:45 -0700 | [diff] [blame] | 83 | |
| 84 | rust_library( |
| 85 | name = "token_stream_printer", |
| 86 | srcs = ["token_stream_printer.rs"], |
| 87 | data = [ |
Marcel Hlopko | 7f14b4c | 2022-04-13 00:54:45 -0700 | [diff] [blame] | 88 | ], |
| 89 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 90 | "@crate_index//:anyhow", |
| 91 | "@crate_index//:proc-macro2", |
Marcel Hlopko | 7f14b4c | 2022-04-13 00:54:45 -0700 | [diff] [blame] | 92 | ], |
| 93 | ) |
| 94 | |
| 95 | rust_test( |
| 96 | name = "token_stream_printer_test", |
| 97 | crate = ":token_stream_printer", |
| 98 | data = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 99 | "//nowhere:rustfmt.toml", |
| 100 | "//third_party/unsupported_toolchains/rust/toolchains/nightly:bin/rustfmt", |
Marcel Hlopko | 7f14b4c | 2022-04-13 00:54:45 -0700 | [diff] [blame] | 101 | ], |
| 102 | deps = [ |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 103 | "@crate_index//:quote", |
Marcel Hlopko | 7f14b4c | 2022-04-13 00:54:45 -0700 | [diff] [blame] | 104 | ], |
| 105 | ) |
Marcel Hlopko | 3951285 | 2022-05-09 02:22:00 -0700 | [diff] [blame] | 106 | |
| 107 | cc_library( |
| 108 | name = "test_utils", |
| 109 | testonly = True, |
| 110 | srcs = ["test_utils.cc"], |
| 111 | hdrs = ["test_utils.h"], |
| 112 | deps = [ |
| 113 | ":check", |
| 114 | ":file_io", |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 115 | "@absl//absl/strings", |
Luca Versari | c21d92f | 2022-05-25 00:56:30 -0700 | [diff] [blame] | 116 | "@com_google_googletest//:gtest", |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 117 | "@llvm-project//llvm:Support", |
Marcel Hlopko | 3951285 | 2022-05-09 02:22:00 -0700 | [diff] [blame] | 118 | ], |
| 119 | ) |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 120 | |
| 121 | cc_library( |
Luca Versari | c21d92f | 2022-05-25 00:56:30 -0700 | [diff] [blame] | 122 | name = "status_test_matchers", |
| 123 | testonly = True, |
| 124 | hdrs = ["status_test_matchers.h"], |
| 125 | deps = [ |
| 126 | "@absl//absl/status", |
| 127 | "@absl//absl/status:statusor", |
| 128 | "@com_google_googletest//:gtest", |
| 129 | ], |
| 130 | ) |
| 131 | |
| 132 | cc_library( |
Googler | 75c7ad0 | 2022-05-23 13:27:49 -0700 | [diff] [blame] | 133 | name = "rust_allocator_shims", |
| 134 | srcs = ["rust_allocator_shims.c"], |
| 135 | ) |