# Copyright 2021-2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

build --enable_platform_specific_config

build --process_headers_in_dependencies

# The external_include_paths feature has to be specified in .bazelrc because it
# needs to apply to all compile actions in all repositories.
# TODO: File bug against Bazel to make this work as repository-level feature.
build --features=external_include_paths
build --host_features=external_include_paths

# Make Googletest use Abseil to support AbslStringify.
# See https://github.com/google/googletest/issues/4383.
build --define=absl=1

# Suppress unactionable warnings about duplicate libraries.
# TODO: File bug against rules_cc about this.
build:macos --linkopt='-Wl,-no_warn_duplicate_libraries'
build:macos --host_linkopt='-Wl,-no_warn_duplicate_libraries'

# The next line shouldn’t be needed.  This is probably caused by
# https://github.com/bazel-contrib/rules_go/pull/4593.
# TODO: File bug against rules_go.
build:windows --@rules_go//go/config:pure

# Treat warnings as errors, but only for this repository.
build --//private:treat_warnings_as_errors

build:clang-cl --compiler=clang-cl --host_compiler=clang-cl
build:clang-cl --extra_toolchains='@local_config_cc//:cc-toolchain-x64_windows-clang-cl'
build:clang-cl --extra_execution_platforms='//elisp/private:windows_clang_cl'

# Windows is incredibly slow; quadruple all test timeouts.
# See https://bazel.build/reference/test-encyclopedia#role-test-runner.
test:windows --test_timeout=240,1200,3600,14400

# Since the tests are usually in separate packages from the targets under test,
# the default heuristic for coverage instrumentation filtering doesn’t work.
coverage --instrumentation_filter='^//'
