BUILD 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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")
  5. load("//bazel/cc_toolchains:defs.bzl", "cc_env")
  6. load("//bazel/sh_run:rules.bzl", "glob_sh_run")
  7. load("//testing/file_test:rules.bzl", "file_test")
  8. package(default_visibility = [
  9. "//bazel/check_deps:__pkg__",
  10. "//explorer:__subpackages__",
  11. "//installers:__subpackages__",
  12. ])
  13. filegroup(
  14. name = "standard_libraries",
  15. srcs = ["data/prelude.carbon"],
  16. )
  17. cc_library(
  18. name = "main",
  19. srcs = ["main.cpp"],
  20. hdrs = ["main.h"],
  21. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  22. # don't spend time linting it.
  23. tags = ["no-clang-tidy"],
  24. deps = [
  25. "//common:error",
  26. "//common:ostream",
  27. "//explorer/base:trace_stream",
  28. "//explorer/parse_and_execute",
  29. "@llvm-project//llvm:Support",
  30. ],
  31. )
  32. cc_binary(
  33. name = "explorer",
  34. srcs = ["main_bin.cpp"],
  35. env = cc_env(),
  36. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  37. # don't spend time linting it.
  38. tags = ["no-clang-tidy"],
  39. deps = [
  40. ":main",
  41. "//common:bazel_working_dir",
  42. "@llvm-project//llvm:Support",
  43. ],
  44. )
  45. cc_binary(
  46. name = "file_test",
  47. testonly = 1,
  48. srcs = ["file_test.cpp"],
  49. # Running clang-tidy is slow, and explorer is currently feature frozen, so
  50. # don't spend time linting it.
  51. tags = ["no-clang-tidy"],
  52. deps = [
  53. ":main",
  54. "//common:check",
  55. "//testing/base:test_raw_ostream",
  56. "//testing/file_test:file_test_base",
  57. "@com_google_absl//absl/flags:flag",
  58. "@com_googlesource_code_re2//:re2",
  59. ],
  60. )
  61. file_test(
  62. name = "file_test.notrace",
  63. size = "small",
  64. prebuilt_binary = ":file_test",
  65. shard_count = 20,
  66. tests = glob(["testdata/**/*.carbon"]),
  67. )
  68. file_test(
  69. name = "file_test.trace",
  70. size = "small",
  71. args = ["--trace"],
  72. prebuilt_binary = ":file_test",
  73. shard_count = 30,
  74. tests = glob(
  75. ["testdata/**/*.carbon"],
  76. exclude = [
  77. # `limits` tests check for various limit conditions (such as an
  78. # infinite loop). The tests collectively don't test tracing
  79. # because it creates substantial additional overhead.
  80. "testdata/limits/**",
  81. # `trace` tests do tracing by default.
  82. "testdata/trace/**",
  83. # Expensive tests to trace.
  84. "testdata/assoc_const/rewrite_large_type.carbon",
  85. "testdata/linked_list/typed_linked_list.carbon",
  86. ],
  87. ),
  88. )
  89. glob_sh_run(
  90. args = ["$(location //explorer)"],
  91. data = ["//explorer"],
  92. file_exts = ["carbon"],
  93. )
  94. glob_sh_run(
  95. args = [
  96. "$(location //explorer)",
  97. "--parser_debug",
  98. "--trace_file=-",
  99. ],
  100. data = ["//explorer"],
  101. file_exts = ["carbon"],
  102. run_ext = "verbose",
  103. )
  104. filegroup(
  105. name = "carbon_files",
  106. srcs = glob(["testdata/**/*.carbon"]),
  107. # Files are used for validating fuzzer completeness.
  108. visibility = ["//explorer/fuzzing:__pkg__"],
  109. )
  110. filegroup(
  111. name = "treesitter_testdata",
  112. srcs = glob(
  113. ["testdata/**/*.carbon"],
  114. exclude = [
  115. "testdata/**/fail_*",
  116. ],
  117. ),
  118. visibility = ["//utils/treesitter:__pkg__"],
  119. )