https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

01/21/2022, 12:54 AM
This will probably sound bad without context, but is there any way to add a directory as a dependency recursively? I've got a bunch of
protobuf_sources
scattered under a tree and I need to bring them all in as a dependency for a
python_source
.
h

hundreds-father-404

01/21/2022, 1:00 AM
Hi! Are they not being inferred? Pants has dependency inference for Protobuf,
f.proto
maps to
f_pb2.py
. A major benefit of this approach is that it has file-level granularity—Pants will only generate the files that are actually needed, and it will cache each of those generations But, you might need to set up source roots still https://www.pantsbuild.org/docs/source-roots
Failing that...the idiomatic pattern for this is to use a generic
target()
as a "bag of dependencies". You add everything you want to the
dependencies
of this
target()
, and then when you depend on that
target()
you'll transitively pull everything in. https://www.pantsbuild.org/docs/reference-target
h

high-yak-85899

01/21/2022, 1:02 AM
They're not. The paths are, for legacy reasons, coming from a yaml file. So, unless I go add all the
protobuf_sources
as a dependency, it doesn't get picked up because there's nothing for pants to infer.
đź‘Ť 1
4 Views