forked from bazelbuild/reclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bazelrc
113 lines (93 loc) · 5.74 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This .bazelrc file contains all of the flags required for the RBE provided
# toolchain with Remote Build Execution. This heavily inspired from:
# https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-0.27.0.bazelrc
# https://docs.bazel.build/versions/master/command-line-reference.html#flag--enable_platform_specific_config
# for --workspace_status_command
build --enable_platform_specific_config
# This will standardize the environment for building, which lets us share build cache
# across developers and CI. It'll _eventually_ be turned on by default. See
# https://github.com/bazelbuild/bazel/issues/7026
build --incompatible_strict_action_env
# Optional user specific bazelrc
try-import %workspace%/user.bazelrc
# When running with strict action environments. Bazel effectivelly hardcodes
# Both the MSYS64 bin path & Windows default paths. However, go code and protobufs
# also rely on mingw installs of git, patch, unzip, gcc and python. There doesn't seem
# to be a way to extend bazel's PATH, so instead with hardcode the normal hardcoded path
# + mingw + git.
# See where bazel currently sets the path for strict action env:
# https://github.com/bazelbuild/bazel/blob/6b33bdb1e22514304c0e35ce8e067f2175685245/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java#L198-L200
# https://github.com/bazelbuild/bazel/blob/6b33bdb1e22514304c0e35ce8e067f2175685245/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java#L515-L525
build:windows --action_env PATH="C:\\msys64\\usr\\bin;C:\\msys64\\bin;C:\\tools\\msys64\\usr\\bin;C:\\tools\\msys64\\bin;C:\\Windows;C:\\Windows\\System32;C:\\Windows\\System32\\WindowsPowerShell\\v1.0;C:\\msys64\\mingw64\\bin;C:\\tools\\msys64\\mingw64\\bin;C:\\Program Files\\Git\\cmd"
# MSYS's "ln" doesn't work as expected by default - it'll silently fail, or create
# hard copies instead. In fairness, windows by default doesn't allow symlinks (before Vista,
# there were symlinks, from vista to 10 you needed admin rights, from 10+ you ned to turn on
# developer mode). Some non-trivial internet searching revealed you need this flag set so
# real symlinks are used.
build:windows --action_env MSYS="winsymlinks:nativestrict"
build:windows --@io_bazel_rules_go//go/config:static
build:windows --@io_bazel_rules_go//go/config:pure
build:linux --@io_bazel_rules_go//go/config:static
build:linux --@io_bazel_rules_go//go/config:pure
### Required for LLVM
# Prevent invalid caching if input files are modified during a build.
build --experimental_guard_against_concurrent_changes
build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17
build --compilation_mode=opt
# Enable retries for repositories downloads
build --experimental_repository_downloader_retries=8
# Remove clang's warnings from our output.
build:linux --cxxopt=-Wcomment --host_cxxopt=-Wcomment
build:linux --cxxopt=-Wuninitialized --host_cxxopt=-Wuninitialized
# The protobuf cc library version we use has warnings on some versions of xcode
# We can probably remove this once we update our proto version
build:macos --cxxopt=-Wno-unknown-warning-option --cxxopt=-Wno-deprecated-builtins --host_cxxopt=-Wno-unknown-warning-option --host_cxxopt=-Wno-deprecated-builtins
## use BAZEL_LLVM on windows
## http://docs.bazel.build/versions/master/windows.html#bulid-c-with-clang
## but it doesn't work with go/cgo yet.
# use MingW on windows (for rules_go)
# https://github.com/bazelbuild/rules_go/blob/master/windows.rst
build:windows --incompatible_enable_cc_toolchain_resolution
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:windows --host_platform=//:x64_windows
build:windows --platforms=//:x64_windows
build:windows --cxxopt=/O2
build:windows --features=static_link_msvcrt
build:windows --action_env=CGO_ENABLED=0
# Platform flags:
# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms" and "platforms".
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
build:linux --incompatible_enable_cc_toolchain_resolution
build:linux --extra_toolchains=@linux_android1404//:cc-toolchain
# Ninja writes to the client/out directory in the goma repository
common:linux --strategy=CcNinjaMakeRule=remote,processwrapper-sandbox
# Googler specific flags, this file does not exist in the open source repo.
try-import %workspace%/googler.bazelrc
# Get the current workspace git commit SHA as a variable for use with versioning.
# See https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command.
build:linux --workspace_status_command=./scripts/sha.sh
build:macos --workspace_status_command=./scripts/sha.sh
build:windows --workspace_status_command=./scripts/sha.bat
build:linux --copt '-fPIC'
build:macos --copt '-fPIC'
# Required for backwards compatibility with older GLIBC
# version present on Ubuntu 1604. See the comment on
# //internal/pkg/cppdependencyscanner/bridge.cc.
build:glibc_new --cxxopt=-D__GLIBC_NEW__
# need this for user's application default credentials for integ test
# with --test_env=RBE_use_application_default_credentials=true
test:linux --test_env=HOME
test:macos --test_env=HOME
test:windows --test_env=APPDATA
build:windows --features=static_link_msvcrt
build:clangscandeps --//:include_scanner=clangscandeps
build --@llvm_zlib//:llvm_enable_zlib=false
build:goma --//:include_scanner=goma
build:racedetection --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false
test:racedetection --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false
common:nonogo --@@//tools:no_nogo
common --lockfile_mode=off
common:ci --remote_download_minimal