What would be the cleanest way to add to the depen...
# general
h
What would be the cleanest way to add to the dependency graph that Pants uses with the
--changed-since
flag? I can of course extract that logic with
pants list --changed-since ::
and append items, but is there a nice way to provide key value pairs to this graph e.g.
arbritary_file.txt: ["other", "dependent", "files"]
s
If I'm understanding the question correctly..., I think you could use the
dependencies
option on the target Here's an example.. Folder structure (both text files are empty)
Copy code
pants-example
├── BUILD
├── example1.txt
└── example2.txt
The BUILD file:
Copy code
file(
  name="example1",
  source="example1.txt",
  dependencies=[":example2"]
)

file(
  name="example2",
  source="example2.txt",
)
and using
pants filedeps
to see the dependencies:
Copy code
$ pants filedeps --filedeps-transitive pants-example/example1.txt
pants-example/BUILD
pants-example/example1.txt
pants-example/example2.txt
h
Ah that is useful to know. Thanks! What’s the closest I could get to a
dir -> target
relationship here? e.g. in the case of multiple dirs containing Dockerfiles which aren’t handled by Pants targets, I’ll like to explicitly set target dependencies
s
np! Perhaps
target(...)
might help get what you want https://www.pantsbuild.org/dev/reference/targets/target
Or maybe using
files(...)
in some way like this:
Copy code
files(
  name="some_dir",
  sources=["some_dir/*.txt"]
)

files(
  name="other_dir",
  sources=["other_dir/*.txt"]
)
https://www.pantsbuild.org/dev/reference/targets/files