BUILD 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
  5. load("@rules_proto//proto:defs.bzl", "proto_library")
  6. package(default_visibility = ["//visibility:public"])
  7. proto_library(
  8. name = "carbon_proto",
  9. srcs = ["carbon.proto"],
  10. )
  11. cc_proto_library(
  12. name = "carbon_cc_proto",
  13. testonly = 1,
  14. deps = [":carbon_proto"],
  15. )
  16. # Header for LibFuzzer, does not provide the implementation which should come
  17. # from some other source such as a fuzz test target.
  18. cc_library(
  19. name = "libfuzzer_header",
  20. testonly = 1,
  21. hdrs = ["libfuzzer.h"],
  22. )
  23. cc_library(
  24. name = "proto_to_carbon_lib",
  25. testonly = 1,
  26. srcs = ["proto_to_carbon.cpp"],
  27. hdrs = ["proto_to_carbon.h"],
  28. deps = [
  29. ":carbon_cc_proto",
  30. "//common:error",
  31. "@llvm-project//llvm:Support",
  32. "@protobuf//:protobuf_headers",
  33. ],
  34. )
  35. cc_binary(
  36. name = "proto_to_carbon",
  37. testonly = 1,
  38. srcs = ["proto_to_carbon_main.cpp"],
  39. deps = [
  40. ":carbon_cc_proto",
  41. ":proto_to_carbon_lib",
  42. "//common:bazel_working_dir",
  43. "//common:error",
  44. "@llvm-project//llvm:Support",
  45. "@protobuf//:protobuf_headers",
  46. ],
  47. )
  48. cc_test(
  49. name = "proto_to_carbon_test",
  50. size = "small",
  51. srcs = ["proto_to_carbon_test.cpp"],
  52. deps = [
  53. ":carbon_cc_proto",
  54. ":proto_to_carbon_lib",
  55. "//common:error",
  56. "//testing/base:gtest_main",
  57. "@googletest//:gtest",
  58. ],
  59. )