BUILD 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. 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.notrace",
  54. size = "small",
  55. prebuilt_binary = ":file_test",
  56. shard_count = 20,
  57. tests = glob(["testdata/**/*.carbon"]),
  58. )
  59. file_test(
  60. name = "file_test.trace",
  61. size = "small",
  62. args = ["--trace"],
  63. prebuilt_binary = ":file_test",
  64. shard_count = 30,
  65. tests = glob(
  66. ["testdata/**/*.carbon"],
  67. exclude = [
  68. # `limits` tests check for various limit conditions (such as an
  69. # infinite loop). The tests collectively don't test tracing
  70. # because it creates substantial additional overhead.
  71. "testdata/limits/**",
  72. # `trace` tests do tracing by default.
  73. "testdata/trace/**",
  74. # Expensive tests to trace.
  75. "testdata/assoc_const/rewrite_large_type.carbon",
  76. "testdata/linked_list/typed_linked_list.carbon",
  77. ],
  78. ),
  79. )
  80. glob_sh_run(
  81. args = ["$(location //explorer)"],
  82. data = ["//explorer"],
  83. file_exts = ["carbon"],
  84. )
  85. glob_sh_run(
  86. args = [
  87. "$(location //explorer)",
  88. "--parser_debug",
  89. "--trace_file=-",
  90. ],
  91. data = ["//explorer"],
  92. file_exts = ["carbon"],
  93. run_ext = "verbose",
  94. )
  95. filegroup(
  96. name = "carbon_files",
  97. srcs = glob(["testdata/**/*.carbon"]),
  98. # Files are used for validating fuzzer completeness.
  99. visibility = ["//explorer/fuzzing:__pkg__"],
  100. )
  101. filegroup(
  102. name = "treesitter_testdata",
  103. srcs = glob(
  104. ["testdata/**/*.carbon"],
  105. exclude = [
  106. "testdata/**/fail_*",
  107. ],
  108. ),
  109. visibility = ["//utils/treesitter:__pkg__"],
  110. )