BUILD 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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_library", "cc_test")
  5. load("//bazel/manifest:defs.bzl", "manifest")
  6. package(default_visibility = ["//visibility:public"])
  7. filegroup(
  8. name = "testdata",
  9. data = glob(["testdata/**/*.carbon"]),
  10. )
  11. cc_library(
  12. name = "diagnostic_emitter",
  13. srcs = [
  14. "diagnostic.cpp",
  15. "diagnostic_consumer.cpp",
  16. ],
  17. hdrs = [
  18. "diagnostic.h",
  19. "diagnostic_consumer.h",
  20. "diagnostic_converter.h",
  21. "diagnostic_emitter.h",
  22. ],
  23. deps = [
  24. ":diagnostic_kind",
  25. ":format_providers",
  26. "//common:check",
  27. "//common:ostream",
  28. "@llvm-project//llvm:Support",
  29. ],
  30. )
  31. cc_test(
  32. name = "diagnostic_emitter_test",
  33. size = "small",
  34. srcs = ["diagnostic_emitter_test.cpp"],
  35. deps = [
  36. ":diagnostic_emitter",
  37. ":mocks",
  38. "//testing/base:gtest_main",
  39. "@googletest//:gtest",
  40. "@llvm-project//llvm:Support",
  41. ],
  42. )
  43. cc_library(
  44. name = "diagnostic_kind",
  45. srcs = ["diagnostic_kind.cpp"],
  46. hdrs = ["diagnostic_kind.h"],
  47. textual_hdrs = [
  48. "diagnostic_kind.def",
  49. ],
  50. deps = [
  51. "//common:enum_base",
  52. ],
  53. )
  54. manifest(
  55. name = "all_testdata.txt",
  56. srcs = ["//toolchain/testing:all_testdata"],
  57. )
  58. cc_test(
  59. name = "coverage_test",
  60. size = "small",
  61. srcs = ["coverage_test.cpp"],
  62. args = ["--testdata_manifest=$(location :all_testdata.txt)"],
  63. data = [
  64. ":all_testdata.txt",
  65. "//toolchain/testing:all_testdata",
  66. ],
  67. deps = [
  68. ":diagnostic_kind",
  69. "//testing/base:gtest_main",
  70. "//toolchain/testing:coverage_helper",
  71. "@abseil-cpp//absl/flags:flag",
  72. "@googletest//:gtest",
  73. ],
  74. )
  75. cc_library(
  76. name = "format_providers",
  77. srcs = ["format_providers.cpp"],
  78. hdrs = ["format_providers.h"],
  79. deps = [
  80. "//common:check",
  81. "//common:ostream",
  82. "@llvm-project//llvm:Support",
  83. ],
  84. )
  85. cc_test(
  86. name = "format_providers_test",
  87. size = "small",
  88. srcs = ["format_providers_test.cpp"],
  89. deps = [
  90. ":diagnostic_emitter",
  91. ":format_providers",
  92. ":mocks",
  93. "//testing/base:gtest_main",
  94. "@googletest//:gtest",
  95. "@llvm-project//llvm:Support",
  96. ],
  97. )
  98. cc_library(
  99. name = "null_diagnostics",
  100. hdrs = ["null_diagnostics.h"],
  101. deps = [
  102. ":diagnostic_emitter",
  103. "@llvm-project//llvm:Support",
  104. ],
  105. )
  106. cc_library(
  107. name = "sorting_diagnostic_consumer",
  108. hdrs = ["sorting_diagnostic_consumer.h"],
  109. deps = [
  110. ":diagnostic_emitter",
  111. "//common:check",
  112. "@llvm-project//llvm:Support",
  113. ],
  114. )
  115. cc_test(
  116. name = "sorting_diagnostic_consumer_test",
  117. size = "small",
  118. srcs = ["sorting_diagnostic_consumer_test.cpp"],
  119. deps = [
  120. ":diagnostic_emitter",
  121. ":mocks",
  122. ":sorting_diagnostic_consumer",
  123. "//testing/base:gtest_main",
  124. "@googletest//:gtest",
  125. "@llvm-project//llvm:Support",
  126. ],
  127. )
  128. cc_library(
  129. name = "mocks",
  130. testonly = 1,
  131. srcs = ["mocks.cpp"],
  132. hdrs = ["mocks.h"],
  133. deps = [
  134. ":diagnostic_emitter",
  135. "@googletest//:gtest",
  136. "@llvm-project//llvm:Support",
  137. ],
  138. )