bazel
bazel copied to clipboard
Ability to query for runtime dependencies
Description of the feature request:
I believe it would be useful to query for the "runtime" dependencies of a given target. By "runtime" here, I don't necessarily just mean the content of the runtime_deps
attribute that exists on some targets, but the set of both deps
and runtime_deps
excluding anything marked as neverlink=True
.
If this feature already exists, I can't see anything obvious in the documentation about it.
As an example:
java_library(name = "a", ...)
java_library(name = "b", deps=[":a"], ..., neverlink=True)
java_library(name = "c", ...)
java_library(name = "d", ...)
java_library(name = "e", deps = [":b", ":c"], runtime_deps=[":d"], ...)
Given the following targets, I'd expect to be able to query for something similar to the following:
$ bazel query 'deps(//:e)' --noimplicit_deps
//:a
//:b
//:c
//:d
//:e
$ bazel query 'runtime_deps("//:e")' --noimplicit_deps
//:c
//:d
//:e
I've represented it here as a query function, but I'm not sure if a command line argument would be more appropriate?
Which category does this issue belong to?
Core
What underlying problem are you trying to solve with this feature?
To be able to query for the dependencies of a target that will be required at runtime.
Which operating system are you running Bazel on?
Ubuntu 23.10
What is the output of bazel info release
?
release 6.4.0
If bazel info release
returns development version
or (@non-git)
, tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD
?
No response
Have you found anything relevant by searching the web?
I couldn't find anything obvious
Any other information, logs, or outputs that you want to share?
No response