-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incompatible_depset_union: Disallow union operator on depsets #5817
Comments
What is missing for migration: migration docs, length of migration window. After these are done, please add "migration-ready" label. |
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? Thanks! |
AFAICT, this is just a syntactic change, where we can change a.union(b) to a = depset(transitive = [a ,b]) |
Is it something we could easily implement in buildifier @c-parsons @vladmos ? |
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. For example, d = depset()
for item in mylist:
d += item.field may be instead transformed to: d = depset(transitive = [item.field for item in mylist]) |
* Fix Bazel incompatible issues. Some refs: - bazelbuild/bazel#5817
Progress towards #5817 RELNOTES: None. PiperOrigin-RevId: 245242309
Progress towards #5817 RELNOTES: None. PiperOrigin-RevId: 245265538
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 Discouraged fix: all_deps = depset()
for dep in ctx.attr.deps:
all_deps = depset(transitive = [all_deps, dep.files]) Recommended fix: all_deps = depset(transitive = [dep.files for dep in ctx.attr.deps]) In some cases, keeping the loop is useful (e.g. if you have a condition or complex constructs). You can also accumulate the dependencies in a list, before constructing the depset: deps_builder = []
for dep in ctx.attr.deps:
deps_builder.append(dep.files)
all_deps = depset(transitive = deps_builder) 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. |
Hmm, that last example makes a lot more sense to me -- will update to that, thanks for the quick reply! |
Multiple changes rolled out to Bazel break our compatibility with the latest version: - bazelbuild/bazel#5817 - bazelbuild/bazel#5818 - bazelbuild/bazel#5825 Update our version of zip_file to be compatible with these changes.
Multiple changes rolled out to Bazel break our compatibility with the latest version: - bazelbuild/bazel#5817 - bazelbuild/bazel#5818 - bazelbuild/bazel#5825 Update our version of zip_file to be compatible with these changes.
* Fix #570. Build broken on Cirrus by upgrade to Bazel v1.0 * The `single_file` attribute has been replaced by `allow_single_file`. Use **bazel_rules** v4 which fixed this. jflex-de/bazel_rules#13 * add `--incompatible_depset_union=false` bazel_pandoc ProdriveTechnologies/bazel-pandoc#6 needs to update for incompatible_depset_union bazelbuild/bazel#5817 * Use ProdriveTechnologies/bazel-latex#26 because `run_lualatex.py` is not executable * In deps, use `https` rather than `http` * Fix build broken on Travis due to upgrade to Xenial * Use openjdk11 because whatever I ask for, that's what I get. * Upgrade maven-compiler-plugin to 3.8.0 to fix _class file has wrong version 55.0, should be 53.0_ * Fix maven-compiler-plugin config for ErrorProne * Fix config of maven-javadoc-plugin for newer JDK. https://bugs.openjdk.java.net/browse/JDK-8212233 * In aggregated sources, update to JDK8 because Xenial doesn't support JDK7 anymore. Add manual dep on **javax-annotations.jar** because because JDK8 doesn't provide it anymore. * Remove the task that builds the docs because `\tightlist` is not known. #571
Author: Régis Décamps <[email protected]> Date: Tue Nov 5 11:16:01 2019 +0100 Fix the build (#569) * Fix #570. Build broken on Cirrus by upgrade to Bazel v1.0 * The `single_file` attribute has been replaced by `allow_single_file`. Use **bazel_rules** v4 which fixed this. jflex-de/bazel_rules#13 * add `--incompatible_depset_union=false` bazel_pandoc ProdriveTechnologies/bazel-pandoc#6 needs to update for incompatible_depset_union bazelbuild/bazel#5817 * Use ProdriveTechnologies/bazel-latex#26 because `run_lualatex.py` is not executable * In deps, use `https` rather than `http` * Fix build broken on Travis due to upgrade to Xenial * Use openjdk11 because whatever I ask for, that's what I get. * Upgrade maven-compiler-plugin to 3.8.0 to fix _class file has wrong version 55.0, should be 53.0_ * Fix maven-compiler-plugin config for ErrorProne * Fix config of maven-javadoc-plugin for newer JDK. https://bugs.openjdk.java.net/browse/JDK-8212233 * In aggregated sources, update to JDK8 because Xenial doesn't support JDK7 anymore. Add manual dep on **javax-annotations.jar** because because JDK8 doesn't provide it anymore. * Remove the task that builds the docs because `\tightlist` is not known. #571 Updated from target/jflex-parent-1.8.0-SNAPSHOT-sources.jar
It has been deprecated for a long time. #5817 RELNOTES: None. PiperOrigin-RevId: 283060975
Summary: The `+`, `+=`, and `|` operators on depsets, as well as `depset.union`, are deprecated due to performance problems: <bazelbuild/bazel#5817> As of a recent Bazel commit, `.union` is removed is removed entirely, so the operators may be soon on the chopping block: <bazelbuild/bazel@693963f> This commit removes remaining uses from TensorBoard. Google-internal source: <http://cl/283060975> (thanks, @laurentlb!). Test Plan: Running `bazel run //tensorboard` still works. Co-authored-by: Laurent Le Brun <[email protected]> wchargin-branch: remove-depset-union
Summary: The `+`, `+=`, and `|` operators on depsets, as well as `depset.union`, are deprecated due to performance problems: <bazelbuild/bazel#5817> As of a recent Bazel commit, `.union` is removed is removed entirely, so the operators may be soon on the chopping block: <bazelbuild/bazel@693963f> This commit removes remaining uses from TensorBoard. Google-internal source: <http://cl/283060975> (thanks, @laurentlb!). Test Plan: Running `bazel run //tensorboard` still works. Co-authored-by: Laurent Le Brun <[email protected]> wchargin-branch: remove-depset-union
#5817 RELNOTES: The flag `--incompatible_depset_union` is removed. PiperOrigin-RevId: 303325924
It has been deprecated for a long time. bazelbuild/bazel#5817 RELNOTES: None. PiperOrigin-RevId: 283060975
Fixes bazelbuild/bazel#5817 RELNOTES[INC]: --incompatible_depset_union is enabled by default. PiperOrigin-RevId: 245411420
Progress towards bazelbuild/bazel#5817 RELNOTES: None. PiperOrigin-RevId: 245242309
This is a tracking issue for offering a migration solution for
--incompatible_depset_union
Using
+
,|
or.union
on depsets is deprecated. Users should use the newconstructor instead (see https://docs.bazel.build/versions/master/skylark/depsets.html)
The text was updated successfully, but these errors were encountered: