From e492e5a4ef16f59010283befbde6112f1995fa0f Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Tue, 26 May 2020 14:27:56 -0400 Subject: [PATCH] Fix depset/list confusion in #7458. See https://github.com/protocolbuffers/protobuf/pull/7458#issuecomment-633147682. release notes: no Signed-off-by: Harvey Tuch --- protobuf.bzl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/protobuf.bzl b/protobuf.bzl index 027937f89c..050eafc548 100644 --- a/protobuf.bzl +++ b/protobuf.bzl @@ -85,8 +85,14 @@ def _proto_gen_impl(ctx): import_flags = depset(direct=["-I."]) for dep in ctx.attr.deps: - import_flags = depset(transitive=[import_flags, depset(direct=dep.proto.import_flags)]) - deps = depset(transitive=[deps, depset(direct=dep.proto.deps)]) + if type(dep.proto.import_flags) == "list": + import_flags = depset(transitive=[import_flags], direct=dep.proto.import_flags) + else: + import_flags = depset(transitive=[import_flags, dep.proto.import_flags]) + if type(dep.proto.deps) == "list": + deps = depset(transitive=[deps], direct=dep.proto.deps) + else: + deps = depset(transitive=[deps, dep.proto.deps]) if not ctx.attr.gen_cc and not ctx.attr.gen_py and not ctx.executable.plugin: return struct(