From 4b80cadaba0ea8a13e27b5f1f7f1e02b26abc72e Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Tue, 16 Jul 2019 22:43:15 -0700 Subject: [PATCH 01/12] WIP Signed-off-by: Kuat Yessenov --- WORKSPACE | 9 ++ api/bazel/api_build_system.bzl | 20 +-- api/bazel/repositories.bzl | 168 +---------------------- api/bazel/repository_locations.bzl | 6 +- bazel/foreign_cc/io_opencensus_cpp.patch | 11 -- bazel/repositories.bzl | 3 +- bazel/repository_locations.bzl | 6 +- 7 files changed, 31 insertions(+), 192 deletions(-) delete mode 100644 bazel/foreign_cc/io_opencensus_cpp.patch diff --git a/WORKSPACE b/WORKSPACE index bc3ce13bd3a76..2c98b318be31d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -17,3 +17,12 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe go_rules_dependencies() go_register_toolchains(go_version = GO_VERSION) + +load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") + +switched_rules_by_language( + name = "com_google_googleapis_imports", + cc = True, + grpc = True, + go = True, +) diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 192fdfaa82212..5188155f78227 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -31,9 +31,8 @@ def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): protoc = "@com_google_protobuf//:protoc", deps = [_LibrarySuffix(d, _PY_SUFFIX) for d in deps] + [ "@com_envoyproxy_protoc_gen_validate//validate:validate_py", - "@googleapis//:api_httpbody_protos_py", - "@googleapis//:http_api_protos_py", - "@googleapis//:rpc_status_protos_py", + # "@com_google_googleapis//:api_httpbody_protos_py", + # "@com_google_googleapis//:http_api_protos_py", "@com_github_gogo_protobuf//:gogo_proto_py", ], visibility = ["//visibility:public"], @@ -53,7 +52,7 @@ def api_go_proto_library(name, proto, deps = []): "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@com_envoyproxy_protoc_gen_validate//validate:go_default_library", - "@googleapis//:rpc_status_go_proto", + "@com_google_googleapis//google/rpc:status_go_proto", ], ) @@ -70,7 +69,8 @@ def api_go_grpc_library(name, proto, deps = []): "@io_bazel_rules_go//proto/wkt:struct_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@com_envoyproxy_protoc_gen_validate//validate:go_default_library", - "@googleapis//:http_api_go_proto", + "@com_google_googleapis//google/api:http_go_proto", + "@com_google_googleapis//google/api:annotations_go_proto", ], ) @@ -109,8 +109,9 @@ def api_proto_library( "@com_google_protobuf//:struct_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", - "@googleapis//:http_api_protos_proto", - "@googleapis//:rpc_status_protos_lib", + "@com_google_googleapis//google/api:http_proto", + "@com_google_googleapis//google/api:annotations_proto", + "@com_google_googleapis//google/rpc:status_proto", "@com_github_gogo_protobuf//:gogo_proto", "@com_envoyproxy_protoc_gen_validate//validate:validate_proto", ], @@ -121,8 +122,9 @@ def api_proto_library( linkstatic = linkstatic, cc_deps = [_LibrarySuffix(d, _CC_SUFFIX) for d in deps] + external_cc_proto_deps + [ "@com_github_gogo_protobuf//:gogo_proto_cc", - "@googleapis//:http_api_protos", - "@googleapis//:rpc_status_protos", + "@com_google_googleapis//google/api:http_cc_proto", + "@com_google_googleapis//google/api:annotations_cc_proto", + "@com_google_googleapis//google/rpc:status_cc_proto", ], deps = [":" + name], visibility = ["//visibility:public"], diff --git a/api/bazel/repositories.bzl b/api/bazel/repositories.bzl index 67d38c4fb57a8..71ec587c52f2f 100644 --- a/api/bazel/repositories.bzl +++ b/api/bazel/repositories.bzl @@ -12,7 +12,7 @@ def api_dependencies(): locations = REPOSITORY_LOCATIONS, ) envoy_http_archive( - name = "googleapis", + name = "com_google_googleapis", locations = REPOSITORY_LOCATIONS, build_file_content = GOOGLEAPIS_BUILD_CONTENT, ) @@ -38,175 +38,15 @@ def api_dependencies(): GOOGLEAPIS_BUILD_CONTENT = """ load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") - -filegroup( - name = "api_httpbody_protos_src", - srcs = [ - "google/api/httpbody.proto", - ], - visibility = ["//visibility:public"], -) - -proto_library( - name = "api_httpbody_protos_proto", - srcs = [":api_httpbody_protos_src"], - deps = ["@com_google_protobuf//:descriptor_proto"], - visibility = ["//visibility:public"], -) - -cc_proto_library( - name = "api_httpbody_protos", - deps = [":api_httpbody_protos_proto"], - visibility = ["//visibility:public"], -) - -py_proto_library( - name = "api_httpbody_protos_py", - srcs = [ - "google/api/httpbody.proto", - ], - include = ".", - default_runtime = "@com_google_protobuf//:protobuf_python", - protoc = "@com_google_protobuf//:protoc", - visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:protobuf_python"], -) - -go_proto_library( - name = "api_httpbody_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/httpbody", - proto = ":api_httpbody_protos_proto", - visibility = ["//visibility:public"], - deps = [ - ":descriptor_go_proto", - ], -) - -filegroup( - name = "http_api_protos_src", - srcs = [ - "google/api/annotations.proto", - "google/api/http.proto", - ], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "descriptor_go_proto", - importpath = "github.com/golang/protobuf/protoc-gen-go/descriptor", - proto = "@com_google_protobuf//:descriptor_proto", - visibility = ["//visibility:public"], -) - -proto_library( - name = "http_api_protos_proto", - srcs = [":http_api_protos_src"], - deps = ["@com_google_protobuf//:descriptor_proto"], - visibility = ["//visibility:public"], -) - -cc_proto_library( - name = "http_api_protos", - deps = [":http_api_protos_proto"], - visibility = ["//visibility:public"], -) py_proto_library( - name = "http_api_protos_py", - srcs = [ - "google/api/annotations.proto", - "google/api/http.proto", - ], - include = ".", + name = "status_proto_py", + srcs = ["//google/rpc/status.proto"], default_runtime = "@com_google_protobuf//:protobuf_python", protoc = "@com_google_protobuf//:protoc", + include = "google/rpc", visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:protobuf_python"], -) - -go_proto_library( - name = "http_api_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations", - proto = ":http_api_protos_proto", - visibility = ["//visibility:public"], - deps = [ - ":descriptor_go_proto", - ], -) - -filegroup( - name = "rpc_status_protos_src", - srcs = [ - "google/rpc/status.proto", - ], - visibility = ["//visibility:public"], -) - -proto_library( - name = "rpc_status_protos_lib", - srcs = [":rpc_status_protos_src"], - deps = ["@com_google_protobuf//:any_proto"], - visibility = ["//visibility:public"], -) - -cc_proto_library( - name = "rpc_status_protos", - deps = [":rpc_status_protos_lib"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "rpc_status_go_proto", - importpath = "google.golang.org/genproto/googleapis/rpc/status", - proto = ":rpc_status_protos_lib", - visibility = ["//visibility:public"], - deps = [ - "@io_bazel_rules_go//proto/wkt:any_go_proto", - ], -) - -py_proto_library( - name = "rpc_status_protos_py", - srcs = [ - "google/rpc/status.proto", - ], - include = ".", - default_runtime = "@com_google_protobuf//:protobuf_python", - protoc = "@com_google_protobuf//:protoc", - visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:protobuf_python"], ) - -proto_library( - name = "tracing_proto_proto", - srcs = [ - "google/devtools/cloudtrace/v2/trace.proto", - "google/devtools/cloudtrace/v2/tracing.proto", - ], - deps = [ - ":http_api_protos_proto", - ":rpc_status_protos_lib", - "@com_google_protobuf//:timestamp_proto", - "@com_google_protobuf//:wrappers_proto", - "@com_google_protobuf//:empty_proto", - ], -) - -cc_proto_library( - name = "tracing_proto_cc", - deps = [":tracing_proto_proto"], -) - -cc_grpc_library( - name = "tracing_proto", - srcs = [":tracing_proto_proto"], - deps = [":tracing_proto_cc"], - grpc_only = True, - visibility = ["@io_opencensus_cpp//opencensus:__subpackages__"], -) - """ GOGOPROTO_BUILD_CONTENT = """ diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl index 541f6c4a5d767..86d7a0ec7dbf2 100644 --- a/api/bazel/repository_locations.bzl +++ b/api/bazel/repository_locations.bzl @@ -10,8 +10,8 @@ OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a62 PGV_GIT_SHA = "26db5cb7c01a67c6a2e21a832106406185530b2f" PGV_SHA256 = "6510cbcf69d99059c652ae2376f6240bc761d0b019cd962225f4f609be361e26" -GOOGLEAPIS_GIT_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018 -GOOGLEAPIS_SHA = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63" +GOOGLEAPIS_GIT_SHA = "96d5a05171e99b6a2378eb0a3423f765351878b7" # Jul 16, 2019 +GOOGLEAPIS_SHA = "a3b2f198e43969b9ec3d96fe4bc7a74191ab0c055f9c5cab716c0ed512d9cd49" PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017 PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b" @@ -28,7 +28,7 @@ REPOSITORY_LOCATIONS = dict( strip_prefix = "protoc-gen-validate-" + PGV_GIT_SHA, urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/" + PGV_GIT_SHA + ".tar.gz"], ), - googleapis = dict( + com_google_googleapis = dict( # TODO(dio): Consider writing a Skylark macro for importing Google API proto. sha256 = GOOGLEAPIS_SHA, strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA, diff --git a/bazel/foreign_cc/io_opencensus_cpp.patch b/bazel/foreign_cc/io_opencensus_cpp.patch deleted file mode 100644 index f814d6583d81e..0000000000000 --- a/bazel/foreign_cc/io_opencensus_cpp.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- BUILD 2019-06-03 18:30:58.511651926 -0700 -+++ opencensus/exporters/trace/stackdriver/BUILD 2019-06-03 18:32:38.107571186 -0700 -@@ -28,7 +28,7 @@ - copts = DEFAULT_COPTS, - visibility = ["//visibility:public"], - deps = [ -- "//google/devtools/cloudtrace/v2:tracing_proto", -+ "@googleapis//:tracing_proto", - "//opencensus/common:version", - "//opencensus/common/internal/grpc:status", - "//opencensus/common/internal/grpc:with_user_agent", diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 1c0e6abb57dd0..d364acb009822 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -160,6 +160,7 @@ def envoy_dependencies(skip_targets = []): _python_deps() _cc_deps() _go_deps(skip_targets) + api_dependencies() def _boringssl(): @@ -515,8 +516,6 @@ def _io_opencensus_cpp(): location = REPOSITORY_LOCATIONS["io_opencensus_cpp"] http_archive( name = "io_opencensus_cpp", - patch_args = ["-p0"], - patches = ["@envoy//bazel/foreign_cc:io_opencensus_cpp.patch"], **location ) native.bind( diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index d809a6f871924..cde33f62e5883 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -225,9 +225,9 @@ REPOSITORY_LOCATIONS = dict( urls = ["https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55"], ), io_opencensus_cpp = dict( - sha256 = "d6d68704c419a9e892bd1f942e09509ebc5a318499a1abcf2c09734e5dc56e19", - strip_prefix = "opencensus-cpp-1145dd77ffb7a2845c71c8e6ca188ef55e4ff607", - urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/1145dd77ffb7a2845c71c8e6ca188ef55e4ff607.tar.gz"], + sha256 = "9223b4d54af4151910dede03aa58247e90df72167fcc91d5f75e73a141568036", + strip_prefix = "opencensus-cpp-e292a374fb42c6cb2743f1689234bd409f4fda20", + urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/e292a374fb42c6cb2743f1689234bd409f4fda20.tar.gz"], ), com_github_curl = dict( sha256 = "821aeb78421375f70e55381c9ad2474bf279fc454b791b7e95fc83562951c690", From a7bc4c31427dd275c8a22c0f8bbf9710a7215b61 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Wed, 17 Jul 2019 14:17:44 -0700 Subject: [PATCH 02/12] fix envoy_api Signed-off-by: Kuat Yessenov --- WORKSPACE | 3 +++ api/bazel/api_build_system.bzl | 28 +++++++++++++++++++++++----- api/bazel/repositories.bzl | 14 -------------- api/bazel/repository_locations.bzl | 4 ++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 2c98b318be31d..c8909ce0703e4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -25,4 +25,7 @@ switched_rules_by_language( cc = True, grpc = True, go = True, + rules_override = { + "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", + }, ) diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 5188155f78227..2e0b4e2118b98 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -1,4 +1,4 @@ -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") +load("@com_google_protobuf//:protobuf.bzl", _py_proto_library = "py_proto_library") load("@com_envoyproxy_protoc_gen_validate//bazel:pgv_proto_library.bzl", "pgv_cc_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library", "go_proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_test") @@ -24,20 +24,39 @@ def _LibrarySuffix(library_name, suffix): # https://github.com/bazelbuild/bazel/issues/3935 and/or # https://github.com/bazelbuild/bazel/issues/2626 are resolved. def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): - py_proto_library( + _py_proto_library( name = _Suffix(name, _PY_SUFFIX), srcs = srcs, default_runtime = "@com_google_protobuf//:protobuf_python", protoc = "@com_google_protobuf//:protoc", deps = [_LibrarySuffix(d, _PY_SUFFIX) for d in deps] + [ "@com_envoyproxy_protoc_gen_validate//validate:validate_py", - # "@com_google_googleapis//:api_httpbody_protos_py", - # "@com_google_googleapis//:http_api_protos_py", + "@com_google_googleapis//google/rpc:status_py_proto", + "@com_google_googleapis//google/api:annotations_py_proto", + "@com_google_googleapis//google/api:http_py_proto", + "@com_google_googleapis//google/api:httpbody_py_proto", "@com_github_gogo_protobuf//:gogo_proto_py", ], visibility = ["//visibility:public"], ) +# This replaces googleapis rules. +def py_proto_library(name, deps = []): + srcs = [dep[:-6] + ".proto" if dep.endswith("_proto") else dep for dep in deps] + proto_deps = [] + + # Ignoring the proto_library has an unfortunate side-effect of losing proto dependencies... + if name == "annotations_py_proto": + proto_deps = proto_deps + [":http_py_proto"] + _py_proto_library( + name = name, + srcs = srcs, + default_runtime = "@com_google_protobuf//:protobuf_python", + protoc = "@com_google_protobuf//:protoc", + deps = proto_deps + ["@com_google_protobuf//:protobuf_python"], + visibility = ["//visibility:public"], + ) + def api_go_proto_library(name, proto, deps = []): go_proto_library( name = _Suffix(name, _GO_PROTO_SUFFIX), @@ -69,7 +88,6 @@ def api_go_grpc_library(name, proto, deps = []): "@io_bazel_rules_go//proto/wkt:struct_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@com_envoyproxy_protoc_gen_validate//validate:go_default_library", - "@com_google_googleapis//google/api:http_go_proto", "@com_google_googleapis//google/api:annotations_go_proto", ], ) diff --git a/api/bazel/repositories.bzl b/api/bazel/repositories.bzl index 71ec587c52f2f..3185d0f74072f 100644 --- a/api/bazel/repositories.bzl +++ b/api/bazel/repositories.bzl @@ -14,7 +14,6 @@ def api_dependencies(): envoy_http_archive( name = "com_google_googleapis", locations = REPOSITORY_LOCATIONS, - build_file_content = GOOGLEAPIS_BUILD_CONTENT, ) envoy_http_archive( name = "com_github_gogo_protobuf", @@ -36,19 +35,6 @@ def api_dependencies(): build_file_content = KAFKASOURCE_BUILD_CONTENT, ) -GOOGLEAPIS_BUILD_CONTENT = """ -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") - -py_proto_library( - name = "status_proto_py", - srcs = ["//google/rpc/status.proto"], - default_runtime = "@com_google_protobuf//:protobuf_python", - protoc = "@com_google_protobuf//:protoc", - include = "google/rpc", - visibility = ["//visibility:public"], -) -""" - GOGOPROTO_BUILD_CONTENT = """ load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl index 86d7a0ec7dbf2..2b8b59768073c 100644 --- a/api/bazel/repository_locations.bzl +++ b/api/bazel/repository_locations.bzl @@ -10,8 +10,8 @@ OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a62 PGV_GIT_SHA = "26db5cb7c01a67c6a2e21a832106406185530b2f" PGV_SHA256 = "6510cbcf69d99059c652ae2376f6240bc761d0b019cd962225f4f609be361e26" -GOOGLEAPIS_GIT_SHA = "96d5a05171e99b6a2378eb0a3423f765351878b7" # Jul 16, 2019 -GOOGLEAPIS_SHA = "a3b2f198e43969b9ec3d96fe4bc7a74191ab0c055f9c5cab716c0ed512d9cd49" +GOOGLEAPIS_GIT_SHA = "0ce9d41a2c6efa6a71a06ace0d088f3e548a4431" # Jul 17, 2019 +GOOGLEAPIS_SHA = "08687b82779972a2021af5143430b294c0941d1b48242aa4f5c7ad50f10e89a6" PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017 PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b" From d0eb12f245fc800544db8de8234f9bb2217660c3 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Wed, 17 Jul 2019 15:35:47 -0700 Subject: [PATCH 03/12] use setName from opencensus Signed-off-by: Kuat Yessenov --- bazel/api_repositories.bzl | 4 ++-- bazel/envoy_build_system.bzl | 9 +++++---- bazel/envoy_library.bzl | 4 ++-- bazel/foreign_cc/com_lightstep_tracer_cpp.patch | 2 +- .../tracers/opencensus/opencensus_tracer_impl.cc | 2 +- test/extensions/tracers/opencensus/tracer_test.cc | 11 +++++------ 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bazel/api_repositories.bzl b/bazel/api_repositories.bzl index 016fb16c8a2ee..3569e588c83f5 100644 --- a/bazel/api_repositories.bzl +++ b/bazel/api_repositories.bzl @@ -27,9 +27,9 @@ def envoy_api_dependencies(): native.bind( name = "api_httpbody_protos", - actual = "@googleapis//:api_httpbody_protos", + actual = "@com_google_googleapis//google/api:httpbody_cc_proto", ) native.bind( name = "http_api_protos", - actual = "@googleapis//:http_api_protos", + actual = "@com_google_googleapis//google/api:annotations_cc_proto", ) diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 1a7ed4e98d578..4dc11e496c208 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -129,12 +129,13 @@ def envoy_proto_descriptor(name, out, srcs = [], external_deps = []): include_paths = [".", native.package_name()] if "api_httpbody_protos" in external_deps: - srcs.append("@googleapis//:api_httpbody_protos_src") - include_paths.append("external/googleapis") + srcs.append("@com_google_googleapis//google/api:httpbody.proto") + include_paths.append("external/com_google_googleapis") if "http_api_protos" in external_deps: - srcs.append("@googleapis//:http_api_protos_src") - include_paths.append("external/googleapis") + srcs.append("@com_google_googleapis//google/api:annotations.proto") + srcs.append("@com_google_googleapis//google/api:http.proto") + include_paths.append("external/com_google_googleapis") if "well_known_protos" in external_deps: srcs.append("@com_google_protobuf//:well_known_protos") diff --git a/bazel/envoy_library.bzl b/bazel/envoy_library.bzl index 33e9e93fc0491..b0f54ea64eb49 100644 --- a/bazel/envoy_library.bzl +++ b/bazel/envoy_library.bzl @@ -113,8 +113,8 @@ def envoy_proto_library(name, external_deps = [], **kwargs): external_proto_deps = [] external_cc_proto_deps = [] if "api_httpbody_protos" in external_deps: - external_cc_proto_deps.append("@googleapis//:api_httpbody_protos") - external_proto_deps.append("@googleapis//:api_httpbody_protos_proto") + external_cc_proto_deps.append("@com_google_googleapis//google/api:httpbody_cc_proto") + external_proto_deps.append("@com_google_googleapis//google/api:httpbody_proto") api_proto_library( name, external_cc_proto_deps = external_cc_proto_deps, diff --git a/bazel/foreign_cc/com_lightstep_tracer_cpp.patch b/bazel/foreign_cc/com_lightstep_tracer_cpp.patch index c0a4055ae4832..88e1a81ad8b27 100644 --- a/bazel/foreign_cc/com_lightstep_tracer_cpp.patch +++ b/bazel/foreign_cc/com_lightstep_tracer_cpp.patch @@ -5,7 +5,7 @@ srcs = ["collector.proto"], deps = [ - "@lightstep_vendored_googleapis//:googleapis_proto", -+ "@googleapis//:http_api_protos_proto", ++ "@com_google_googleapis//google/api:annotations_proto", "@com_google_protobuf//:timestamp_proto", ], visibility = ["//visibility:public"], diff --git a/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc b/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc index 6a93dbbffd901..8c104b49b0f52 100644 --- a/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc +++ b/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc @@ -136,7 +136,7 @@ Span::Span(const envoy::config::trace::v2::OpenCensusConfig& oc_config, : span_(std::move(span)), oc_config_(oc_config) {} void Span::setOperation(absl::string_view operation) { - span_.AddAnnotation("setOperation", {{"operation", operation}}); + span_.SetName(operation); } void Span::setTag(absl::string_view name, absl::string_view value) { diff --git a/test/extensions/tracers/opencensus/tracer_test.cc b/test/extensions/tracers/opencensus/tracer_test.cc index a223b08e3be5a..264c950395040 100644 --- a/test/extensions/tracers/opencensus/tracer_test.cc +++ b/test/extensions/tracers/opencensus/tracer_test.cc @@ -132,18 +132,17 @@ TEST(OpenCensusTracerTest, Span) { const auto& sd = (spans[0].name() == operation_name) ? spans[0] : spans[1]; ENVOY_LOG_MISC(debug, "{}", sd.DebugString()); - EXPECT_EQ("my_operation_1", sd.name()); + EXPECT_EQ("different_name", sd.name()); EXPECT_TRUE(sd.context().IsValid()); EXPECT_TRUE(sd.context().trace_options().IsSampled()); ::opencensus::trace::SpanId zeros; EXPECT_EQ(zeros, sd.parent_span_id()); parent_span_id = sd.context().span_id(); - ASSERT_EQ(4, sd.annotations().events().size()); - EXPECT_EQ("setOperation", sd.annotations().events()[0].event().description()); - EXPECT_EQ("my annotation", sd.annotations().events()[1].event().description()); - EXPECT_EQ("spawnChild", sd.annotations().events()[2].event().description()); - EXPECT_EQ("setSampled", sd.annotations().events()[3].event().description()); + ASSERT_EQ(3, sd.annotations().events().size()); + EXPECT_EQ("my annotation", sd.annotations().events()[0].event().description()); + EXPECT_EQ("spawnChild", sd.annotations().events()[1].event().description()); + EXPECT_EQ("setSampled", sd.annotations().events()[2].event().description()); EXPECT_TRUE(sd.has_ended()); } From e0cae9cf1f20f3aa1b215840f5eb172c3ee65ba9 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Wed, 17 Jul 2019 15:43:57 -0700 Subject: [PATCH 04/12] fix format Signed-off-by: Kuat Yessenov --- WORKSPACE | 2 +- api/bazel/repository_locations.bzl | 2 +- .../extensions/tracers/opencensus/opencensus_tracer_impl.cc | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index c8909ce0703e4..dd1340e01e309 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -23,8 +23,8 @@ load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_languag switched_rules_by_language( name = "com_google_googleapis_imports", cc = True, - grpc = True, go = True, + grpc = True, rules_override = { "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", }, diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl index 2b8b59768073c..8429c4a94d478 100644 --- a/api/bazel/repository_locations.bzl +++ b/api/bazel/repository_locations.bzl @@ -10,7 +10,7 @@ OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a62 PGV_GIT_SHA = "26db5cb7c01a67c6a2e21a832106406185530b2f" PGV_SHA256 = "6510cbcf69d99059c652ae2376f6240bc761d0b019cd962225f4f609be361e26" -GOOGLEAPIS_GIT_SHA = "0ce9d41a2c6efa6a71a06ace0d088f3e548a4431" # Jul 17, 2019 +GOOGLEAPIS_GIT_SHA = "0ce9d41a2c6efa6a71a06ace0d088f3e548a4431" # Jul 17, 2019 GOOGLEAPIS_SHA = "08687b82779972a2021af5143430b294c0941d1b48242aa4f5c7ad50f10e89a6" PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017 diff --git a/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc b/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc index 8c104b49b0f52..24f52d44df5be 100644 --- a/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc +++ b/source/extensions/tracers/opencensus/opencensus_tracer_impl.cc @@ -135,9 +135,7 @@ Span::Span(const envoy::config::trace::v2::OpenCensusConfig& oc_config, ::opencensus::trace::Span&& span) : span_(std::move(span)), oc_config_(oc_config) {} -void Span::setOperation(absl::string_view operation) { - span_.SetName(operation); -} +void Span::setOperation(absl::string_view operation) { span_.SetName(operation); } void Span::setTag(absl::string_view name, absl::string_view value) { span_.AddAttribute(name, value); From eb939bddb69c9066ba88e106bc48436cea185ad6 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 18 Jul 2019 16:36:43 -0700 Subject: [PATCH 05/12] fix filter example Signed-off-by: Kuat Yessenov --- ci/WORKSPACE.filter.example | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index 5013077c24685..aa013d639c3d6 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -19,3 +19,15 @@ rules_foreign_cc_dependencies() load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(go_version = GO_VERSION) + +load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") + +switched_rules_by_language( + name = "com_google_googleapis_imports", + cc = True, + go = True, + grpc = True, + rules_override = { + "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", + }, +) From cf6fa6862911ab575e1d87e9bf8a6bbf5d5d9d39 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 22 Jul 2019 14:04:11 -0700 Subject: [PATCH 06/12] review feedback Signed-off-by: Kuat Yessenov --- WORKSPACE | 16 ++++------------ bazel/api_binding.bzl | 35 +++++++++++++++++++++++++++++++++++ bazel/api_repositories.bzl | 35 ++--------------------------------- bazel/repositories.bzl | 12 ++++++++++-- ci/WORKSPACE.filter.example | 19 ++++++------------- 5 files changed, 57 insertions(+), 60 deletions(-) create mode 100644 bazel/api_binding.bzl diff --git a/WORKSPACE b/WORKSPACE index 900443e83f2af..d58dc405f593c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,5 +1,9 @@ workspace(name = "envoy") +load("//bazel:api_binding.bzl", "envoy_api_binding") + +envoy_api_binding() + load("//bazel:api_repositories.bzl", "envoy_api_dependencies") envoy_api_dependencies() @@ -21,15 +25,3 @@ go_register_toolchains(go_version = GO_VERSION) load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") rbe_toolchains_config() - -load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") - -switched_rules_by_language( - name = "com_google_googleapis_imports", - cc = True, - go = True, - grpc = True, - rules_override = { - "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", - }, -) diff --git a/bazel/api_binding.bzl b/bazel/api_binding.bzl new file mode 100644 index 0000000000000..0ad3526043557 --- /dev/null +++ b/bazel/api_binding.bzl @@ -0,0 +1,35 @@ +def _default_envoy_api_impl(ctx): + ctx.file("WORKSPACE", "") + ctx.file("BUILD.bazel", "") + api_dirs = [ + "bazel", + "docs", + "envoy", + "examples", + "test", + "tools", + ] + for d in api_dirs: + ctx.symlink(ctx.path(ctx.attr.api).dirname.get_child(d), d) + +_default_envoy_api = repository_rule( + implementation = _default_envoy_api_impl, + attrs = { + "api": attr.label(default = "@envoy//api:BUILD"), + }, +) + +def envoy_api_binding(): + # Treat the data plane API as an external repo, this simplifies exporting the API to + # https://github.com/envoyproxy/data-plane-api. + if "envoy_api" not in native.existing_rules().keys(): + _default_envoy_api(name = "envoy_api") + + native.bind( + name = "api_httpbody_protos", + actual = "@com_google_googleapis//google/api:httpbody_cc_proto", + ) + native.bind( + name = "http_api_protos", + actual = "@com_google_googleapis//google/api:annotations_cc_proto", + ) diff --git a/bazel/api_repositories.bzl b/bazel/api_repositories.bzl index 3569e588c83f5..d4d2f1abd51d4 100644 --- a/bazel/api_repositories.bzl +++ b/bazel/api_repositories.bzl @@ -1,35 +1,4 @@ -def _default_envoy_api_impl(ctx): - ctx.file("WORKSPACE", "") - ctx.file("BUILD.bazel", "") - api_dirs = [ - "bazel", - "docs", - "envoy", - "examples", - "test", - "tools", - ] - for d in api_dirs: - ctx.symlink(ctx.path(ctx.attr.api).dirname.get_child(d), d) - -_default_envoy_api = repository_rule( - implementation = _default_envoy_api_impl, - attrs = { - "api": attr.label(default = "@envoy//api:BUILD"), - }, -) +load("@envoy_api//bazel:repositories.bzl", "api_dependencies") def envoy_api_dependencies(): - # Treat the data plane API as an external repo, this simplifies exporting the API to - # https://github.com/envoyproxy/data-plane-api. - if "envoy_api" not in native.existing_rules().keys(): - _default_envoy_api(name = "envoy_api") - - native.bind( - name = "api_httpbody_protos", - actual = "@com_google_googleapis//google/api:httpbody_cc_proto", - ) - native.bind( - name = "http_api_protos", - actual = "@com_google_googleapis//google/api:annotations_cc_proto", - ) + api_dependencies() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 6793c6019885b..e9259bf483547 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -2,7 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load(":genrule_repository.bzl", "genrule_repository") load("@envoy_api//bazel:envoy_http_archive.bzl", "envoy_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") -load("@envoy_api//bazel:repositories.bzl", "api_dependencies") +load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") # dict of {build recipe name: longform extension name,} PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} @@ -162,7 +162,15 @@ def envoy_dependencies(skip_targets = []): _cc_deps() _go_deps(skip_targets) - api_dependencies() + switched_rules_by_language( + name = "com_google_googleapis_imports", + cc = True, + go = True, + grpc = True, + rules_override = { + "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", + }, + ) def _boringssl(): _repository_impl("boringssl") diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index 6bfeb9b424699..802e1d03a273c 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -5,7 +5,12 @@ local_repository( path = "{ENVOY_SRCDIR}", ) -load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies") +load("//bazel:api_binding.bzl", "envoy_api_binding") + +envoy_api_binding() + +load("//bazel:api_repositories.bzl", "envoy_api_dependencies") + envoy_api_dependencies() load("@envoy//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") @@ -23,15 +28,3 @@ go_register_toolchains(go_version = GO_VERSION) load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") rbe_toolchains_config() - -load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") - -switched_rules_by_language( - name = "com_google_googleapis_imports", - cc = True, - go = True, - grpc = True, - rules_override = { - "py_proto_library": "@envoy_api//bazel:api_build_system.bzl", - }, -) From 3cfba6abdaeb865be7a36079d2c02dbe0f0beb3d Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Mon, 22 Jul 2019 14:10:10 -0700 Subject: [PATCH 07/12] typo Signed-off-by: Kuat Yessenov --- ci/WORKSPACE.filter.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index 802e1d03a273c..adeb10e5eb143 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -5,11 +5,11 @@ local_repository( path = "{ENVOY_SRCDIR}", ) -load("//bazel:api_binding.bzl", "envoy_api_binding") +load("@envoy//bazel:api_binding.bzl", "envoy_api_binding") envoy_api_binding() -load("//bazel:api_repositories.bzl", "envoy_api_dependencies") +load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies") envoy_api_dependencies() From 404b7dab7e8d92b8d2b4b54929ae62b2fb49f4bc Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Wed, 24 Jul 2019 13:33:43 -0700 Subject: [PATCH 08/12] review feedback Signed-off-by: Kuat Yessenov --- api/bazel/api_build_system.bzl | 7 +++++-- api/bazel/repository_locations.bzl | 4 ++-- bazel/repository_locations.bzl | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 2e0b4e2118b98..9eb8e434a5319 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -40,12 +40,15 @@ def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): visibility = ["//visibility:public"], ) -# This replaces googleapis rules. +# This defines googleapis py_proto_library. The repository does not provide its definition and requires +# overriding it in the consuming project (see https://github.com/grpc/grpc/issues/19255 for more details). def py_proto_library(name, deps = []): srcs = [dep[:-6] + ".proto" if dep.endswith("_proto") else dep for dep in deps] proto_deps = [] - # Ignoring the proto_library has an unfortunate side-effect of losing proto dependencies... + # py_proto_library in googleapis specifies *_proto rules in dependencies. + # By rewriting *_proto to *.proto above, the dependencies in *_proto rules are not preserved. + # As a workaround, manually specify the proto dependencies for the imported python rules. if name == "annotations_py_proto": proto_deps = proto_deps + [":http_py_proto"] _py_proto_library( diff --git a/api/bazel/repository_locations.bzl b/api/bazel/repository_locations.bzl index 3720136b8d213..dd661b7d7886c 100644 --- a/api/bazel/repository_locations.bzl +++ b/api/bazel/repository_locations.bzl @@ -10,8 +10,8 @@ OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a62 PGV_GIT_SHA = "dd90514d96e35023ed20201f349542b0bc64461d" PGV_SHA256 = "f7d67677fbec5b0f561f6ee6788223fb535d3864b53a28b6678e319f5d1f4f25" -GOOGLEAPIS_GIT_SHA = "0ce9d41a2c6efa6a71a06ace0d088f3e548a4431" # Jul 17, 2019 -GOOGLEAPIS_SHA = "08687b82779972a2021af5143430b294c0941d1b48242aa4f5c7ad50f10e89a6" +GOOGLEAPIS_GIT_SHA = "be480e391cc88a75cf2a81960ef79c80d5012068" # Jul 24, 2019 +GOOGLEAPIS_SHA = "c1969e5b72eab6d9b6cfcff748e45ba57294aeea1d96fd04cd081995de0605c2" PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017 PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b" diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 1ff6299a65ba6..7325f12b9e4c4 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -233,9 +233,9 @@ REPOSITORY_LOCATIONS = dict( urls = ["https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"], ), io_opencensus_cpp = dict( - sha256 = "9223b4d54af4151910dede03aa58247e90df72167fcc91d5f75e73a141568036", - strip_prefix = "opencensus-cpp-e292a374fb42c6cb2743f1689234bd409f4fda20", - urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/e292a374fb42c6cb2743f1689234bd409f4fda20.tar.gz"], + sha256 = "f0782c1912698fcd63537c86cb1f15a408a3d0a8c48a7e499b856caabcbef325", + strip_prefix = "opencensus-cpp-c43dcefe211d6db94840b94f03726722fe3356a8", + urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/c43dcefe211d6db94840b94f03726722fe3356a8.tar.gz"], ), com_github_curl = dict( sha256 = "821aeb78421375f70e55381c9ad2474bf279fc454b791b7e95fc83562951c690", From e5a4c31546813efa5cfbda12e085b7ac41856fa6 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Wed, 24 Jul 2019 13:42:37 -0700 Subject: [PATCH 09/12] revert opencensus cpp change Signed-off-by: Kuat Yessenov --- bazel/repository_locations.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 7325f12b9e4c4..1ff6299a65ba6 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -233,9 +233,9 @@ REPOSITORY_LOCATIONS = dict( urls = ["https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"], ), io_opencensus_cpp = dict( - sha256 = "f0782c1912698fcd63537c86cb1f15a408a3d0a8c48a7e499b856caabcbef325", - strip_prefix = "opencensus-cpp-c43dcefe211d6db94840b94f03726722fe3356a8", - urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/c43dcefe211d6db94840b94f03726722fe3356a8.tar.gz"], + sha256 = "9223b4d54af4151910dede03aa58247e90df72167fcc91d5f75e73a141568036", + strip_prefix = "opencensus-cpp-e292a374fb42c6cb2743f1689234bd409f4fda20", + urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/e292a374fb42c6cb2743f1689234bd409f4fda20.tar.gz"], ), com_github_curl = dict( sha256 = "821aeb78421375f70e55381c9ad2474bf279fc454b791b7e95fc83562951c690", From 585aab5a269c8d56e03f16bb73329d10fc5df6f2 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 25 Jul 2019 10:21:02 -0700 Subject: [PATCH 10/12] add TODO Signed-off-by: Kuat Yessenov --- bazel/api_binding.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/bazel/api_binding.bzl b/bazel/api_binding.bzl index 0ad3526043557..bf4f304687c12 100644 --- a/bazel/api_binding.bzl +++ b/bazel/api_binding.bzl @@ -25,6 +25,7 @@ def envoy_api_binding(): if "envoy_api" not in native.existing_rules().keys(): _default_envoy_api(name = "envoy_api") + # TODO(https://github.com/envoyproxy/envoy/issues/7719) need to remove both bindings and use canonical rules native.bind( name = "api_httpbody_protos", actual = "@com_google_googleapis//google/api:httpbody_cc_proto", From 6524c56262ec6db3d9118df40b21e3b4c7e20f24 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 25 Jul 2019 15:10:49 -0700 Subject: [PATCH 11/12] update workspaces Signed-off-by: Kuat Yessenov --- WORKSPACE | 14 ++------------ bazel/dependency_imports.bzl | 9 +++++++++ ci/WORKSPACE.filter.example | 12 ++---------- 3 files changed, 13 insertions(+), 22 deletions(-) create mode 100644 bazel/dependency_imports.bzl diff --git a/WORKSPACE b/WORKSPACE index d58dc405f593c..900ebae872973 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,16 +12,6 @@ load("//bazel:repositories.bzl", "GO_VERSION", "envoy_dependencies") envoy_dependencies() -load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") +load("//bazel:dependency_imports.bzl", "envoy_dependency_imports") -rules_foreign_cc_dependencies() - -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") - -go_rules_dependencies() - -go_register_toolchains(go_version = GO_VERSION) - -load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") - -rbe_toolchains_config() +envoy_dependency_imports(GO_VERSION) diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl new file mode 100644 index 0000000000000..dd4779be45b92 --- /dev/null +++ b/bazel/dependency_imports.bzl @@ -0,0 +1,9 @@ +load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") + +def envoy_dependency_imports(go_version = "1.12.5"): + rules_foreign_cc_dependencies() + go_rules_dependencies() + go_register_toolchains(go_version) + rbe_toolchains_config() diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index adeb10e5eb143..15baebc5a678d 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -17,14 +17,6 @@ load("@envoy//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") envoy_dependencies() -# TODO(htuch): Roll this into envoy_dependencies() -load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") -rules_foreign_cc_dependencies() +load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports") -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -go_rules_dependencies() -go_register_toolchains(go_version = GO_VERSION) - -load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") - -rbe_toolchains_config() +envoy_dependency_imports(GO_VERSION) From 7241003a5fec65d6d74bfc5956dc31b7193f51d9 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 25 Jul 2019 15:42:17 -0700 Subject: [PATCH 12/12] move GO_VERSION Signed-off-by: Kuat Yessenov --- WORKSPACE | 4 ++-- bazel/dependency_imports.bzl | 5 ++++- bazel/repositories.bzl | 3 --- ci/WORKSPACE.filter.example | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 900ebae872973..ef120bc53d4ff 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,10 +8,10 @@ load("//bazel:api_repositories.bzl", "envoy_api_dependencies") envoy_api_dependencies() -load("//bazel:repositories.bzl", "GO_VERSION", "envoy_dependencies") +load("//bazel:repositories.bzl", "envoy_dependencies") envoy_dependencies() load("//bazel:dependency_imports.bzl", "envoy_dependency_imports") -envoy_dependency_imports(GO_VERSION) +envoy_dependency_imports() diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl index dd4779be45b92..3915eb1b553f7 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl @@ -2,7 +2,10 @@ load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependen load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@envoy//bazel/toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config") -def envoy_dependency_imports(go_version = "1.12.5"): +# go version for rules_go +GO_VERSION = "1.12.5" + +def envoy_dependency_imports(go_version = GO_VERSION): rules_foreign_cc_dependencies() go_rules_dependencies() go_register_toolchains(go_version) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index e9259bf483547..9cb20ae5f0a3c 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -15,9 +15,6 @@ NOBORINGSSL_SKIP_TARGETS = { "tls_inspector": "envoy.filters.listener.tls_inspector", } -# go version for rules_go -GO_VERSION = "1.12.5" - # Make all contents of an external repository accessible under a filegroup. Used for external HTTP # archives, e.g. cares. BUILD_ALL_CONTENT = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])""" diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index 15baebc5a678d..db20a3146ac9a 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -13,10 +13,10 @@ load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies") envoy_api_dependencies() -load("@envoy//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") +load("@envoy//bazel:repositories.bzl", "envoy_dependencies") envoy_dependencies() load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports") -envoy_dependency_imports(GO_VERSION) +envoy_dependency_imports()