Browse Source

Fix depset/list confusion in #7458.

See
https://github.com/protocolbuffers/protobuf/pull/7458#issuecomment-633147682.

release notes: no

Signed-off-by: Harvey Tuch <htuch@google.com>
Harvey Tuch 5 năm trước cách đây
mục cha
commit
e492e5a4ef
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      protobuf.bzl

+ 8 - 2
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(