.bazelrc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. # Support running clang-tidy with:
  5. # bazel build --config=clang-tidy -k //...
  6. # See: https://github.com/erenon/bazel_clang_tidy
  7. build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
  8. build:clang-tidy --output_groups=report
  9. build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
  10. # Default to using a disk cache to minimize re-building LLVM and Clang which we
  11. # try to avoid updating too frequently to minimize rebuild cost. The location
  12. # here can be overridden in the user configuration where needed.
  13. #
  14. # Note that this cache will grow without bound currently. You should
  15. # periodically run the `scripts/clean_disk_cache.sh` script or some equivalent.
  16. # https://github.com/bazelbuild/bazel/issues/5139 tracks fixing this in Bazel.
  17. build --disk_cache=~/.cache/carbon-lang-build-cache
  18. # Enable some safety when using the build cache, likely to be defaulted in
  19. # future Bazel releases.
  20. build --experimental_guard_against_concurrent_changes
  21. # Disable warnings for all external compilations. These involve code that isn't
  22. # developed as part of Carbon and may be difficult or impossible to patch, so
  23. # warnings aren't likely to be actionable.
  24. build --per_file_copt=external/.*\.(c|cc|cpp|cxx)$@-w
  25. build --host_per_file_copt=external/.*\.(c|cc|cpp|cxx)$@-w
  26. # Default dynamic linking to off. While this can help build performance in some
  27. # edge cases with very large linked executables and a slow linker, between using
  28. # fast linkers on all platforms (LLD and the Apple linker), as well as having
  29. # relatively few such executables, shared objects simply waste too much space in
  30. # our builds.
  31. build --dynamic_mode=off
  32. # Always compile PIC code. There are few if any disadvantages on the platforms
  33. # and architectures we care about and it avoids the need to compile files twice.
  34. build --force_pic
  35. # Completely disable Bazel's automatic stripping of debug information. Removing
  36. # that information causes unhelpful backtraces from unittest failures and other
  37. # crashes. Optimized builds already avoid using debug information by default.
  38. build --strip=never
  39. # Enable Abseil for GoogleTest.
  40. build --define=absl=1
  41. # Configuration for enabling Address Sanitizer. Note that this is enabled by
  42. # default for fastbuild. The config is provided to enable ASan even in
  43. # optimized or other build configurations.
  44. build:asan --features=asan
  45. # Configuration for enabling LibFuzzer (along with ASan).
  46. build:fuzzer --features=fuzzer
  47. # Always allow tests to symbolize themselves with whatever `llvm-symbolize` is
  48. # in the users environment.
  49. build --test_env=ASAN_SYMBOLIZER_PATH
  50. # Force actions to have a UTF-8 language encoding.
  51. # TODO: Need to investigate what this should be on Windows, but at least for
  52. # Linux and macOS this seems strictly better than the Bazel default of just
  53. # `en_US`.
  54. build --action_env=LANG=en_US.UTF-8
  55. # Allow users to override any of the flags desired by importing a user-specific
  56. # RC file here if present.
  57. try-import %workspace%/user.bazelrc