BUILD 3.5 KB

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