github.com/distbuild/reclient@v0.0.0-20240401075343-3de72e395564/.bazelrc (about) 1 # This .bazelrc file contains all of the flags required for the RBE provided 2 # toolchain with Remote Build Execution. This heavily inspired from: 3 # https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-0.27.0.bazelrc 4 5 # https://docs.bazel.build/versions/master/command-line-reference.html#flag--enable_platform_specific_config 6 # for --workspace_status_command 7 build --enable_platform_specific_config 8 # This will standardize the environment for building, which lets us share build cache 9 # across developers and CI. It'll _eventually_ be turned on by default. See 10 # https://github.com/bazelbuild/bazel/issues/7026 11 build --incompatible_strict_action_env 12 # When running with strict action environments. Bazel effectivelly hardcodes 13 # Both the MSYS64 bin path & Windows default paths. However, go code and protobufs 14 # also rely on mingw installs of git, patch, unzip, gcc and python. There doesn't seem 15 # to be a way to extend bazel's PATH, so instead with hardcode the normal hardcoded path 16 # + mingw + git. 17 # See where bazel currently sets the path for strict action env: 18 # https://github.com/bazelbuild/bazel/blob/6b33bdb1e22514304c0e35ce8e067f2175685245/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java#L198-L200 19 # https://github.com/bazelbuild/bazel/blob/6b33bdb1e22514304c0e35ce8e067f2175685245/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java#L515-L525 20 build:windows --action_env PATH="C:\\tools\\msys64\\usr\\bin;C:\\tools\\msys64\\bin;C:\\Windows;C:\\Windows\\System32;C:\\Windows\\System32\\WindowsPowerShell\\v1.0;C:\\tools\\msys64\\mingw64\\bin;C:\\Program Files\\Git\\cmd" 21 # MSYS's "ln" doesn't work as expected by default - it'll silently fail, or create 22 # hard copies instead. In fairness, windows by default doesn't allow symlinks (before Vista, 23 # there were symlinks, from vista to 10 you needed admin rights, from 10+ you ned to turn on 24 # developer mode). Some non-trivial internet searching revealed you need this flag set so 25 # real symlinks are used. 26 build:windows --action_env MSYS="winsymlinks:nativestrict" 27 build --@io_bazel_rules_go//go/config:static 28 build --@io_bazel_rules_go//go/config:pure 29 30 ### Required for LLVM 31 # Prevent invalid caching if input files are modified during a build. 32 build --experimental_guard_against_concurrent_changes 33 build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 34 build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 35 build:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 36 build --compilation_mode=opt 37 # Enable retries for repositories downloads 38 build --experimental_repository_downloader_retries=8 39 # Remove clang's warnings from our output. 40 build:linux --cxxopt=-Wcomment --host_cxxopt=-Wcomment 41 build:linux --cxxopt=-Wuninitialized --host_cxxopt=-Wuninitialized 42 43 # to propagete tags to execution_requirements 44 # https://github.com/bazelbuild/bazel/issues/8830 45 # Needs to be applied as common to prevent wiping of analysis cache between 46 # bazel query and bazel build 47 common --experimental_allow_tags_propagation 48 49 50 ## use BAZEL_LLVM on windows 51 ## http://docs.bazel.build/versions/master/windows.html#bulid-c-with-clang 52 ## but it doesn't work with go/cgo yet. 53 # use MingW on windows (for rules_go) 54 # https://github.com/bazelbuild/rules_go/blob/master/windows.rst 55 build:windows --incompatible_enable_cc_toolchain_resolution 56 build:windows --cpu=x64_windows 57 build:windows --compiler=clang-cl 58 build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl 59 build:windows --host_platform=//:x64_windows 60 build:windows --platforms=//:x64_windows 61 build:windows --cxxopt=/O2 62 build:windows --features=static_link_msvcrt 63 build:windows --action_env=CGO_ENABLED=0 64 65 66 # Get the current workspace git commit SHA as a variable for use with versioning. 67 # See https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command. 68 build:linux --workspace_status_command=./scripts/sha.sh 69 build:macos --workspace_status_command=./scripts/sha.sh 70 build:windows --workspace_status_command=./scripts/sha.bat 71 # TODO(b/144421495): Temporary workaround for https://github.com/bazelbuild/rules_go/issues/2224 72 # to stamp version numbers. Remove when the issue is fixed. 73 build --stamp 74 build --copt '-fPIC' 75 76 # Required for backwards compatibility with older GLIBC 77 # version present on Ubuntu 1604. See the comment on 78 # //internal/pkg/cppdependencyscanner/bridge.cc. 79 build:glibc_new --cxxopt=-D__GLIBC_NEW__ 80 81 # need for windows to avoid mt.exe permission error. 82 build --action_env=TMPDIR 83 # need this for user's application default credentials for integ test 84 # with --test_env=RBE_use_application_default_credentials=true 85 test:linux --test_env=HOME 86 test:macos --test_env=HOME 87 test:windows --test_env=APPDATA 88 89 build:windows --features=static_link_msvcrt 90 91 build:clangscandeps --//:include_scanner=clangscandeps 92 93 build:goma --//:include_scanner=goma 94 95 build:racedetection --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false 96 test:racedetection --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false