Skip to content

bazel query --output=location does not print source file paths #8900

@wchargin

Description

@wchargin

Description of the problem / feature request:

The docs for --output=location say:

For source files, the location of line 1 of the actual file is printed.

This is what I want, but it is not what happens: instead, what is
printed is the location of a reference to the source file from a BUILD
file. There appears to be no way to actually turn a label for a source
file into that source file’s path on disk.

Feature requests: what underlying problem are you trying to solve with this feature?

N/A

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ cd "$(mktemp -d)"
$ >WORKSPACE
$ >BUILD <<EOF cat
> py_binary(
>   name = "main",
>   srcs = ["main.py"],
> )
> EOF
$ >main.py
$ bazel query //:main.py --output=location 2>/dev/null
/tmp/tmp.97B2nY3jsI/BUILD:3:10: source file //:main.py

Not even --output=proto includes the promised information:

$ bazel query //:main.py --output=proto | strings
//:main.py
/tmp/tmp.97B2nY3jsI/BUILD:3:10*

What operating system are you running Bazel on?

gLinux (like Debian)

What's the output of bazel info release?

release 0.28.0

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

N/A

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

Nope.

Any other information, logs, or outputs that you want to share?

Nope.

Metadata

Metadata

Assignees

Labels

P3We're not considering working on this, but happy to review a PR. (No assignee)team-PerformanceIssues for Performance teams

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions