2019-12-17 17:33:33 -08:00
# Must be first. Enables build:windows, build:linux, build:macos, build:freebsd, build:openbsd
build --enable_platform_specific_config
###############################################################################
2020-07-13 15:31:46 -07:00
# On Windows, provide: BAZEL_SH, and BAZEL_LLVM (if using clang-cl)
2020-05-05 10:47:49 -07:00
# On all platforms, provide: PYTHON3_BIN_PATH=python
2020-02-26 12:28:13 -08:00
###############################################################################
2019-03-23 10:44:11 +08:00
build --action_env=PATH
2020-06-05 05:36:10 -07:00
# For --compilation_mode=dbg, consider enabling checks in the standard library as well (below).
2020-05-12 22:06:04 -07:00
build --compilation_mode=opt
2021-09-24 17:59:05 -07:00
# Generate minimal debug symbols on Linux and MacOS
build:linux --copt="-g1"
build:macos --copt="-g1"
2021-09-17 19:01:07 -07:00
# Using C++ 17 on all platforms.
build:linux --cxxopt="-std=c++17"
build:macos --cxxopt="-std=c++17"
build:clang-cl --cxxopt="-std=c++17"
2021-09-30 11:58:48 -07:00
build:msvc-cl --cxxopt="/std:c++17"
2021-10-05 15:15:59 -07:00
build:windows --cxxopt="/std:c++17"
2020-02-11 12:11:53 -08:00
# This workaround is needed to prevent Bazel from compiling the same file twice (once PIC and once not).
build:linux --force_pic
build:macos --force_pic
2020-07-02 09:34:24 -07:00
build:clang-cl --compiler=clang-cl
2021-09-30 11:58:48 -07:00
build:msvc-cl --compiler=msvc-cl
2020-08-28 13:53:36 +08:00
# `LC_ALL` and `LANG` is needed for cpp worker tests, because they will call "ray start".
# If we don't add them, python's `click` library will raise an error.
2021-02-26 12:14:02 -07:00
build --action_env=LC_ALL
build --action_env=LANG
2020-08-28 13:53:36 +08:00
# Allow C++ worker tests to execute "ray start" with the correct version of Python.
2021-02-26 12:14:02 -07:00
build --action_env=VIRTUAL_ENV
build --action_env=PYENV_VIRTUAL_ENV
build --action_env=PYENV_VERSION
build --action_env=PYENV_SHELL
2020-07-15 09:34:33 -07:00
# This is needed for some core tests to run correctly
2021-02-26 12:14:02 -07:00
build:windows --enable_runfiles
2019-12-01 15:05:50 -08:00
# TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug
# for compiling assembly files is fixed on Windows:
# https://github.com/bazelbuild/bazel/issues/8924
2019-08-07 14:04:05 -07:00
# Warnings should be errors
2020-07-13 15:31:46 -07:00
build:linux --per_file_copt="-\\.(asm|S)$@-Werror"
build:macos --per_file_copt="-\\.(asm|S)$@-Werror"
build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror"
2021-09-30 11:58:48 -07:00
build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX"
2019-08-07 14:04:05 -07:00
# Ignore warnings for protobuf generated files and external projects.
2020-07-02 09:34:24 -07:00
build --per_file_copt="\\.pb\\.cc$@-w"
2019-12-01 15:05:50 -08:00
build --per_file_copt="-\\.(asm|S)$,external/.*@-w"
2020-11-03 19:36:32 -08:00
#build --per_file_copt="external/.*@-Wno-unused-result"
2019-11-18 20:54:23 -08:00
# Ignore minor warnings for host tools, which we generally can't control
2020-07-02 09:34:24 -07:00
build:clang-cl --host_copt="-Wno-inconsistent-missing-override"
build:clang-cl --host_copt="-Wno-microsoft-unqualified-friend"
2019-06-17 19:00:50 +08:00
# This workaround is needed due to https://github.com/bazelbuild/bazel/issues/4341
2019-12-01 15:05:50 -08:00
build --per_file_copt="-\\.(asm|S)$,external/com_github_grpc_grpc/.*@-DGRPC_BAZEL_BUILD"
2020-06-23 21:58:43 -07:00
# Don't generate warnings about kernel features we don't need https://github.com/ray-project/ray/issues/6832
build:linux --per_file_copt="-\\.(asm|S)$,external/com_github_grpc_grpc/.*@-DGPR_MANYLINUX1"
2020-07-02 09:34:24 -07:00
# Ignore wchar_t -> char conversion warning on MSVC
2021-09-30 11:58:48 -07:00
build:msvc-cl --per_file_copt="external/boost/libs/regex/src/wc_regex_traits\\.cpp@-wd4244"
2019-08-19 16:26:58 -07:00
build --http_timeout_scaling=5.0
2020-06-15 17:27:17 -07:00
build --verbose_failures
2020-02-07 16:19:46 -08:00
build:iwyu --experimental_action_listener=//:iwyu_cpp
2020-01-05 16:18:21 -08:00
2020-02-11 16:49:33 -08:00
# Print relative paths when possible
build:windows --attempt_to_print_relative_paths
# Save disk space by hardlinking cache hits instead of copying
build:windows --experimental_repository_cache_hardlinks
# Clean the environment before building, to make builds more deterministic
build:windows --incompatible_strict_action_env
# For colored output (seems necessary on Windows)
build:windows --color=yes
# For compiler colored output (seems necessary on Windows)
2020-07-02 09:34:24 -07:00
build:clang-cl --per_file_copt="-\\.(asm|S)$@-fansi-escape-codes"
build:clang-cl --per_file_copt="-\\.(asm|S)$@-fcolor-diagnostics"
2020-02-11 16:49:33 -08:00
2020-11-03 19:36:32 -08:00
build:manylinux2010 --copt="-Wno-unused-result"
build:manylinux2010 --linkopt="-lrt"
2020-06-05 05:36:10 -07:00
# Debug build flags. Uncomment in '-c dbg' builds to enable checks in the C++ standard library:
#build:linux --cxxopt="-D_GLIBCXX_DEBUG=1"
#build:linux --cxxopt="-D_GLIBCXX_DEBUG_PEDANTIC=1"
#build:linux --cxxopt="-D_LIBCPP_DEBUG=1"
#build:macos --cxxopt="-D_GLIBCXX_DEBUG=1"
#build:macos --cxxopt="-D_GLIBCXX_DEBUG_PEDANTIC=1"
#build:windows --cxxopt="-D_ITERATOR_DEBUG_LEVEL=2"
2021-09-17 19:01:07 -07:00
# LLVM (clang & libc++) build flags common across Linux installations and systems.
# On Ubuntu, the remaining configurations can be generated by running ci/travis/install-llvm-binaries.sh
build:llvm --action_env=CXXFLAGS=-stdlib=libc++
build:llvm --action_env=LDFLAGS=-stdlib=libc++
build:llvm --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:llvm --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a
build:llvm --action_env=BAZEL_LINKOPTS=-lm:-pthread
build:llvm --define force_libcpp=enabled
2020-01-05 16:18:21 -08:00
# Thread sanitizer configuration:
build:tsan --strip=never
build:tsan --copt -fsanitize=thread
build:tsan --copt -DTHREAD_SANITIZER
2021-08-24 00:57:32 -07:00
build:tsan --copt -O2
2020-01-05 16:18:21 -08:00
build:tsan --copt -g
build:tsan --copt -fno-omit-frame-pointer
build:tsan --linkopt -fsanitize=thread
2021-09-17 19:01:07 -07:00
# This config is only for running TSAN with LLVM toolchain on Linux.
build:tsan-clang --config=tsan
build:tsan-clang --config=llvm
2021-10-25 19:52:53 -07:00
test:tsan --test_env=TSAN_OPTIONS="report_atomic_races=0"
2020-02-26 12:28:13 -08:00
2020-06-08 13:22:12 -07:00
# Memory sanitizer configuration
2020-05-21 15:11:03 -07:00
build:asan --strip=never
build:asan --copt -g
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
2020-06-15 17:27:17 -07:00
test:asan --jobs=1
test:asan --test_env=ASAN_OPTIONS="detect_leaks=0"
2021-09-17 19:01:07 -07:00
# This config is only for running ASAN with LLVM toolchain on Linux.
2021-09-09 15:48:36 -07:00
# https://github.com/google/sanitizers/issues/1017
2021-09-17 19:01:07 -07:00
build:asan-clang --config=asan
build:asan-clang --config=llvm
2021-09-09 15:48:36 -07:00
build:asan-clang --copt -mllvm
build:asan-clang --copt -asan-use-private-alias=1
2021-08-17 10:21:41 -07:00
build:asan-build --strip=never
build:asan-build -c dbg
build:asan-build --copt -fsanitize=address
build:asan-build --copt -DADDRESS_SANITIZER
build:asan-build --copt -O1
build:asan-build --copt -g
build:asan-build --copt -fno-omit-frame-pointer
build:asan-build --copt -static-libasan
build:asan-build --linkopt -fsanitize=address
build:asan-build --linkopt -static-libasan
2020-05-21 15:11:03 -07:00
# For example, for Ubuntu 18.04 libasan can be found here:
2020-06-15 17:27:17 -07:00
# test:asan --test_env=LD_PRELOAD="/usr/lib/gcc/x86_64-linux-gnu/7/libasan.so"
2021-01-25 16:05:59 -08:00
test:asan-buildkite --test_env=LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libasan.so.5"
2020-05-21 15:11:03 -07:00
2020-06-15 17:27:17 -07:00
# CI configuration:
2020-07-13 15:31:46 -07:00
aquery:ci --color=no
aquery:ci --noshow_progress
2020-06-15 17:27:17 -07:00
build:ci --color=yes
build:ci --curses=no
2020-07-30 18:09:31 -07:00
build:ci --keep_going
2020-06-15 17:27:17 -07:00
build:ci --progress_report_interval=100
build:ci --show_progress_rate_limit=15
build:ci --show_task_finish
build:ci --ui_actions_shown=1024
2021-01-18 00:44:24 -08:00
build:ci --show_timestamps
build:ci-travis --disk_cache=~/ray-bazel-cache
build:ci-travis --remote_cache="https://storage.googleapis.com/ray-bazel-cache"
build:ci-github --experimental_repository_cache_hardlinks # GitHub Actions has low disk space, so prefer hardlinks there.
build:ci-github --disk_cache=~/ray-bazel-cache
build:ci-github --remote_cache="https://storage.googleapis.com/ray-bazel-cache"
2020-04-10 13:26:28 -07:00
test:ci --flaky_test_attempts=3
2021-10-19 13:31:42 -07:00
test:ci --genrule_strategy=local
2020-04-10 13:26:28 -07:00
test:ci --test_output=errors
test:ci --test_verbose_timeout_warnings
2021-08-05 17:58:19 -07:00
test:ci-debug -c dbg
test:ci-debug --copt="-g"
test:ci-debug --flaky_test_attempts=3
2021-10-19 13:31:42 -07:00
test:ci-debug --genrule_strategy=local
2021-08-05 17:58:19 -07:00
test:ci-debug --test_output=errors
test:ci-debug --test_verbose_timeout_warnings
2020-04-10 13:26:28 -07:00
2020-07-13 15:31:46 -07:00
aquery:get-toolchain --include_commandline=false
aquery:get-toolchain --noimplicit_deps
# [Linux] Uncomment this line (or use --config) to print a stack trace on exit.
#test:linux --config=strace
test:strace --run_under="bash -c 'if command -v strace >/dev/null && strace -qq -k -e exit true 2>/dev/null; then strace -qq -k -e exit -e trace=\"!all\" -s 32768 -f -o >(awk \"/^[0-9]+ / { y = \\$3 != \\\"SIGCHLD\\\" && \\$3 != \\\"SIGTERM\\\" && \\$5 != \\\"SIGTERM\\\" && \\$5 != \\\"SIGKILL2\\\"; } y { print; }\" 1>&2 && cat 1>&2) -- \"$@\"; else \"$@\"; fi' -"
# [Linux] Uncomment this line (or use --config) to preload libSegFault.so if available, to print a stack trace on aborts and segfault. (Note: This doesn't always work.)
#test:linux --config=segfault
test:segfault --run_under="bash -c 'unset GREP_OPTIONS && if ! grep -q -o Microsoft /proc/version 2>/dev/null; then libs=\"$(command -v ldconfig >/dev/null && ldconfig -p | grep -F -o -e \"libSegFault.so\" | uniq | tr \"\\\\n\" :)\" && if [ -n \"${libs%:}\" ]; then export SEGFAULT_SIGNALS=\"abrt segv\" LD_PRELOAD=\"${libs}${LD_PRELOAD-}\"; fi; fi && \"$@\"' -"
2021-08-05 17:58:19 -07:00
# Debug build:
build:debug -c dbg
build:debug --copt="-g"
build:debug --strip="never"
2021-08-17 10:22:03 -07:00
# Undefined Behavior Sanitizer
build:ubsan --strip=never
build:ubsan --copt -fsanitize=undefined
2021-10-04 21:31:56 -07:00
build:ubsan --copt -fno-sanitize=vptr
2021-08-17 10:22:03 -07:00
build:ubsan --copt -fno-sanitize-recover=all
build:ubsan --copt -g
build:ubsan --linkopt -fsanitize=undefined
build:ubsan --linkopt -fno-sanitize-recover=all
2021-09-17 19:01:07 -07:00
# Import local specific llvm config options, which can be generated by
# ci/travis/install-llvm-dependencies.sh
2021-10-25 19:52:53 -07:00
try-import %workspace%/.llvm-local.bazelrc