Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
12 changes: 12 additions & 0 deletions bazel/envoy_mobile_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
115 changes: 29 additions & 86 deletions bazel/protobuf.patch
Original file line number Diff line number Diff line change
@@ -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__)
2 changes: 1 addition & 1 deletion envoy
Submodule envoy updated 406 files
3 changes: 2 additions & 1 deletion library/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ envoy_status_t Engine::run(const std::string config, const std::string log_level

envoy_status_t Engine::main(const std::string config, const std::string log_level) {
// Using unique_ptr ensures main_common's lifespan is strictly scoped to this function.
Thread::MainThread main_thread_;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we register this in EngineCommon like Envoy is doing: envoyproxy/envoy@bcf6729#diff-51c9c3d59b80fbaef57384b42c3137d0a8c1c5cd46ebd86baeb48bd4d709f0d6R228?

Also two nits:

  1. Can we change the name to something like register_main_thread so that it is not confused?
  2. FYI suffix _ is used as a convetion for instance variables not for local variables like this one.

std::unique_ptr<EngineCommon> main_common;
const std::string name = "envoy";
const std::string config_flag = "--config-yaml";
Expand Down Expand Up @@ -100,7 +101,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();
Expand Down