aboutsummaryrefslogtreecommitdiff
path: root/.bazelrc
diff options
context:
space:
mode:
Diffstat (limited to '.bazelrc')
-rw-r--r--.bazelrc76
1 files changed, 63 insertions, 13 deletions
diff --git a/.bazelrc b/.bazelrc
index 78b0d871..ed20aac3 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,49 +1,94 @@
+# 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
build --incompatible_enable_cc_toolchain_resolution
+# Required by abseil-cpp.
+build --cxxopt=-std=c++14
# Requires a relatively modern clang.
build:ci --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
# Java
+# Always build for Java 8, even with a newer JDK. This ensures that all
+# artifacts we release are compatible with Java 8 runtimes.
+# Note: We would like to use --release, but can't due to
+# https://bugs.openjdk.org/browse/JDK-8214165.
+build --javacopt=-target --javacopt=8
build --java_language_version=8
-build --tool_java_language_version=9
+build --tool_java_language_version=8
+# Use a hermetic JDK to compile Java code, which also means that contributors
+# don't need to install a JDK to compile Jazzer.
+build --java_runtime_version=remotejdk_17
+build --tool_java_runtime_version=remotejdk_17
+# Speed up Java compilation by removing indirect deps from the compile classpath.
+build --experimental_java_classpath=bazel
+
+# Android
+build:android_arm --incompatible_enable_android_toolchain_resolution
+build:android_arm --android_platforms=//:android_arm64
+build:android_arm --copt=-D_ANDROID
+build:android_arm --java_runtime_version=local_jdk
# 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=//:x64_windows-clang-cl
+build:windows --extra_execution_platforms=//bazel/platforms:x64_windows-clang-cl
build:windows --features=static_link_msvcrt
# 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
+# macOS
+# Workaround for https://github.com/bazelbuild/bazel/issues/13944, which breaks external Java
+# dependencies on M1 Macs without Rosetta.
+build:macos --extra_toolchains=//bazel/toolchains:java_non_prebuilt_definition
+
# Toolchain
# Since the toolchain is conditional on OS and architecture, set it on the particular GitHub Action.
-build:toolchain --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
-build:toolchain --//third_party:toolchain
+common:toolchain --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Forward debug variables to tests
-test --test_env=JAZZER_AUTOFUZZ_DEBUG
-test --test_env=JAZZER_REFLECTION_DEBUG
+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)
-test:ci --test_env=JAZZER_CI=1
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
-# Maven publishing (local only, requires GPG signature)
-build:maven --config=toolchain
-build:maven --stamp
-build:maven --define "maven_repo=https://oss.sonatype.org/service/local/staging/deploy/maven2"
-build:maven --java_runtime_version=local_jdk_8
+# Docker images
+common:docker --config=toolchain
+common:docker --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
# Generic coverage configuration taken from https://github.com/fmeum/rules_jni
coverage --combined_report=lcov
@@ -54,5 +99,10 @@ 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=^//agent/src/main[:/],^//driver:,^//sanitizers/src/main[:/]
+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