Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
incompatible_depset_union: Disallow union operator on depsets #5817
This is a tracking issue for offering a migration solution for
It turns out that
It also seems that at least in context of Polymer/Closure custom rules, that were written by @hanwen , it is not really trivial to avoid/re-write usage of
I wonder if someone from Bazel team could help us to resolve those usages? Or give us more time and postpone deprecation of that feature? Or even re-consider and abandon the deprecation entirely?
Hanwen's solution is the simplest fix.
However, in many cases, the depsets are not properly used. For example, using
If we update the code automatically, most users won't have the chance to look at the code and decide if it's a good thing to do.
d = depset() for item in mylist: d += item.field
may be instead transformed to:
d = depset(transitive = [item.field for item in mylist])
Truly don't understand this change, if the workaround is
Let me expand from my previous comment. Each call to
Old code (now forbidden):
all_deps = depset() for dep in ctx.attr.deps: all_deps = all_deps + dep.files
all_deps = depset() for dep in ctx.attr.deps: all_deps = depset(transitive = [all_deps, dep.files])
Much better fix:
all_deps = depset(transitive = [dep.files for dep in ctx.attr.deps])
For a Python user, the old code might look fine and many people were writing this kind of code. If you blindly replace
So the design decision was made to prevent this tempting error.