BUILD 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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("//bazel/cc_toolchains:defs.bzl", "cc_env")
  5. load("//bazel/sh_run:rules.bzl", "glob_sh_run")
  6. load("//testing/file_test:rules.bzl", "file_test")
  7. package(default_visibility = [
  8. "//bazel/check_deps:__pkg__",
  9. "//explorer:__subpackages__",
  10. "//installers:__subpackages__",
  11. ])
  12. filegroup(
  13. name = "standard_libraries",
  14. srcs = ["data/prelude.carbon"],
  15. )
  16. cc_library(
  17. name = "main",
  18. srcs = ["main.cpp"],
  19. hdrs = ["main.h"],
  20. deps = [
  21. "//common:error",
  22. "//explorer/common:trace_stream",
  23. "//explorer/parse_and_execute",
  24. "@llvm-project//llvm:Support",
  25. ],
  26. )
  27. cc_binary(
  28. name = "explorer",
  29. srcs = ["main_bin.cpp"],
  30. env = cc_env(),
  31. deps = [
  32. ":main",
  33. "//common:bazel_working_dir",
  34. "@llvm-project//llvm:Support",
  35. ],
  36. )
  37. file_test(
  38. name = "file_test",
  39. srcs = ["file_test.cpp"],
  40. # Bazel limits sharding to 50. We have lots of tests, so this should
  41. # maximize parallelism.
  42. shard_count = 50,
  43. tests = glob([
  44. "testdata/**/*.carbon",
  45. "trace_testdata/**/*.carbon",
  46. ]),
  47. deps = [
  48. "//explorer/parse_and_execute",
  49. "//testing/file_test:file_test_base",
  50. "//testing/util:test_raw_ostream",
  51. ],
  52. )
  53. glob_sh_run(
  54. args = ["$(location //explorer)"],
  55. data = ["//explorer"],
  56. file_exts = ["carbon"],
  57. )
  58. glob_sh_run(
  59. args = [
  60. "$(location //explorer)",
  61. "--parser_debug",
  62. "--trace_file=-",
  63. ],
  64. data = ["//explorer"],
  65. file_exts = ["carbon"],
  66. run_ext = "verbose",
  67. )
  68. filegroup(
  69. name = "carbon_files",
  70. srcs = glob(["testdata/**/*.carbon"]),
  71. # Files are used for validating fuzzer completeness.
  72. visibility = ["//explorer/fuzzing:__pkg__"],
  73. )
  74. filegroup(
  75. name = "treesitter_testdata",
  76. srcs = glob(
  77. ["testdata/**/*.carbon"],
  78. exclude = [
  79. "testdata/**/fail_*",
  80. # multiline strings
  81. "testdata/string/*",
  82. ],
  83. ),
  84. visibility = ["//utils/treesitter:__pkg__"],
  85. )