BUILD 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(["testdata/**/*.carbon"]),
  44. deps = [
  45. "//explorer/parse_and_execute",
  46. "//testing/file_test:file_test_base",
  47. ],
  48. )
  49. glob_sh_run(
  50. args = ["$(location //explorer)"],
  51. data = ["//explorer"],
  52. file_exts = ["carbon"],
  53. )
  54. glob_sh_run(
  55. args = [
  56. "$(location //explorer)",
  57. "--parser_debug",
  58. "--trace_file=-",
  59. ],
  60. data = ["//explorer"],
  61. file_exts = ["carbon"],
  62. run_ext = "verbose",
  63. )
  64. filegroup(
  65. name = "carbon_files",
  66. srcs = glob(["testdata/**/*.carbon"]),
  67. # Files are used for validating fuzzer completeness.
  68. visibility = ["//explorer/fuzzing:__pkg__"],
  69. )