diff --git a/bazel/envoy_mobile_repositories.bzl b/bazel/envoy_mobile_repositories.bzl index 7d634d6292..9956bc4327 100644 --- a/bazel/envoy_mobile_repositories.bzl +++ b/bazel/envoy_mobile_repositories.bzl @@ -15,6 +15,18 @@ def envoy_mobile_repositories(): python_repos() def upstream_envoy_overrides(): + # Workaround due to a Detekt version compatibility with protobuf: https://github.com/envoyproxy/envoy-mobile/issues/1869 + http_archive( + name = "com_google_protobuf", + patch_args = ["-p1"], + patches = [ + "@envoy_mobile//bazel:protobuf.patch", + ], + sha256 = "d7371dc2d46fddac1af8cb27c0394554b068768fc79ecaf5be1a1863e8ff3392", + strip_prefix = "protobuf-3.16.0", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.16.0/protobuf-all-3.16.0.tar.gz"], + ) + # Workaround old NDK version breakages https://github.com/lyft/envoy-mobile/issues/934 http_archive( name = "com_github_libevent_libevent", diff --git a/bazel/protobuf.patch b/bazel/protobuf.patch index e9f34fa5ec..e786c7ebe1 100644 --- a/bazel/protobuf.patch +++ b/bazel/protobuf.patch @@ -1,94 +1,37 @@ +# https://github.com/protocolbuffers/protobuf/pull/6720 +diff --git a/third_party/BUILD b/third_party/BUILD +new file mode 100644 +index 0000000000..b66101a39a +--- /dev/null ++++ b/third_party/BUILD +@@ -0,0 +1 @@ ++exports_files(["six.BUILD", "zlib.BUILD"]) + +# patching for zlib binding diff --git a/BUILD b/BUILD -index 07ee629..09541cf 100644 +index efc3d8e7f..746ad4851 100644 --- a/BUILD +++ b/BUILD -@@ -260,36 +260,38 @@ cc_library( - # Map of all well known protos. - # name => (include path, imports) - WELL_KNOWN_PROTO_MAP = { -- "any": ("src/google/protobuf/any.proto", []), -+ "any": ("google/protobuf/any.proto", []), - "api": ( -- "src/google/protobuf/api.proto", -+ "google/protobuf/api.proto", - [ - "source_context", - "type", - ], - ), - "compiler_plugin": ( -- "src/google/protobuf/compiler/plugin.proto", -+ "google/protobuf/compiler/plugin.proto", - ["descriptor"], - ), -- "descriptor": ("src/google/protobuf/descriptor.proto", []), -- "duration": ("src/google/protobuf/duration.proto", []), -- "empty": ("src/google/protobuf/empty.proto", []), -- "field_mask": ("src/google/protobuf/field_mask.proto", []), -- "source_context": ("src/google/protobuf/source_context.proto", []), -- "struct": ("src/google/protobuf/struct.proto", []), -- "timestamp": ("src/google/protobuf/timestamp.proto", []), -+ "descriptor": ("google/protobuf/descriptor.proto", []), -+ "duration": ("google/protobuf/duration.proto", []), -+ "empty": ("google/protobuf/empty.proto", []), -+ "field_mask": ("google/protobuf/field_mask.proto", []), -+ "source_context": ("google/protobuf/source_context.proto", []), -+ "struct": ("google/protobuf/struct.proto", []), -+ "timestamp": ("google/protobuf/timestamp.proto", []), - "type": ( -- "src/google/protobuf/type.proto", -+ "google/protobuf/type.proto", - [ - "any", - "source_context", - ], - ), -- "wrappers": ("src/google/protobuf/wrappers.proto", []), -+ "wrappers": ("google/protobuf/wrappers.proto", []), - } +@@ -24,7 +24,7 @@ config_setting( + # ZLIB configuration + ################################################################################ --WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()] -+RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()] -+ -+WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] +-ZLIB_DEPS = ["@zlib//:zlib"] ++ZLIB_DEPS = ["//external:zlib"] - filegroup( - name = "well_known_protos", -@@ -321,10 +323,17 @@ cc_library( - # ) ################################################################################ + # Protobuf Runtime Library +diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py +index 97ac28028..8b7585d9d 100644 +--- a/python/google/protobuf/__init__.py ++++ b/python/google/protobuf/__init__.py +@@ -31,3 +31,9 @@ + # Copyright 2007 Google Inc. All Rights Reserved. -+internal_copied_filegroup( -+ name = "_internal_wkt_protos", -+ srcs = WELL_KNOWN_PROTOS, -+ dest = "", -+ strip_prefix = "src", -+ visibility = ["//visibility:private"], -+) + __version__ = '3.16.0' + - [proto_library( - name = proto[0] + "_proto", - srcs = [proto[1][0]], -- strip_import_prefix = "src", - visibility = ["//visibility:public"], - deps = [dep + "_proto" for dep in proto[1][1]], - ) for proto in WELL_KNOWN_PROTO_MAP.items()] -@@ -824,7 +833,8 @@ internal_copied_filegroup( - - # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in - # which case we can simply add :protos_python in srcs. --COPIED_WELL_KNOWN_PROTOS = ["python/" + s[4:] for s in WELL_KNOWN_PROTOS] -+ -+COPIED_WELL_KNOWN_PROTOS = ["python/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] - - py_proto_library( - name = "protobuf_python", -@@ -942,7 +952,7 @@ cc_library( - - proto_lang_toolchain( - name = "cc_toolchain", -- blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], -+ blacklisted_protos = [":_internal_wkt_protos_genrule"], - command_line = "--cpp_out=$(OUT)", - runtime = ":protobuf", - visibility = ["//visibility:public"], ++if __name__ != '__main__': ++ try: ++ __import__('pkg_resources').declare_namespace(__name__) ++ except ImportError: ++ __path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/envoy b/envoy index 3941b63661..5423325ccf 160000 --- a/envoy +++ b/envoy @@ -1 +1 @@ -Subproject commit 3941b63661c3ea8916cb9d370eaf26182765db68 +Subproject commit 5423325ccf04c7f50069cb8662e51208526bd4a9 diff --git a/library/common/engine.cc b/library/common/engine.cc index 5e4e9a79c8..cd862f1fc6 100644 --- a/library/common/engine.cc +++ b/library/common/engine.cc @@ -100,7 +100,7 @@ envoy_status_t Engine::main(const std::string config, const std::string log_leve postinit_callback_handler_ = main_common->server()->lifecycleNotifier().registerCallback( Envoy::Server::ServerLifecycleNotifier::Stage::PostInit, [this]() -> void { - ASSERT(Thread::MainThread::isMainThread()); + ASSERT(Thread::MainThread::isMainOrTestThread()); network_configurator_ = Network::ConfiguratorFactory{server_->serverFactoryContext()}.get(); diff --git a/library/common/engine_common.h b/library/common/engine_common.h index 3fce9a91ea..c979737c7a 100644 --- a/library/common/engine_common.h +++ b/library/common/engine_common.h @@ -39,6 +39,7 @@ class EngineCommon { Envoy::TerminateHandler log_on_terminate_; #endif + Thread::MainThread register_main_thread_; Envoy::OptionsImpl options_; Event::RealTimeSystem real_time_system_; // NO_CHECK_FORMAT(real_time) DefaultListenerHooks default_listener_hooks_;