From f52e46d0a75c8dc11c3a363a6572a0d7563b21a8 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Tue, 19 Jul 2022 18:57:09 +0000 Subject: [PATCH] bazel: Remove uses of `depset.to_list` where possible (#22285) Signed-off-by: Ryan Northey Mirrored from https://github.com/envoyproxy/envoy @ 11eb182aa7b7057039dabafae33b97907477ab08 --- bazel/api_build_system.bzl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/bazel/api_build_system.bzl b/bazel/api_build_system.bzl index a4016559..bb4853e2 100644 --- a/bazel/api_build_system.bzl +++ b/bazel/api_build_system.bzl @@ -179,14 +179,10 @@ def api_proto_package( # Because RBAC proro depends on googleapis syntax.proto and checked.proto, # which share the same go proto library, it causes duplicative dependencies. - # Thus, we use depset().to_list() to remove duplicated depenencies. - go_proto_library( - name = name + _GO_PROTO_SUFFIX, - compilers = compilers, - importpath = _GO_IMPORTPATH_PREFIX + native.package_name(), - proto = name, - visibility = ["//visibility:public"], - deps = depset([_go_proto_mapping(dep) for dep in deps] + [ + # Thus, we use a dictionary below to simulate a set and remove duplicated dependencies. + deps = ( + [_go_proto_mapping(dep) for dep in deps] + + [ "@com_envoyproxy_protoc_gen_validate//validate:go_default_library", "@com_github_golang_protobuf//ptypes:go_default_library_gen", "@go_googleapis//google/api:annotations_go_proto", @@ -196,5 +192,13 @@ def api_proto_package( "@io_bazel_rules_go//proto/wkt:struct_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", - ]).to_list(), + ] + ) + go_proto_library( + name = name + _GO_PROTO_SUFFIX, + compilers = compilers, + importpath = _GO_IMPORTPATH_PREFIX + native.package_name(), + proto = name, + visibility = ["//visibility:public"], + deps = {dep: True for dep in deps}.keys(), )