bazel icon indicating copy to clipboard operation
bazel copied to clipboard

incompatible_build_transitive_python_runfiles

Open rickeylev opened this issue 1 year ago • 3 comments

To avoid performance issues with the upcoming Starlark implementation of the rules, the legacy behavior of py_binary targets that are only dependencies (not top-level requested targets) having their runfile symlinks materialized under bazel-bin is being disabled. This behavior has been undesirable since ~2017, but until now has been mostly harmless.

(More specifically, a performance issue (to the tune of 1% to 10% extra CPU usage) shows up because this behavior requires the Starlark rules to create an output that higher-level Starlark rule code also creates, which then causes the expensive "generate missing init.py files" logic to run multiple times as Bazel attempts to consolidate the actual actions to run).

Instead of relying on building one target to materialize files under bazel-bin for another target, users should explicitly specify the targets of interest. e.g., if you do this:

bazel build //foo
bazel-bin/bar

then you must switch to do this:

bazel build //foo //bar
bazel-bin/bar

(note to self: breaking changes policy)

rickeylev avatar Sep 19 '22 19:09 rickeylev

Will #14740 be merged as a prerequisite for this change? If not, won't it wildy exacerbate the problem in #11997?

pcjanzen avatar Sep 19 '22 21:09 pcjanzen

Oh, thanks for pointing those out. Yes, that would exacerbate it. I'll have a look at #14740

rickeylev avatar Sep 20 '22 06:09 rickeylev

https://buildkite.com/bazel/bazelisk-plus-incompatible-flags runs nightly, please add "migration-ready" label when you want the pipeline to test this incompatible flag.

meteorcloudy avatar Sep 21 '22 08:09 meteorcloudy