BUILD 3.0 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_library(
  40. name = "file_test_common",
  41. testonly = 1,
  42. srcs = ["file_test.cpp"],
  43. deps = [
  44. ":main",
  45. "//common:check",
  46. "//testing/base:test_raw_ostream",
  47. "//testing/file_test:file_test_base",
  48. "@com_google_absl//absl/flags:flag",
  49. "@com_googlesource_code_re2//:re2",
  50. ],
  51. )
  52. file_test(
  53. name = "file_test",
  54. size = "small",
  55. shard_count = 20,
  56. tests = glob(["testdata/**/*.carbon"]),
  57. deps = [
  58. ":file_test_common",
  59. "@com_googlesource_code_re2//:re2",
  60. ],
  61. )
  62. file_test(
  63. name = "file_test.trace",
  64. size = "small",
  65. args = ["--trace"],
  66. shard_count = 30,
  67. tests = glob(
  68. ["testdata/**/*.carbon"],
  69. exclude = [
  70. # `limits` tests check for various limit conditions (such as an
  71. # infinite loop). The tests collectively don't test tracing
  72. # because it creates substantial additional overhead.
  73. "testdata/limits/**",
  74. # `trace` tests do tracing by default.
  75. "testdata/trace/**",
  76. # Expensive tests to trace.
  77. "testdata/assoc_const/rewrite_large_type.carbon",
  78. "testdata/linked_list/typed_linked_list.carbon",
  79. ],
  80. ),
  81. deps = [":file_test_common"],
  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. )