Fix Bazel build output resolution under --symlink_prefix#67
Closed
hartikainen wants to merge 0 commit into
Closed
Conversation
hartikainen
force-pushed
the
enable-symlink_prefix
branch
3 times, most recently
from
June 7, 2026 20:00
9cde57d to
f163839
Compare
hartikainen
added a commit
to hartikainen/xmanager
that referenced
this pull request
Jul 8, 2026
A target's default output group is not guaranteed to be a single file: rules_python's `py_binary` reports the launcher alongside its `.py` sources (and `.pyc` under precompilation), so the old `assert len(paths) == 1` breaks. Add `query_executable_output` to look up the canonical `files_to_run.executable` via `cquery` and `_select_executable` to pick the matching built path, with unit tests covering the fast path, disambiguation, and error cases. `query_executable_output` is placed at the end of `bazel_tools.py` (rather than next to `_root_absolute_path`) so google-deepmind#67's `--symlink_prefix` helpers can be applied cleanly on top of this commit.
hartikainen
force-pushed
the
enable-symlink_prefix
branch
2 times, most recently
from
July 9, 2026 10:06
195e692 to
397dc4f
Compare
Author
|
These changes are included in 424da16. |
hartikainen
force-pushed
the
enable-symlink_prefix
branch
from
July 20, 2026 08:48
397dc4f to
424da16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #53.
_build_multiple_targetscurrently joints the workspace directory with each output'spath_prefix(bazel-out/...), which only resolves through the defaultbazel-outconvenience symlink. Under a non-default--symlink_prefix(e.g.--symlink_prefix=.bazel/) that symlink doesn't exist, so the returned paths point nowhere and packaging fails.This commit refactors the resolution to prefer
file://URI that Bazel emits in the BEPFilemessages. If I understand correctly, these are the authoritative on-disk paths, independent of--symlink_prefix. It falls back to<execution_root>/<path_prefix>/<name>for non-file://URIs (e.g.bytestream://outputs from remote builds that were downloaded locally via--remote_download_outputs=toplevel). Note this only resolves where an output lives; under--remote_download_minimalthe bytes are never materialized locally, so downstream consumers still fail regardless of the path returned.This also extracts the per-
Fileresolution into a pure_resolve_output_path(file, exec_root)helper function and thus makes the logic unit-testable without shelling out to Bazel. The execution root is resolved lazily (and at most once) viafunctools.lru_cacheto keep the unnecessarybazel infooff the local-build path. A non-localhostURI authority is preserved as a//host/...UNC path rather than silently dropped. Adds tests coveringfile://decoding (including percent-encoding and authorities) and thepath_prefixfallback.Implemented with the help of
gemini-cli.