|
| 1 | +licenses(["notice"]) |
| 2 | + |
| 3 | +package(default_visibility = ["//visibility:private"]) |
| 4 | + |
| 5 | +load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library") |
| 6 | + |
| 7 | +cc_library( |
| 8 | + name = "murmurhash", |
| 9 | + srcs = glob([ |
| 10 | + "third_party/murmurhash/src/MurmurHash3.cpp", |
| 11 | + ]), |
| 12 | + hdrs = glob([ |
| 13 | + "third_party/murmurhash/src/**/*.h", |
| 14 | + ]), |
| 15 | + includes = ["third_party/murmurhash/src"], |
| 16 | + linkstatic = 1, |
| 17 | +) |
| 18 | + |
| 19 | +cc_library( |
| 20 | + name = "yaml-cpp-polaris-internal", |
| 21 | + srcs = glob([ |
| 22 | + "third_party/yaml-cpp/src/**/*.cpp", |
| 23 | + "third_party/yaml-cpp/src/**/*.h", |
| 24 | + ]), |
| 25 | + hdrs = glob([ |
| 26 | + "third_party/yaml-cpp/include/**/*.h", |
| 27 | + ]), |
| 28 | + includes = [ |
| 29 | + "third_party/yaml-cpp/include", |
| 30 | + ], |
| 31 | + visibility = [ |
| 32 | + "//visibility:private", |
| 33 | + ], |
| 34 | + linkstatic = 1, |
| 35 | +) |
| 36 | + |
| 37 | +cc_library( |
| 38 | + name = "nghttp2", |
| 39 | + srcs = glob([ |
| 40 | + "third_party/nghttp2/lib/**/*.c", |
| 41 | + ], |
| 42 | + exclude = ["third_party/nghttp2/lib/**/*_test.c"]), |
| 43 | + hdrs = glob([ |
| 44 | + "third_party/nghttp2/lib/includes/**/*.h", |
| 45 | + "third_party/nghttp2/lib/**/*.h", |
| 46 | + ]), |
| 47 | + includes = ["third_party/nghttp2/lib/includes"], |
| 48 | + visibility = [ |
| 49 | + "//visibility:private", |
| 50 | + ], |
| 51 | + linkstatic = 1, |
| 52 | +) |
| 53 | + |
| 54 | +cc_library( |
| 55 | + name = "re2", |
| 56 | + srcs = glob([ |
| 57 | + "third_party/re2/re2/*.cc", |
| 58 | + "third_party/re2/**/*.h", |
| 59 | + "third_party/re2/util/hash.cc", |
| 60 | + "third_party/re2/util/logging.cc", |
| 61 | + "third_party/re2/util/rune.cc", |
| 62 | + "third_party/re2/util/stringprintf.cc", |
| 63 | + "third_party/re2/util/strutil.cc", |
| 64 | + "third_party/re2/util/valgrind.cc", |
| 65 | + ]), |
| 66 | + hdrs = glob(["third_party/re2/**/*.h",]), |
| 67 | + includes = ["third_party/re2"], |
| 68 | + visibility = ["//visibility:private"], |
| 69 | + linkstatic = 1, |
| 70 | +) |
| 71 | + |
| 72 | +cc_library( |
| 73 | + name = "polaris_api", |
| 74 | + srcs = glob([ |
| 75 | + "polaris/**/*.cpp", |
| 76 | + "polaris/**/*.h", |
| 77 | + ]), |
| 78 | + hdrs = glob([ |
| 79 | + "include/**/*.h", |
| 80 | + ]), |
| 81 | + deps = [ |
| 82 | + ":trpcapi_cc_trpc", |
| 83 | + ":code_cc_proto", |
| 84 | + ":yaml-cpp-polaris-internal", |
| 85 | + ":nghttp2", |
| 86 | + ":murmurhash", |
| 87 | + ":re2", |
| 88 | + ":ratelimit_proto_v2", |
| 89 | + ], |
| 90 | + includes = [ |
| 91 | + "include", |
| 92 | + "polaris", |
| 93 | + ], |
| 94 | + visibility = [ |
| 95 | + "//visibility:public", |
| 96 | + ], |
| 97 | + copts = [ |
| 98 | + "-DREVISION=\\\"trpc-cpp\\\"", |
| 99 | + ], |
| 100 | +) |
| 101 | + |
| 102 | +cc_library( |
| 103 | + name = "polaris_api_fork", |
| 104 | + srcs = glob([ |
| 105 | + "polaris/**/*.cpp", |
| 106 | + "polaris/**/*.h", |
| 107 | + ]), |
| 108 | + hdrs = glob([ |
| 109 | + "include/**/*.h", |
| 110 | + ]), |
| 111 | + deps = [ |
| 112 | + ":trpcapi_cc_trpc", |
| 113 | + ":code_cc_proto", |
| 114 | + ":yaml-cpp-polaris-internal", |
| 115 | + ":nghttp2", |
| 116 | + ":murmurhash", |
| 117 | + ":re2", |
| 118 | + ], |
| 119 | + includes = [ |
| 120 | + "include", |
| 121 | + "polaris", |
| 122 | + ], |
| 123 | + visibility = [ |
| 124 | + "//visibility:public", |
| 125 | + ], |
| 126 | + copts = [ |
| 127 | + "-DREVISION=\\\"trpc-cpp\\\"", "-DPOLARIS_SUPPORT_FORK", |
| 128 | + ], |
| 129 | +) |
| 130 | + |
| 131 | +cc_proto_library( |
| 132 | + name = "trpcapi_cc_trpc", |
| 133 | + srcs = [ |
| 134 | + "polaris/proto/v1/trpcapi.proto", |
| 135 | + ], |
| 136 | + deps = [ |
| 137 | + ":service_proto", |
| 138 | + ":routing_proto", |
| 139 | + ":ratelimit_proto", |
| 140 | + ":request_proto", |
| 141 | + ":response_proto", |
| 142 | + ], |
| 143 | + include = "polaris/proto", |
| 144 | + use_grpc_plugin = False, |
| 145 | +) |
| 146 | + |
| 147 | +cc_proto_library( |
| 148 | + name = "response_proto", |
| 149 | + srcs = ["polaris/proto/v1/response.proto"], |
| 150 | + deps = [ |
| 151 | + ":service_proto", |
| 152 | + ":routing_proto", |
| 153 | + ":ratelimit_proto", |
| 154 | + ":client_proto", |
| 155 | + ":circuit_breaker_proto", |
| 156 | + ":metric_proto", |
| 157 | + "@com_google_protobuf//:cc_wkt_protos" |
| 158 | + ], |
| 159 | + include = "polaris/proto", |
| 160 | +) |
| 161 | + |
| 162 | +cc_proto_library( |
| 163 | + name = "client_proto", |
| 164 | + srcs = [":polaris/proto/v1/client.proto"], |
| 165 | + deps = [ |
| 166 | + ":model_proto", |
| 167 | + "@com_google_protobuf//:cc_wkt_protos" |
| 168 | + ], |
| 169 | + include = "polaris/proto", |
| 170 | +) |
| 171 | + |
| 172 | +cc_proto_library( |
| 173 | + name = "routing_proto", |
| 174 | + srcs = ["polaris/proto/v1/routing.proto"], |
| 175 | + deps = [ |
| 176 | + ":model_proto", |
| 177 | + "@com_google_protobuf//:cc_wkt_protos" |
| 178 | + ], |
| 179 | + include = "polaris/proto", |
| 180 | +) |
| 181 | + |
| 182 | +cc_proto_library( |
| 183 | + name = "request_proto", |
| 184 | + srcs = ["polaris/proto/v1/request.proto"], |
| 185 | + deps = [ |
| 186 | + ":service_proto", |
| 187 | + ], |
| 188 | + include = "polaris/proto", |
| 189 | +) |
| 190 | + |
| 191 | +cc_proto_library( |
| 192 | + name = "service_proto", |
| 193 | + srcs = ["polaris/proto/v1/service.proto"], |
| 194 | + deps = [ |
| 195 | + ":model_proto", |
| 196 | + "@com_google_protobuf//:cc_wkt_protos" |
| 197 | + ], |
| 198 | + include = "polaris/proto", |
| 199 | +) |
| 200 | + |
| 201 | +cc_proto_library( |
| 202 | + name = "ratelimit_proto", |
| 203 | + srcs = ["polaris/proto/v1/ratelimit.proto"], |
| 204 | + deps = [ |
| 205 | + ":model_proto", |
| 206 | + "@com_google_protobuf//:cc_wkt_protos" |
| 207 | + ], |
| 208 | + include = "polaris/proto", |
| 209 | +) |
| 210 | + |
| 211 | +cc_proto_library( |
| 212 | + name = "ratelimit_proto_v2", |
| 213 | + srcs = ["polaris/proto/v2/ratelimit_v2.proto"], |
| 214 | + deps = [ |
| 215 | + "@com_google_protobuf//:cc_wkt_protos" |
| 216 | + ], |
| 217 | + include = "polaris/proto", |
| 218 | +) |
| 219 | + |
| 220 | +cc_proto_library( |
| 221 | + name = "circuit_breaker_proto", |
| 222 | + srcs = ["polaris/proto/v1/circuitbreaker.proto"], |
| 223 | + deps = [ |
| 224 | + ":model_proto", |
| 225 | + "@com_google_protobuf//:cc_wkt_protos" |
| 226 | + ], |
| 227 | + include = "polaris/proto", |
| 228 | +) |
| 229 | + |
| 230 | +cc_proto_library( |
| 231 | + name = "metric_proto", |
| 232 | + srcs = ["polaris/proto/v1/metric.proto"], |
| 233 | + deps = ["@com_google_protobuf//:cc_wkt_protos"], |
| 234 | + include = "polaris/proto", |
| 235 | +) |
| 236 | + |
| 237 | +cc_proto_library( |
| 238 | + name = "model_proto", |
| 239 | + srcs = ["polaris/proto/v1/model.proto"], |
| 240 | + deps = [ |
| 241 | + "@com_google_protobuf//:cc_wkt_protos" |
| 242 | + ], |
| 243 | + include = "polaris/proto", |
| 244 | +) |
| 245 | + |
| 246 | +cc_proto_library( |
| 247 | + name = "code_cc_proto", |
| 248 | + srcs = ["polaris/proto/v1/code.proto"], |
| 249 | + include = "polaris/proto", |
| 250 | +) |
| 251 | + |
| 252 | +cc_library( |
| 253 | + name = "test", |
| 254 | + srcs = glob([ |
| 255 | + "test/**/*.cpp", |
| 256 | + "test/**/*.h", |
| 257 | + ]), |
| 258 | + hdrs = glob([ |
| 259 | + "include/**/*.h", |
| 260 | + ]), |
| 261 | + deps = [ |
| 262 | + ":trpcapi_cc_trpc", |
| 263 | + ":code_cc_proto", |
| 264 | + ":yaml-cpp-polaris-internal", |
| 265 | + ":nghttp2", |
| 266 | + ":murmurhash", |
| 267 | + ":re2", |
| 268 | + ":ratelimit_proto_v2", |
| 269 | + ], |
| 270 | + includes = [ |
| 271 | + "include", |
| 272 | + "polaris", |
| 273 | + ], |
| 274 | + visibility = [ |
| 275 | + "//visibility:public", |
| 276 | + ], |
| 277 | +) |
| 278 | + |
0 commit comments