From 85f96a53854c08aca8fc580bdc0a038fc9fbde60 Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Sun, 29 Dec 2019 04:16:01 +0000 Subject: [PATCH] api: shadowing for API protos. (#9429) This is intended to simplify the internal handling of deprecations during API boosting. See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0. Risk level: Low Testing: Additional API test and protoxform golden test. Part of #8082 This should be unwound in the future with #9479 Signed-off-by: Harvey Tuch Mirrored from https://github.com/envoyproxy/envoy @ da5fb5ce6ec7cc6e4693656a5ba2161107f6ac4a --- bazel/api_build_system.bzl | 12 ++++++++---- tools/generate_listeners_test.py | 2 +- tools/tap2pcap.py | 2 +- tools/tap2pcap_test.py | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bazel/api_build_system.bzl b/bazel/api_build_system.bzl index 6f907891..029776e6 100644 --- a/bazel/api_build_system.bzl +++ b/bazel/api_build_system.bzl @@ -149,11 +149,15 @@ def api_go_test(name, **kwargs): **kwargs ) -def api_proto_package(srcs = [], deps = [], has_services = False, visibility = ["//visibility:public"]): +def api_proto_package( + name = "pkg", + srcs = [], + deps = [], + has_services = False, + visibility = ["//visibility:public"]): if srcs == []: srcs = native.glob(["*.proto"]) - name = "pkg" api_cc_py_proto_library( name = name, visibility = visibility, @@ -162,9 +166,9 @@ def api_proto_package(srcs = [], deps = [], has_services = False, visibility = [ has_services = has_services, ) - compilers = ["@io_bazel_rules_go//proto:go_proto", "//bazel:pgv_plugin_go"] + compilers = ["@io_bazel_rules_go//proto:go_proto", "@envoy_api//bazel:pgv_plugin_go"] if has_services: - compilers = ["@io_bazel_rules_go//proto:go_grpc", "//bazel:pgv_plugin_go"] + compilers = ["@io_bazel_rules_go//proto:go_grpc", "@envoy_api//bazel:pgv_plugin_go"] go_proto_library( name = name + _GO_PROTO_SUFFIX, diff --git a/tools/generate_listeners_test.py b/tools/generate_listeners_test.py index 1a163ef9..f98fc438 100644 --- a/tools/generate_listeners_test.py +++ b/tools/generate_listeners_test.py @@ -5,7 +5,7 @@ import os import generate_listeners if __name__ == "__main__": - srcdir = os.path.join(os.getenv("TEST_SRCDIR"), 'envoy_api') + srcdir = os.path.join(os.getenv("TEST_SRCDIR"), 'envoy_api_canonical') generate_listeners.GenerateListeners( os.path.join(srcdir, "examples/service_envoy/listeners.pb"), "/dev/stdout", "/dev/stdout", iter([os.path.join(srcdir, "examples/service_envoy/http_connection_manager.pb")])) diff --git a/tools/tap2pcap.py b/tools/tap2pcap.py index 29eeeb8c..db653272 100644 --- a/tools/tap2pcap.py +++ b/tools/tap2pcap.py @@ -8,7 +8,7 @@ tap files; it is not a literal wire tap. Usage: -bazel run @envoy_api//tools:tap2pcap +bazel run @envoy_api_canonical//tools:tap2pcap Known issues: - IPv6 PCAP generation has malformed TCP packets. This appears to be a text2pcap diff --git a/tools/tap2pcap_test.py b/tools/tap2pcap_test.py index b13bee0f..9f504cf6 100644 --- a/tools/tap2pcap_test.py +++ b/tools/tap2pcap_test.py @@ -11,7 +11,7 @@ import tap2pcap # a golden output file for the tshark dump. Since we run tap2pcap in a # subshell with a limited environment, the inferred time zone should be UTC. if __name__ == '__main__': - srcdir = os.path.join(os.getenv('TEST_SRCDIR'), 'envoy_api') + srcdir = os.path.join(os.getenv('TEST_SRCDIR'), 'envoy_api_canonical') tap_path = os.path.join(srcdir, 'tools/data/tap2pcap_h2_ipv4.pb_text') expected_path = os.path.join(srcdir, 'tools/data/tap2pcap_h2_ipv4.txt') pcap_path = os.path.join(os.getenv('TEST_TMPDIR'), 'generated.pcap')