BUILD 3.1 KB

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