| # Copyright 2026 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") | |
| load("@protobuf//bazel:proto_library.bzl", "proto_library") | |
| load("@rules_cc//cc:cc_test.bzl", "cc_test") | |
| load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") | |
| package(default_visibility = ["//visibility:public"]) | |
| proto_library( | |
| name = "tags_proto", | |
| srcs = ["tags.proto"], | |
| deps = ["@protobuf//:descriptor_proto"], | |
| ) | |
| cc_proto_library( | |
| name = "tags_cc_proto", | |
| deps = [":tags_proto"], | |
| ) | |
| cc_library( | |
| name = "cbor", | |
| srcs = ["cbor.cc"], | |
| hdrs = [ | |
| "cbor.h", | |
| "options.h", | |
| ], | |
| deps = [ | |
| "@abseil-cpp//absl/base:core_headers", | |
| "@abseil-cpp//absl/base:nullability", | |
| "@abseil-cpp//absl/log:die_if_null", | |
| "@abseil-cpp//absl/status", | |
| "@abseil-cpp//absl/status:status_macros", | |
| "@abseil-cpp//absl/status:statusor", | |
| "@abseil-cpp//absl/strings", | |
| "@abseil-cpp//absl/strings:string_view", | |
| "@libcppbor", | |
| ], | |
| ) | |
| cc_test( | |
| name = "cbor_test", | |
| srcs = ["cbor_test.cc"], | |
| deps = [ | |
| ":cbor", | |
| "@abseil-cpp//absl/status", | |
| "@abseil-cpp//absl/status:status_macros", | |
| "@abseil-cpp//absl/status:status_matchers", | |
| "@abseil-cpp//absl/status:statusor", | |
| "@googletest//:gtest_main", | |
| "@libcppbor", | |
| ], | |
| ) | |
| cc_library( | |
| name = "cbor_generator", | |
| srcs = ["cbor_generator.cc"], | |
| hdrs = ["cbor_generator.h"], | |
| deps = [ | |
| ":tags_cc_proto", | |
| "@abseil-cpp//absl/base:no_destructor", | |
| "@abseil-cpp//absl/container:flat_hash_map", | |
| "@abseil-cpp//absl/container:flat_hash_set", | |
| "@abseil-cpp//absl/strings", | |
| "@protobuf", | |
| "@protobuf//:protoc_lib", | |
| ], | |
| ) | |
| cc_binary( | |
| name = "cbor_generator_main", | |
| srcs = ["cbor_generator_main.cc"], | |
| deps = [ | |
| ":cbor_generator", | |
| "@protobuf//:protoc_lib", | |
| ], | |
| ) | |
| cc_library( | |
| name = "parse", | |
| srcs = ["parse.cc"], | |
| hdrs = ["parse.h"], | |
| deps = [ | |
| ":cbor", | |
| "@abseil-cpp//absl/status", | |
| "@abseil-cpp//absl/status:statusor", | |
| "@abseil-cpp//absl/strings", | |
| "@abseil-cpp//absl/strings:string_view", | |
| "@libcppbor", | |
| ], | |
| ) | |
| cc_test( | |
| name = "parse_test", | |
| srcs = ["parse_test.cc"], | |
| deps = [ | |
| ":cbor", | |
| ":parse", | |
| "//testing:cbor_utils", | |
| "@abseil-cpp//absl/status", | |
| "@abseil-cpp//absl/status:status_matchers", | |
| "@abseil-cpp//absl/status:statusor", | |
| "@abseil-cpp//absl/strings", | |
| "@googletest//:gtest_main", | |
| "@libcppbor", | |
| ], | |
| ) |