blob: 0c15c02b121b60bb188f43c09980fec69e1fce9d [file] [log] [blame]
Marcel Hlopko65978eb2022-04-08 07:40:18 -07001# Common libraries used in multiple Crubit tools.
2
3load(
4 "@rules_rust//rust:defs.bzl",
5 "rust_library",
6 "rust_test",
7)
8
Marco Poletti6669c692022-04-07 14:42:56 -07009licenses(["notice"])
10
Googler75c7ad02022-05-23 13:27:49 -070011package(default_visibility = ["//:__subpackages__"])
Marco Poletti6669c692022-04-07 14:42:56 -070012
13cc_library(
14 name = "file_io",
15 srcs = ["file_io.cc"],
16 hdrs = ["file_io.h"],
17 deps = [
Googler75c7ad02022-05-23 13:27:49 -070018 "@absl//absl/status:statusor",
19 "@llvm-project//llvm:Support",
Marco Poletti6669c692022-04-07 14:42:56 -070020 ],
21)
Marcel Hlopko65978eb2022-04-08 07:40:18 -070022
23cc_library(
Googler0611ea72022-05-04 07:03:07 -070024 name = "cc_ffi_types",
Marcel Hlopko65978eb2022-04-08 07:40:18 -070025 srcs = ["ffi_types.cc"],
26 hdrs = ["ffi_types.h"],
Googler75c7ad02022-05-23 13:27:49 -070027 visibility = ["//:__subpackages__"],
Marcel Hlopko65978eb2022-04-08 07:40:18 -070028 deps = [
Googler0611ea72022-05-04 07:03:07 -070029 ":ffi_types", # buildcleaner: keep
Googler75c7ad02022-05-23 13:27:49 -070030 "@absl//absl/strings",
Marcel Hlopko65978eb2022-04-08 07:40:18 -070031 ],
32)
33
34rust_library(
Googler0611ea72022-05-04 07:03:07 -070035 name = "ffi_types",
Marcel Hlopko65978eb2022-04-08 07:40:18 -070036 srcs = ["ffi_types.rs"],
Googler75c7ad02022-05-23 13:27:49 -070037 visibility = ["//:__subpackages__"],
Marcel Hlopko65978eb2022-04-08 07:40:18 -070038)
39
40rust_test(
Googler0611ea72022-05-04 07:03:07 -070041 name = "ffi_types_test",
42 crate = ":ffi_types",
Marcel Hlopko65978eb2022-04-08 07:40:18 -070043)
Marco Polettic61bcc42022-04-08 12:54:30 -070044
45cc_library(
46 name = "check",
47 hdrs = ["check.h"],
48 deps = [
Googler75c7ad02022-05-23 13:27:49 -070049 "@absl//absl/base:core_headers",
50 "@llvm-project//llvm:Support",
Marco Polettic61bcc42022-04-08 12:54:30 -070051 ],
52)
53
54cc_library(
55 name = "strong_int",
56 hdrs = ["strong_int.h"],
57 deps = [
Googler75c7ad02022-05-23 13:27:49 -070058 "@absl//absl/base:core_headers",
59 "@absl//absl/meta:type_traits",
Marco Polettic61bcc42022-04-08 12:54:30 -070060 ],
61)
62
63cc_library(
64 name = "string_type",
65 hdrs = ["string_type.h"],
66 deps = [
Googler75c7ad02022-05-23 13:27:49 -070067 "@absl//absl/container:flat_hash_set",
68 "@absl//absl/flags:marshalling",
69 "@absl//absl/meta:type_traits",
70 "@absl//absl/strings",
Marco Polettic61bcc42022-04-08 12:54:30 -070071 ],
72)
73
74cc_library(
75 name = "status_macros",
76 hdrs = ["status_macros.h"],
77 deps = [
Googler75c7ad02022-05-23 13:27:49 -070078 "@absl//absl/base:core_headers",
79 "@absl//absl/status",
80 "@absl//absl/status:statusor",
Marco Polettic61bcc42022-04-08 12:54:30 -070081 ],
82)
Marcel Hlopko7f14b4c2022-04-13 00:54:45 -070083
84rust_library(
85 name = "token_stream_printer",
86 srcs = ["token_stream_printer.rs"],
87 data = [
Marcel Hlopko7f14b4c2022-04-13 00:54:45 -070088 ],
89 deps = [
Googler75c7ad02022-05-23 13:27:49 -070090 "@crate_index//:anyhow",
91 "@crate_index//:proc-macro2",
Marcel Hlopko7f14b4c2022-04-13 00:54:45 -070092 ],
93)
94
95rust_test(
96 name = "token_stream_printer_test",
97 crate = ":token_stream_printer",
98 data = [
Googler75c7ad02022-05-23 13:27:49 -070099 "//nowhere:rustfmt.toml",
100 "//third_party/unsupported_toolchains/rust/toolchains/nightly:bin/rustfmt",
Marcel Hlopko7f14b4c2022-04-13 00:54:45 -0700101 ],
102 deps = [
Googler75c7ad02022-05-23 13:27:49 -0700103 "@crate_index//:quote",
Marcel Hlopko7f14b4c2022-04-13 00:54:45 -0700104 ],
105)
Marcel Hlopko39512852022-05-09 02:22:00 -0700106
107cc_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",
Googler75c7ad02022-05-23 13:27:49 -0700115 "@absl//absl/strings",
Luca Versaric21d92f2022-05-25 00:56:30 -0700116 "@com_google_googletest//:gtest",
Googler75c7ad02022-05-23 13:27:49 -0700117 "@llvm-project//llvm:Support",
Marcel Hlopko39512852022-05-09 02:22:00 -0700118 ],
119)
Googler75c7ad02022-05-23 13:27:49 -0700120
121cc_library(
Luca Versaric21d92f2022-05-25 00:56:30 -0700122 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
132cc_library(
Googler75c7ad02022-05-23 13:27:49 -0700133 name = "rust_allocator_shims",
134 srcs = ["rust_allocator_shims.c"],
135)