From 2bcfbd8aa0e487879dbefc9232c498ebbbe9ada7 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 8 Nov 2023 08:13:18 -0800 Subject: [PATCH] Add Bazel `--incompatible` flags to our bazelrc for CI I was thinking it would be a good idea to proactively opt into all upcoming breaking change flag flips in Bazel, so this change does that by adding all the relevant flags to the common bazelrc file we use in our CI jobs. There are several that we cannot enable yet without breaking something, so I left those commented out for now. PiperOrigin-RevId: 580538273 --- ci/common.bazelrc | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/ci/common.bazelrc b/ci/common.bazelrc index e5345cfd69..623a9280ea 100644 --- a/ci/common.bazelrc +++ b/ci/common.bazelrc @@ -1,6 +1,3 @@ -# Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195) -build --incompatible_disallow_empty_glob - build:dbg --compilation_mode=dbg build:opt --compilation_mode=opt @@ -34,3 +31,42 @@ build:ubsan --copt=-DUNDEFINED_SANITIZER=1 # Workaround for the fact that Bazel links with $CC, not $CXX # https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748 build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr + +# Build with all --incompatible flags that we can. This helps us prepare for +# upcoming breaking changes in Bazel. This list was generated for Bazel 6 by +# running bazelisk with the --migrate flag and filtering out all flags that +# default to true or are deprecated. +build --incompatible_check_sharding_support +build --incompatible_default_to_explicit_init_py +build --incompatible_disable_native_android_rules +build --incompatible_disable_runtimes_filegroups +build --incompatible_disable_target_provider_fields +build --incompatible_disallow_empty_glob +build --incompatible_dont_use_javasourceinfoprovider +build --incompatible_enable_android_toolchain_resolution +build --incompatible_enable_apple_toolchain_resolution +build --incompatible_exclusive_test_sandboxed +build --incompatible_remote_output_paths_relative_to_input_root +build --incompatible_remote_use_new_exit_code_for_lost_inputs +build --incompatible_sandbox_hermetic_tmp +build --incompatible_struct_has_no_methods +build --incompatible_top_level_aspects_require_providers +build --incompatible_use_cc_configure_from_rules_cc +build --incompatible_use_host_features + +# We cannot yet build successfully with the following flags: +# --incompatible_check_testonly_for_output_files +# --incompatible_config_setting_private_default_visibility +# --incompatible_disable_starlark_host_transitions +# --incompatible_disallow_struct_provider_syntax +# --incompatible_no_implicit_file_export +# --incompatible_no_rule_outputs_param +# --incompatible_stop_exporting_language_modules +# --incompatible_strict_action_env +# --incompatible_visibility_private_attributes_at_definition + +# We might be compatible with these flags, but they are not available in all +# Bazel versions we are currently using: +# --incompatible_disable_objc_library_transition +# --incompatible_fail_on_unknown_attributes +# --incompatible_merge_fixed_and_default_shell_env