From be94d5136d9e15e0c49d995ce2b038dd8d9b6cb7 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 26 Feb 2024 19:11:22 +0000 Subject: [PATCH 1/9] wip Change-Id: I4b919b0aa8774458e4efe39d91603d28e6a649bc Signed-off-by: Kuat Yessenov --- api/bazel/repository_locations.bzl | 6 +++--- bazel/repository_locations.bzl | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl index 15265b521878..3c2dcb85c79e 100644 --- a/api/bazel/repository_locations.bzl +++ b/api/bazel/repository_locations.bzl @@ -66,9 +66,9 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Google APIs", project_desc = "Public interface definitions of Google APIs", project_url = "https://github.com/googleapis/googleapis", - version = "114a745b2841a044e98cdbb19358ed29fcf4a5f1", - sha256 = "9b4e0d0a04a217c06b426aefd03b82581a9510ca766d2d1c70e52bb2ad4a0703", - release_date = "2023-01-10", + version = "8df1cd698e2fe0b7d1c298dabafdf13aa01c4d39", + sha256 = "9f529984f4602e7067037ff69f262245c774883f191a90a8c1cc5bbc759ce6a6", + release_date = "2024-02-23", strip_prefix = "googleapis-{version}", urls = ["https://github.com/googleapis/googleapis/archive/{version}.tar.gz"], use_category = ["api"], diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 526603c8f5ad..1a0c4f62407a 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -162,12 +162,12 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Abseil", project_desc = "Open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase", project_url = "https://abseil.io/", - version = "20230802.1", - sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed", + version = "20240116.1", + sha256 = "3c743204df78366ad2eaf236d6631d83f6bc928d1705dd0000b872e53b73dc6a", strip_prefix = "abseil-cpp-{version}", urls = ["https://github.com/abseil/abseil-cpp/archive/{version}.tar.gz"], use_category = ["dataplane_core", "controlplane"], - release_date = "2023-09-18", + release_date = "2024-02-12", cpe = "N/A", license = "Apache-2.0", license_url = "https://github.com/abseil/abseil-cpp/blob/{version}/LICENSE", @@ -1237,8 +1237,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Common Expression Language (CEL) C++ library", project_desc = "Common Expression Language (CEL) C++ library", project_url = "https://opensource.google/projects/cel", - version = "0abd738f9f54388452e6ebb0955eb039f9162b3d", - sha256 = "d163805320a782c5194b7496cdd5e8c9d9604eeffc1e531770cf6b130bc182fd", + version = "9f9e5941161b8f996fdd2b848f406b6188dcba5f", + sha256 = "d163805320a782c5194b7496cdd5e8c9d9604eeffc1e531770cf6b130bc182fe", strip_prefix = "cel-cpp-{version}", urls = ["https://github.com/google/cel-cpp/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], @@ -1259,7 +1259,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.matching.inputs.cel_data_input", "envoy.matching.matchers.cel_matcher", ], - release_date = "2023-12-20", + release_date = "2024-02-24", cpe = "N/A", ), com_github_google_flatbuffers = dict( From 25119dd8c39b0053f406e30da72fb7c22093d05e Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 18 Mar 2024 22:43:31 +0000 Subject: [PATCH 2/9] deps: update cel, absl, googleapis Change-Id: Ie3a82096c5ccfd1212ec226d6c30e9434a6f2623 Signed-off-by: Kuat Yessenov --- bazel/cel-cpp.patch | 171 ++++----------------------------- bazel/repository_locations.bzl | 4 +- 2 files changed, 19 insertions(+), 156 deletions(-) diff --git a/bazel/cel-cpp.patch b/bazel/cel-cpp.patch index 34dd41033e56..666ebf571e03 100644 --- a/bazel/cel-cpp.patch +++ b/bazel/cel-cpp.patch @@ -1,159 +1,22 @@ -diff --git a/base/memory.h b/base/memory.h -index 3552e19..0fbe618 100644 ---- a/base/memory.h -+++ b/base/memory.h -@@ -166,8 +166,8 @@ std::enable_if_t, Handle> HandleFactory::Make( - #if defined(__cpp_lib_is_pointer_interconvertible) && \ - __cpp_lib_is_pointer_interconvertible >= 201907L - // Only available in C++20. -- static_assert(std::is_pointer_interconvertible_base_of_v, -- "F must be pointer interconvertible to Data"); -+// static_assert(std::is_pointer_interconvertible_base_of_v, -+// "F must be pointer interconvertible to Data"); - #endif - if (memory_manager.memory_management() == MemoryManagement::kPooling) { - void* addr; -diff --git a/eval/internal/interop.cc b/eval/internal/interop.cc -index 3acde6c..20f8ea3 100644 ---- a/eval/internal/interop.cc -+++ b/eval/internal/interop.cc -@@ -729,13 +729,14 @@ absl::StatusOr ToLegacyValue(google::protobuf::Arena* arena, - return CelValue::CreateMessageWrapper( - MessageWrapperAccess::Make(message, type_info)); - } -- if (ProtoStructValueToMessageWrapper) { -+ // This weak symbol is never defined in Envoy, and checking it causes linker failures on macOS -+ /*if (ProtoStructValueToMessageWrapper) { - auto maybe_message_wrapper = ProtoStructValueToMessageWrapper(*value); - if (maybe_message_wrapper.has_value()) { - return CelValue::CreateMessageWrapper( - std::move(maybe_message_wrapper).value()); - } -- } -+ }*/ - return absl::UnimplementedError( - "only legacy struct types and values can be used for interop"); - } -diff --git a/eval/public/cel_value.cc b/eval/public/cel_value.cc -index 6aeff6d..c43864c 100644 ---- a/eval/public/cel_value.cc -+++ b/eval/public/cel_value.cc -@@ -107,7 +107,7 @@ struct DebugStringVisitor { - - } // namespace - --const absl::string_view kPayloadUrlMissingAttributePath = -+ABSL_CONST_INIT const absl::string_view kPayloadUrlMissingAttributePath = - cel::runtime_internal::kPayloadUrlMissingAttributePath; - - CelValue CelValue::CreateDuration(absl::Duration value) { -diff --git a/eval/public/containers/container_backed_map_impl.h b/eval/public/containers/container_backed_map_impl.h -index 6092eef..7548bbf 100644 ---- a/eval/public/containers/container_backed_map_impl.h -+++ b/eval/public/containers/container_backed_map_impl.h -@@ -30,6 +30,7 @@ class CelMapBuilder : public CelMap { - return values_map_.contains(cel_key); - } - -+ using CelMap::ListKeys; - absl::StatusOr ListKeys() const override { - return &key_list_; - } -diff --git a/eval/public/containers/internal_field_backed_map_impl.h b/eval/public/containers/internal_field_backed_map_impl.h -index ec773d9..caa2f3a 100644 ---- a/eval/public/containers/internal_field_backed_map_impl.h -+++ b/eval/public/containers/internal_field_backed_map_impl.h -@@ -43,6 +43,7 @@ class FieldBackedMapImpl : public CelMap { - // Presence test function. - absl::StatusOr Has(const CelValue& key) const override; - -+ using CelMap::ListKeys; - absl::StatusOr ListKeys() const override; - - protected: -diff --git a/eval/public/structs/cel_proto_lite_wrap_util.cc b/eval/public/structs/cel_proto_lite_wrap_util.cc -index 4cb21e5..35fdf7f 100644 ---- a/eval/public/structs/cel_proto_lite_wrap_util.cc -+++ b/eval/public/structs/cel_proto_lite_wrap_util.cc -@@ -172,6 +172,7 @@ class DynamicMap : public CelMap { - - int size() const override { return values_->fields_size(); } - -+ using CelMap::ListKeys; - absl::StatusOr ListKeys() const override { - return &key_list_; - } -diff --git a/eval/public/structs/cel_proto_wrap_util.cc b/eval/public/structs/cel_proto_wrap_util.cc -index fabb594..86a314c 100644 ---- a/eval/public/structs/cel_proto_wrap_util.cc -+++ b/eval/public/structs/cel_proto_wrap_util.cc -@@ -137,6 +137,7 @@ class DynamicMap : public CelMap { - - int size() const override { return values_->fields_size(); } - -+ using CelMap::ListKeys; - absl::StatusOr ListKeys() const override { - return &key_list_; +diff --git a/common/types/optional_type.h b/common/types/optional_type.h +index 9af82db..5134af0 100644 +--- a/common/types/optional_type.h ++++ b/common/types/optional_type.h +@@ -66,7 +66,7 @@ class OptionalType final : public OpaqueType { + + absl::Span parameters() const { + auto parameters = OpaqueType::parameters(); +- ABSL_DCHECK_EQ(parameters.size(), 1); ++ ABSL_DCHECK_EQ(parameters.size(), static_cast(1)); + return parameters; } -diff --git a/internal/strings.cc b/internal/strings.cc -index dc5a118..24457ab 100644 ---- a/internal/strings.cc -+++ b/internal/strings.cc -@@ -53,12 +53,12 @@ bool CheckForClosingString(absl::string_view source, - if (closing_str.empty()) return true; - - const char* p = source.data(); -- const char* end = source.end(); -+ const char* end = p + source.size(); - bool is_closed = false; - while (p + closing_str.length() <= end) { - if (*p != '\\') { -- size_t cur_pos = p - source.begin(); -+ size_t cur_pos = p - source.data(); - bool is_closing = - absl::StartsWith(absl::ClippedSubstr(source, cur_pos), closing_str); - if (is_closing && p + closing_str.length() < end) { -@@ -132,7 +132,7 @@ bool UnescapeInternal(absl::string_view source, absl::string_view closing_str, - dest->reserve(source.size()); +@@ -147,7 +147,7 @@ class OptionalTypeView final : public OpaqueTypeView { - const char* p = source.data(); -- const char* end = source.end(); -+ const char* end = p + source.size(); - const char* last_byte = end - 1; - - while (p < end) { -@@ -446,7 +446,9 @@ std::string EscapeInternal(absl::string_view src, bool escape_all_bytes, - // byte. - dest.reserve(src.size() * 4); - bool last_hex_escape = false; // true if last output char was \xNN. -- for (const char* p = src.begin(); p < src.end(); ++p) { -+ const char* p = src.data(); -+ const char* end = p + src.size(); -+ for (; p < end; ++p) { - unsigned char c = static_cast(*p); - bool is_hex_escape = false; - switch (c) { -@@ -552,7 +554,9 @@ std::string EscapeString(absl::string_view str) { - std::string EscapeBytes(absl::string_view str, bool escape_all_bytes, - char escape_quote_char) { - std::string escaped_bytes; -- for (const char* p = str.begin(); p < str.end(); ++p) { -+ const char* p = str.data(); -+ const char* end = p + str.size(); -+ for (; p < end; ++p) { - unsigned char c = *p; - if (escape_all_bytes || !absl::ascii_isprint(c)) { - escaped_bytes += "\\x"; -diff --git a/tools/flatbuffers_backed_impl.cc b/tools/flatbuffers_backed_impl.cc -index 10c0b1c..45ba72f 100644 ---- a/tools/flatbuffers_backed_impl.cc -+++ b/tools/flatbuffers_backed_impl.cc -@@ -130,6 +130,7 @@ class ObjectStringIndexedMapImpl : public CelMap { - return absl::nullopt; + absl::Span parameters() const { + auto parameters = OpaqueTypeView::parameters(); +- ABSL_DCHECK_EQ(parameters.size(), 1); ++ ABSL_DCHECK_EQ(parameters.size(), static_cast(1)); + return parameters; } -+ using CelMap::ListKeys; - absl::StatusOr ListKeys() const override { return &keys_; } - - private: diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 12b403dd6ce2..fa0f41827088 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -1221,8 +1221,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Common Expression Language (CEL) C++ library", project_desc = "Common Expression Language (CEL) C++ library", project_url = "https://opensource.google/projects/cel", - version = "9f9e5941161b8f996fdd2b848f406b6188dcba5f", - sha256 = "d163805320a782c5194b7496cdd5e8c9d9604eeffc1e531770cf6b130bc182fe", + version = "68c8ca3b7ed87d953d8cdaffb20b1468a48b1d83", + sha256 = "9189656524aecbce0d635ba27a0917730c9a6bb114e9785298b46cf6fca5ba45", strip_prefix = "cel-cpp-{version}", urls = ["https://github.com/google/cel-cpp/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], From e335ff46ba3af4d676dc88f0976f91c360a187aa Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 18 Mar 2024 22:54:22 +0000 Subject: [PATCH 3/9] fix date Change-Id: Ib203130db95cc09844d6139439aeeba5e99a4ee7 Signed-off-by: Kuat Yessenov --- bazel/repository_locations.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index fa0f41827088..686bbb178fa6 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -1243,7 +1243,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.matching.inputs.cel_data_input", "envoy.matching.matchers.cel_matcher", ], - release_date = "2024-02-24", + release_date = "2024-03-18", cpe = "N/A", ), com_github_google_flatbuffers = dict( From c838106d8f9da0707838c738fd24ba3266c46bcd Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 26 Mar 2024 20:14:33 +0000 Subject: [PATCH 4/9] fix tests Change-Id: I835d26ec21a843fb4905413768a457bef3aca3a6 Signed-off-by: Kuat Yessenov --- .../path/uri_template_lib/uri_template_test.cc | 13 ++++++++++++- test/server/hot_restarting_child_test.cc | 8 +++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/extensions/path/uri_template_lib/uri_template_test.cc b/test/extensions/path/uri_template_lib/uri_template_test.cc index 14d44b2b8603..018371945f4d 100644 --- a/test/extensions/path/uri_template_lib/uri_template_test.cc +++ b/test/extensions/path/uri_template_lib/uri_template_test.cc @@ -13,10 +13,21 @@ #include "gtest/gtest.h" +// NOLINT(namespace-envoy) +// Overload functions in std library. +namespace std { + +std::ostream& operator<<(std::ostream& os, + const Envoy::Extensions::UriTemplate::RewriteSegment& seg) { + absl::visit([&os](auto&& arg) { os << arg; }, seg); + return os; +} + +} // namespace std + namespace Envoy { namespace Extensions { namespace UriTemplate { - namespace { using ::Envoy::StatusHelpers::IsOkAndHolds; diff --git a/test/server/hot_restarting_child_test.cc b/test/server/hot_restarting_child_test.cc index d16653d6454a..1e42b39ae17f 100644 --- a/test/server/hot_restarting_child_test.cc +++ b/test/server/hot_restarting_child_test.cc @@ -228,9 +228,11 @@ TEST_F(HotRestartingChildTest, ForwardsPacketToRegisteredListenerOnMatch) { packet->set_payload(udp_contents); packet->set_receive_time_epoch_microseconds(packet_timestamp); Network::MockUdpListenerWorkerRouter mock_worker_router; - EXPECT_CALL(*mock_udp_listener_config, - listenerWorkerRouter(WhenDynamicCastTo( - Eq(dynamic_cast(*test_listener_addr))))) + EXPECT_CALL(*mock_udp_listener_config, listenerWorkerRouter(testing::ResultOf( + [](const Network::Address::Instance& instance) { + return instance.asStringView(); + }, + Eq(test_listener_addr->asStringView())))) .WillOnce(ReturnRef(mock_worker_router)); EXPECT_CALL(mock_worker_router, deliver(worker_index, IsUdpWith(test_listener_addr, test_remote_addr, udp_contents, From af7f3c40c602d28535903dd98750b05ae55430cd Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 26 Mar 2024 20:43:11 +0000 Subject: [PATCH 5/9] disable modules on mobile Change-Id: Ie03c2579368c269994cc1f7f6d396c7e57195d0d Signed-off-by: Kuat Yessenov --- mobile/.bazelrc | 1 + 1 file changed, 1 insertion(+) diff --git a/mobile/.bazelrc b/mobile/.bazelrc index 45fc7e138421..06292be7f522 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -39,6 +39,7 @@ build --swiftcopt=-wmo build --repo_env=JAVA_HOME=../bazel_tools/jdk build --define disable_known_issue_asserts=true build --define cxxopts=-std=c++17 +build --copt -fno-modules # Unset per_object_debug_info. Causes failures on Android Linux release builds. build --features=-per_object_debug_info # Suppress deprecated declaration warnings due to extensive transitive noise from protobuf. From bf7ccd749169d3ae1deb64b9f1dedf691de93cd8 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 26 Mar 2024 20:52:52 +0000 Subject: [PATCH 6/9] fix modules Change-Id: I8cd2b6695998346ebeba67e6f4921ef6facb0d2a Signed-off-by: Kuat Yessenov --- mobile/.bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/.bazelrc b/mobile/.bazelrc index 06292be7f522..b684e436ce14 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -39,7 +39,6 @@ build --swiftcopt=-wmo build --repo_env=JAVA_HOME=../bazel_tools/jdk build --define disable_known_issue_asserts=true build --define cxxopts=-std=c++17 -build --copt -fno-modules # Unset per_object_debug_info. Causes failures on Android Linux release builds. build --features=-per_object_debug_info # Suppress deprecated declaration warnings due to extensive transitive noise from protobuf. @@ -201,6 +200,7 @@ build:mobile-remote-ci-linux-clang --action_env=CXX=/opt/llvm/bin/clang++ build:mobile-remote-ci-linux-clang --config=mobile-remote-ci-linux # Temporary revert to C++17 for mobile NDK builds. build:mobile-remote-ci-linux-clang --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build:mobile-remote-ci-linux-clang --copt -fno-modules ############################################################################# # mobile-remote-ci-linux-asan: These options are Linux-only using Clang and AddressSanitizer From ada1a62f18e8d2a74f2ce5d966879c6e568913b0 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 26 Mar 2024 23:42:08 +0000 Subject: [PATCH 7/9] again? Change-Id: I032714f533fb951e0abcfef36229a11f37e3655b Signed-off-by: Kuat Yessenov --- mobile/.bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/.bazelrc b/mobile/.bazelrc index b684e436ce14..6884846309e0 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -200,7 +200,7 @@ build:mobile-remote-ci-linux-clang --action_env=CXX=/opt/llvm/bin/clang++ build:mobile-remote-ci-linux-clang --config=mobile-remote-ci-linux # Temporary revert to C++17 for mobile NDK builds. build:mobile-remote-ci-linux-clang --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -build:mobile-remote-ci-linux-clang --copt -fno-modules +build:mobile-remote-ci-linux-clang --copt -fno-cxx-modules ############################################################################# # mobile-remote-ci-linux-asan: These options are Linux-only using Clang and AddressSanitizer From d1c5560e7256867d7b7a128ea48c66409a2578df Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 6 May 2024 21:03:54 +0000 Subject: [PATCH 8/9] undo Change-Id: Ie4e45d602161c3c1bef9b3aca797010628fdd18a Signed-off-by: Kuat Yessenov --- mobile/.bazelrc | 1 - 1 file changed, 1 deletion(-) diff --git a/mobile/.bazelrc b/mobile/.bazelrc index 42423bc9387a..0ce21abe7a5f 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -179,7 +179,6 @@ build:mobile-remote-ci-linux-clang --action_env=CXX=/opt/llvm/bin/clang++ build:mobile-remote-ci-linux-clang --config=mobile-remote-ci-linux # Temporary revert to C++17 for mobile NDK builds. build:mobile-remote-ci-linux-clang --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -build:mobile-remote-ci-linux-clang --copt -fno-cxx-modules ############################################################################# # mobile-remote-ci-linux-asan: These options are Linux-only using Clang and AddressSanitizer From be5afe119c1927adc4fdaa98568845f37d668c26 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 6 May 2024 22:56:05 +0000 Subject: [PATCH 9/9] disable layering check Change-Id: If952fa80e46ce5f2b8733dc386b1548250cfce1b Signed-off-by: Kuat Yessenov --- mobile/third_party/rbe_configs/cc/cc_toolchain_config.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/third_party/rbe_configs/cc/cc_toolchain_config.bzl b/mobile/third_party/rbe_configs/cc/cc_toolchain_config.bzl index 26119141059c..b1bd5684f98c 100644 --- a/mobile/third_party/rbe_configs/cc/cc_toolchain_config.bzl +++ b/mobile/third_party/rbe_configs/cc/cc_toolchain_config.bzl @@ -1231,7 +1231,7 @@ def _impl(ctx): user_compile_flags_feature, sysroot_feature, unfiltered_compile_flags_feature, - ] + layering_check_features(ctx.attr.compiler) + ] else: features = [ supports_pic_feature, @@ -1251,7 +1251,7 @@ def _impl(ctx): user_compile_flags_feature, sysroot_feature, unfiltered_compile_flags_feature, - ] + layering_check_features(ctx.attr.compiler) + ] return cc_common.create_cc_toolchain_config_info( ctx = ctx,