-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy path.bazelrc
More file actions
136 lines (120 loc) · 6.13 KB
/
.bazelrc
File metadata and controls
136 lines (120 loc) · 6.13 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Allow directories as sources.
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
build --incompatible_strict_action_env
build --sandbox_tmpfs_path=/tmp
build --enable_platform_specific_config
build -c opt
# Ensure that paths of files printed by our examples are valid.
build --nozip_undeclared_test_outputs
# C/C++
# GCC is supported on a best-effort basis.
common --repo_env=CC=clang
# On Linux, use a hermetic toolchain and sysroot shared between local dev setups and CI.
# Such a toolchain isn't easily available on macOS or Windows.
common:linux --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Register hermetic LLVM toolchains for both x86_64 and arm64
common:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
common:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-aarch64-linux
# Silence protobuf compilation warnings.
build --copt=-Wno-unused-function
build --copt=-Wno-unknown-warning-option
build --host_copt=-Wno-unused-function
build --host_copt=-Wno-unknown-warning-option
# Ensure that cc_* targets declare all their direct dependencies (requires clang).
# TODO: This is currently ignored by the hermetic toolchain used on Linux.
# See: https://github.com/grailbio/bazel-toolchain/issues/203
build --features=layering_check
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --cxxopt=-std=c++17
build:macos --host_cxxopt=-std=c++17
# Java
# Always build for Java 8, even with a newer JDK. This ensures that all artifacts we release are
# bytecode compatible with Java 8 runtimes. Runtime compatibility (e.g not using APIs that aren't
# available in Java 8) is verified in CI.
# Note: We would like to use --release, but can't due to
# https://bugs.openjdk.org/browse/JDK-8214165.
build --java_language_version=8
# Targeting Java 8 with JDK 21 is deprecated and results in this warning:
# warning: [options] source value 8 is obsolete and will be removed in a future release
# warning: [options] target value 8 is obsolete and will be removed in a future release
# warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
# Internally, Bazel always runs javac on a Java 21 runtime, but uses the classpath obtained from the
# runtime configured below.
build --javacopt=-Xlint:-options
# Tools used during the build do not have compatibility requirements, so we can use the most recent
# language features.
build --tool_java_language_version=21
# Compile for a hermetic JDK so that devs don't have to have a particular JDK installed and
# configured locally.
build --java_runtime_version=remotejdk_21
build --tool_java_runtime_version=remotejdk_21
# Speed up Java compilation by removing indirect deps from the compile classpath.
# Only has an effect when used together with --disk_cache or --remote_cache.
build --experimental_java_classpath=bazel
# Android
build --android_platforms=//:android_arm64
# Windows
# Only compiles with clang on Windows.
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:windows --extra_execution_platforms=//bazel/platforms:x64_windows-clang-cl
build:windows --features=static_link_msvcrt
build:windows --cxxopt=/std:c++17
build:windows --host_cxxopt=/std:c++17
# TODO: Remove once https://github.com/bazelbuild/rules_kotlin/issues/1309 is addressed.
build:windows --legacy_external_runfiles
# Required as PATH doubles as the shared library search path on Windows and the
# Java agent functionality depends on system-provided shared libraries.
test:windows --noincompatible_strict_action_env
run:windows --noincompatible_strict_action_env
# Forward debug variables to tests
build --test_env=JAZZER_AUTOFUZZ_DEBUG
build --test_env=JAZZER_REFLECTION_DEBUG
# Interactively debug Jazzer integration tests by passing --config=debug and attaching to port 5005.
# This is different from --java_debug: It affects the actual inner Jazzer process rather than the
# outer FuzzTargetTestWrapper.
test:debug --test_env=JAZZER_DEBUG=1
test:debug --test_output=streamed
test:debug --test_strategy=exclusive
test:debug --test_timeout=9999
test:debug --nocache_test_results
# CI tests (not using the toolchain to test OSS-Fuzz & local compatibility)
build:ci --bes_results_url=https://app.buildbuddy.io/invocation/
build:ci --bes_backend=grpcs://remote.buildbuddy.io
build:ci --remote_cache=grpcs://remote.buildbuddy.io
build:ci --remote_timeout=3600
# Fail if Bazel can't find Xcode. This improves error messages as the fallback toolchain will only
# fail when requested to cross-compile.
build:ci --repo_env=BAZEL_USE_XCODE_TOOLCHAIN=1
# Suggested by BuildBuddy
build:ci --noslim_profile
build:ci --experimental_profile_include_target_label
build:ci --experimental_profile_include_primary_output
build:ci --nolegacy_important_outputs
common:ci --announce_rc
# Generic coverage configuration taken from https://github.com/fmeum/rules_jni
coverage --combined_report=lcov
coverage --experimental_use_llvm_covmap
coverage --experimental_generate_llvm_lcov
coverage --repo_env=CC=clang
coverage --repo_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1
coverage --repo_env=GCOV=llvm-profdata
# Instrument all source files of non-test targets matching at least one of these regexes.
coverage --instrumentation_filter=^//src/main[:/],^//sanitizers/src/main[:/]
coverage --test_tag_filters=-no-coverage
# Hide all non-structured output in scripts.
# https://github.com/bazelbuild/bazel/issues/4867#issuecomment-830402410
common:quiet --ui_event_filters=-info,-stderr
common:quiet --noshow_progress
# Use --config=fail-fast to speed up local iteration on tests by letting bazel test stop right on
# the first failing test.
# Let bazel test stop on the first failing test target.
test:fail-fast --notest_keep_going
# Instruct test runners to fail a test target on the first failing test.
test:fail-fast --test_runner_fail_fast
# Safety: by default on local runs, exclude tests tagged as dangerous
# (e.g., those that could execute OS commands, touch the filesystem aggressively, or require network).
test --test_tag_filters=-dangerous
# In CI, include all tests.
test:ci --test_tag_filters=