Make bazel-bin more reliable #15005
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-Configurability
platforms, toolchains, cquery, select(), config transitions
type: feature request
Description of the problem / feature request:
Targets don't appear in
bazel-bin
in mixed-configuration builds. See, for example, #12389.--use_top_level_targets_for_symlinks
partially solves this problem, but not completely.Any other information, logs, or outputs that you want to share?
I explored this and wrote some prototype code.
Conclusion: there's no trivial way to support multi-config
bazel-bin
, if we consider "trivial" = "super-low chance of depot breakages"The code I wrote added a new postprocessing step: if an output isn't in the top-level configuration, add a new symlink under
bazel-bin
to it. i.e.:This roughly works but sacrifices Bazel's correctness guarantees:
bazel-bin/mydir/myapp
?bazel-bin/mydir/myapp
doesn't existbazel-bin/mydir/myapp
is the symlink from the last build and we need to update it?bazel-bin/mydir/myapp
" if it's a symlinkbazel-out
rootSince by definition this problem occurs when mixing configs, there is no perfect solution in which
bazel-bin
points to a single config base.Therefore, to stay correct we'd need to refactor
bazel-bin
to mix configs. This is fine:bazel-bin -> bazel-out/mixedconfigs/bin
and then symlink forest all target outputs. And clean outbazel-out/mixedconfigs/
for each build.But which outputs do we symlink from mixedconfigs? Just the targets? Also its runfiles? Do debuggers need debug symbols? We can no longer take for granted that every output in
bazel-bin/
can access all its peer outputs in the same directory. Only if we symlink them all.As a worst-case backup we could symlink the total union of all
bazel-out/...
paths, and give up if there are any conflicts. This seems like overkill though.The ultimate answer depends on how people really depend on
bazel-bin
in practice.The text was updated successfully, but these errors were encountered: