.bazelrc 2.8 KB

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