Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envoy Mobile: making exception-free build the default #35093

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ checks:
required: true
on-run:
- mobile-cc
mobile-compile-time-options:
name: Mobile/Compile time options
on-run:
- mobile-compile-time-cc
- mobile-compile-time-options
mobile-coverage:
name: Mobile/Coverage
required: true
Expand Down Expand Up @@ -217,32 +212,6 @@ run:
- test/integration/*
- test/mocks/**/*
- test/test_common/**/*
mobile-compile-time-cc:
paths:
- .bazelrc
- .bazelversion
- .github/config.yml
- api/**/*
- bazel/external/quiche.BUILD
- bazel/repository_locations.bzl
- envoy/**/*
- mobile/.bazelrc
- mobile/**/*
- source/**/*
- test/config/**/*
- test/integration/*
- test/mocks/**/*
- test/test_common/**/*
mobile-compile-time-options:
paths:
- .bazelrc
- .bazelversion
- .github/config.yml
- bazel/external/quiche.BUILD
- bazel/repository_locations.bzl
- mobile/.bazelrc
- mobile/**/*
- tools/code_format/check_format.py
mobile-coverage:
paths:
- .bazelrc
Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/mobile-compile_time_options.yml

This file was deleted.

2 changes: 2 additions & 0 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ load(
_envoy_select_boringssl = "envoy_select_boringssl",
_envoy_select_disable_exceptions = "envoy_select_disable_exceptions",
_envoy_select_disable_logging = "envoy_select_disable_logging",
_envoy_select_enable_exceptions = "envoy_select_enable_exceptions",
_envoy_select_enable_http3 = "envoy_select_enable_http3",
_envoy_select_enable_http_datagrams = "envoy_select_enable_http_datagrams",
_envoy_select_enable_yaml = "envoy_select_enable_yaml",
Expand Down Expand Up @@ -239,6 +240,7 @@ envoy_select_google_grpc = _envoy_select_google_grpc
envoy_select_enable_http3 = _envoy_select_enable_http3
envoy_select_enable_yaml = _envoy_select_enable_yaml
envoy_select_disable_exceptions = _envoy_select_disable_exceptions
envoy_select_enable_exceptions = _envoy_select_enable_exceptions
envoy_select_hot_restart = _envoy_select_hot_restart
envoy_select_enable_http_datagrams = _envoy_select_enable_http_datagrams
envoy_select_signal_trace = _envoy_select_signal_trace
Expand Down
7 changes: 7 additions & 0 deletions bazel/envoy_select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def envoy_select_disable_exceptions(xs, repository = ""):
"//conditions:default": [],
})

# Selects the given values if exceptions are enabled in the current build.
def envoy_select_enable_exceptions(xs, repository = ""):
return select({
repository + "//bazel:disable_exceptions": [],
"//conditions:default": xs,
})

# Selects the given values if HTTP datagram support is enabled in the current build.
def envoy_select_enable_http_datagrams(xs, repository = ""):
return select({
Expand Down
1 change: 1 addition & 0 deletions contrib/generic_proxy/filters/network/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ envoy_cc_test(
"//source/extensions/transport_sockets/raw_buffer:config",
"//test/common/upstream:utility_lib",
"//test/integration:base_integration_test_lib",
"//test/integration:common_extensions_lib",
"//test/mocks/server:factory_context_mocks",
"//test/mocks/upstream:cluster_info_mocks",
"//test/test_common:registry_lib",
Expand Down
3 changes: 3 additions & 0 deletions mobile/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ build --experimental_repository_downloader_retries=2
build --define=google_grpc=disabled
build --define=envoy_yaml=disabled
build --define=envoy_full_protos=disabled
build --define envoy_exceptions=disabled
build: --copt=-fno-exceptions

# We don't have a ton of Swift in Envoy Mobile, so always build with WMO
# This also helps work around a bug in rules_swift: https://github.com/bazelbuild/rules_swift/issues/949
Expand Down Expand Up @@ -242,6 +244,7 @@ test:mobile-remote-ci-android --config=mobile-test-android
build:mobile-remote-ci-cc --config=mobile-remote-ci
test:mobile-remote-ci-cc --action_env=LD_LIBRARY_PATH

# TODO(alyssar) remove in a follow-up PR
build:mobile-remote-ci-cc-no-exceptions --config=mobile-remote-ci-cc
build:mobile-remote-ci-cc-no-exceptions --define envoy_exceptions=disabled
build:mobile-remote-ci-cc-no-exceptions --copt=-fno-exceptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ envoy_extension_cc_test(
"//library/common/api:external_api_lib",
"//library/common/extensions/filters/http/platform_bridge:config",
"//library/common/extensions/filters/http/platform_bridge:filter_cc_proto",
"@envoy//test/integration:http_integration_lib",
"@envoy//test/integration:http_integration_lib_light",
"@envoy//test/mocks/server:factory_context_mocks",
"@envoy//test/test_common:simulated_time_system_lib",
"@envoy//test/test_common:utility_lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ envoy_extension_cc_test(
"//library/common/extensions/stat_sinks/metrics_service:config",
"//library/common/extensions/stat_sinks/metrics_service:config_proto_cc_proto",
"//library/common/extensions/stat_sinks/metrics_service:service_cc_proto",
"@envoy//test/integration:http_integration_lib",
"@envoy//test/integration:http_integration_lib_light",
"@envoy//test/mocks/grpc:grpc_mocks",
"@envoy//test/mocks/local_info:local_info_mocks",
"@envoy//test/mocks/thread_local:thread_local_mocks",
Expand Down
2 changes: 1 addition & 1 deletion mobile/test/common/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ envoy_cc_test_library(
"//library/common/http:header_utility_lib",
"//library/common/types:c_types_lib",
"@envoy//test/common/http:common_lib",
"@envoy//test/integration:http_integration_lib",
"@envoy//test/integration:http_integration_lib_light",
"@envoy//test/test_common:utility_lib",
],
)
Expand Down
12 changes: 6 additions & 6 deletions source/common/listener_manager/filter_chain_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void FilterChainManagerImpl::addFilterChains(
for (const auto& filter_chain : filter_chain_span) {
const auto& filter_chain_match = filter_chain->filter_chain_match();
if (!filter_chain_match.address_suffix().empty() || filter_chain_match.has_suffix_len()) {
throw EnvoyException(fmt::format(
throwEnvoyExceptionOrPanic(fmt::format(
"error adding listener '{}': filter chain '{}' contains "
"unimplemented fields",
absl::StrJoin(addresses_, ",", Network::AddressStrFormatter()), filter_chain->name()));
Expand All @@ -157,7 +157,7 @@ void FilterChainManagerImpl::addFilterChains(
MessageUtil::getJsonStringFromMessageOrError(filter_chain_match, false));
#endif

throw EnvoyException(error_msg);
throwEnvoyExceptionOrPanic(error_msg);
}
filter_chains.insert({filter_chain_match, filter_chain->name()});
}
Expand All @@ -175,14 +175,14 @@ void FilterChainManagerImpl::addFilterChains(
// If using the matcher, require usage of "name" field and skip building the index.
if (filter_chain_matcher) {
if (filter_chain->name().empty()) {
throw EnvoyException(fmt::format(
throwEnvoyExceptionOrPanic(fmt::format(
"error adding listener '{}': \"name\" field is required when using a listener matcher",
absl::StrJoin(addresses_, ",", Network::AddressStrFormatter())));
}
auto [_, inserted] =
filter_chains_by_name.try_emplace(filter_chain->name(), filter_chain_impl);
if (!inserted) {
throw EnvoyException(fmt::format(
throwEnvoyExceptionOrPanic(fmt::format(
"error adding listener '{}': \"name\" field is duplicated with value '{}'",
absl::StrJoin(addresses_, ",", Network::AddressStrFormatter()), filter_chain->name()));
}
Expand Down Expand Up @@ -213,7 +213,7 @@ void FilterChainManagerImpl::addFilterChains(
// Reject partial wildcards, we don't match on them.
for (const auto& server_name : filter_chain_match.server_names()) {
if (absl::StrContains(server_name, '*') && !isWildcardServerName(server_name)) {
throw EnvoyException(
throwEnvoyExceptionOrPanic(
fmt::format("error adding listener '{}': partial wildcards are not supported in "
"\"server_names\"",
absl::StrJoin(addresses_, ",", Network::AddressStrFormatter())));
Expand Down Expand Up @@ -442,7 +442,7 @@ void FilterChainManagerImpl::addFilterChainForSourcePorts(
// If we got here and found already configured branch, then it means that this FilterChainMatch
// is a duplicate, and that there is some overlap in the repeated fields with already processed
// FilterChainMatches.
throw EnvoyException(
throwEnvoyExceptionOrPanic(
fmt::format("error adding listener '{}': multiple filter chains with "
"overlapping matching rules are defined",
absl::StrJoin(addresses_, ",", Network::AddressStrFormatter())));
Expand Down
4 changes: 1 addition & 3 deletions source/common/listener_manager/lds_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ LdsApiImpl::onConfigUpdate(const std::vector<Config::DecodedResourceRef>& added_
}
}
END_TRY
catch (const EnvoyException& e) {
onError(e.what());
}
CATCH(EnvoyException & e, { onError(e.what()); })
}
listener_manager_.endListenerUpdate(std::move(failure_state));

Expand Down
Loading