• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15# Required for new toolchain resolution API.
16build --incompatible_enable_cc_toolchain_resolution
17
18# Required for combined code coverage reports.
19coverage --experimental_generate_llvm_lcov
20coverage --combined_report=lcov
21
22# Suppress the DEBUG: log messages from bazel. We get lots of spammy DEBUG:
23# messages from our third-party dependencies.
24build --ui_event_filters=-debug
25
26# Enforces consistent action environment variables. This is important to
27# address Protobuf's rebuild sensitivity on changes to the environment
28# variables.
29build --incompatible_strict_action_env
30
31# Silence compiler warnings from external repositories.
32#
33# This is supported by Bazel's default C++ toolchain, but not yet by
34# rules_cc_toolchain
35# (https://github.com/bazelembedded/rules_cc_toolchain/issues/46).
36build --features=external_include_paths
37
38# TODO(b/269204725): Move the following flags to the toolchain configuration.
39# By default build with C++17.
40build --cxxopt='-std=c++17'
41build --cxxopt="-fno-rtti"
42build --cxxopt="-Wnon-virtual-dtor"
43# Allow uses of the register keyword, which may appear in C headers.
44build --cxxopt="-Wno-register"
45
46# This leaks the PATH variable into the Bazel build environment, which
47# enables the Python pw_protobuf plugins to find the Python version
48# via CIPD and pw_env_setup. This is a partial fix for pwbug/437,
49# however this does not provide a fix for downstream projects that
50# use system Python < 3.6. This approach is problematic because of the
51# Protobuf rebuild sensitivity to environment variable changes.
52# TODO(pwbug/437): Remove this once pwbug/437 is completely resolved.
53build --action_env=PATH
54
55# Define the --config=asan-libfuzzer configuration.
56build:asan-libfuzzer \
57    --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
58build:asan-libfuzzer \
59    --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
60build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan
61
62# Specifies desired output mode for running tests.
63# Valid values are
64#   'summary' to output only test status summary
65#   'errors' to also print test logs for failed tests
66#   'all' to print logs for all tests
67#   'streamed' to output logs for all tests in real time
68#     (this will force tests to be executed locally one at a time regardless
69#     of --test_strategy value).
70test --test_output=errors
71