From 964ea7dfddde433eca763880dca2774074e01441 Mon Sep 17 00:00:00 2001 From: Ted Poole Date: Thu, 6 Jun 2024 12:13:44 +0100 Subject: [PATCH] Fixed bazel configuration ambiguity for non HTTP3 builds (#34483) To avoid ambiguity when building with //bazel:http3=False (on PPC and Windows) this commit adds 2 new config_setting_groups and updates the relevant select() statements. Signed-off-by: Ted Poole --- bazel/BUILD | 58 ++++++++++++++++++++++++++++++++++++++++++ source/exe/BUILD | 7 ++--- test/config_test/BUILD | 7 ++--- 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/bazel/BUILD b/bazel/BUILD index c4749d3140d3..b6c11d2f029c 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -351,6 +351,64 @@ selects.config_setting_group( ], ) +selects.config_setting_group( + name = "disable_http3_on_linux_ppc", + match_all = [ + ":disable_http3", + ":linux_ppc", + ], +) + +selects.config_setting_group( + name = "disable_http3_on_windows_x86_64", + match_all = [ + ":disable_http3", + ":windows_x86_64", + ], +) + +bool_flag( + name = "enabled", + build_setting_default = True, + visibility = ["//visibility:private"], +) + +bool_flag( + name = "disabled", + build_setting_default = False, + visibility = ["//visibility:private"], +) + +# Alias equal to "not(":disable_http3")" (if "not()" existed). +alias( + name = "enable_http3_setting", + actual = select({ + ":disable_http3": ":disabled", + "//conditions:default": ":enabled", + }), +) + +config_setting( + name = "enable_http3", + flag_values = {":enable_http3_setting": "True"}, +) + +selects.config_setting_group( + name = "enable_http3_on_linux_ppc", + match_all = [ + ":enable_http3", + ":linux_ppc", + ], +) + +selects.config_setting_group( + name = "enable_http3_on_windows_x86_64", + match_all = [ + ":enable_http3", + ":windows_x86_64", + ], +) + config_setting( name = "disable_admin_html", values = {"define": "admin_html=disabled"}, diff --git a/source/exe/BUILD b/source/exe/BUILD index 905a09ff4627..59246022ad08 100644 --- a/source/exe/BUILD +++ b/source/exe/BUILD @@ -45,9 +45,10 @@ envoy_cc_library( "//source/server:options_base", "//source/server:server_base_lib", ] + select({ - "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), - "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), - "//bazel:disable_http3": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS), + "//bazel:enable_http3_on_windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:enable_http3_on_linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//bazel:disable_http3_on_windows_x86_64": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS + WINDOWS_SKIP_TARGETS), + "//bazel:disable_http3_on_linux_ppc": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS + PPC_SKIP_TARGETS), "//conditions:default": envoy_all_extensions(), }), ) diff --git a/test/config_test/BUILD b/test/config_test/BUILD index b0b664f2bece..43561cd54f84 100644 --- a/test/config_test/BUILD +++ b/test/config_test/BUILD @@ -63,9 +63,10 @@ envoy_cc_test_library( "//test/test_common:simulated_time_system_lib", "//test/test_common:threadsafe_singleton_injector_lib", ] + select({ - "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), - "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), - "//bazel:disable_http3": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS), + "//bazel:enable_http3_on_windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:enable_http3_on_linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//bazel:disable_http3_on_windows_x86_64": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS + WINDOWS_SKIP_TARGETS), + "//bazel:disable_http3_on_linux_ppc": envoy_all_extensions(NO_HTTP3_SKIP_TARGETS + PPC_SKIP_TARGETS), "//conditions:default": envoy_all_extensions(), }), )