Trying to map all targets in a directory to a targ...
# general
r
Trying to map all targets in a directory to a target dependencies. Following the docs here: https://www.pantsbuild.org/docs/targets#dependencies-and-dependency-inference Is there any way we can describe all targets in a directory instead of listed them out individually (something like
app/example::
)?
h
App/example: is a glob for all targets in a dir, but not subdirs. A single colon
r
ahh okay I see. Is there any way to describe all targets under a specific directory (including sub dirs)
h
example::
is all targets in the dir and subdirs
r
so when I try that I see:
Copy code
pants.build_graph.address.InvalidTargetName: Address spec app/example:: has no name part.
The BUILD file looks like this:
Copy code
python_tests(
    name="tests0",
    dependencies=[
        "app/example::"
    ]
)
h
Ah, to clarify, target globs only work on the command line. You have to be explicit in the
dependencies
field. If you find you're repeating yourself a lot, you can create a generic
target
as a "bag of dependencies" https://www.pantsbuild.org/docs/reference-target. Or implement a custom dependency inference plugin
1
r
awesome that works thank you!
❤️ 1