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 <htuch@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ da5fb5ce6ec7cc6e4693656a5ba2161107f6ac4a
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent cb58ba3854
commit 85f96a5385
  1. 12
      bazel/api_build_system.bzl
  2. 2
      tools/generate_listeners_test.py
  3. 2
      tools/tap2pcap.py
  4. 2
      tools/tap2pcap_test.py

@ -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,

@ -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")]))

@ -8,7 +8,7 @@ tap files; it is not a literal wire tap.
Usage:
bazel run @envoy_api//tools:tap2pcap <tap .pb/.pb_text> <pcap path>
bazel run @envoy_api_canonical//tools:tap2pcap <tap .pb/.pb_text> <pcap path>
Known issues:
- IPv6 PCAP generation has malformed TCP packets. This appears to be a text2pcap

@ -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')

Loading…
Cancel
Save