better-boots-10807
08/31/2022, 11:08 PMpasswd file and a group file) and the rest are even more indirect (*.repo files containing the yum repo definitions for the repos declared in the Treefile). Is the right way to model this:
1. Some kind of SourcesField subclass that will magically attach the dependent files to the Treefile by attaching the passwd and group files and then inspecting the Treefile and the nearby *.repo files to work out which of those need to be attached.
2. Some kind of Target and/or InferredDependencies construct?wide-midnight-78598
09/01/2022, 12:27 AMdependency_inference - which feels closer to option 1.
This is a topic I wish I knew more about, but it's still the most voodoo to me, because I haven't had to write one yet. But here is one I use as a reference (getting C/C++ headers from a C source), and of course, the python ones:
https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/cc/dependency_inference/rules.py
https://github.com/pantsbuild/pants/tree/main/src/python/pants/backend/python/dependency_inferencewide-midnight-78598
09/01/2022, 12:28 AMConfigRequest but this feels less like that use case. That's very common in linters/formatterswide-midnight-78598
09/01/2022, 12:32 AMbetter-boots-10807
09/01/2022, 12:32 AMwide-midnight-78598
09/01/2022, 12:36 AMwide-midnight-78598
09/01/2022, 12:37 AMansible_sources is a generator for a list of ansible_source targetswide-midnight-78598
09/01/2022, 12:37 AMwide-midnight-78598
09/01/2022, 12:38 AMbetter-boots-10807
09/01/2022, 12:39 AMwitty-crayon-22786
09/01/2022, 3:32 AMSourcesField .
since it sounds like some of them are only known dynamically based on the content of some of those files, you could use target generation to generate targets that match all of the files: that allows you to run @rule logic to locate all of the files and apply owning targets to them. because you would have parsed the files, you could generate the targets with appropriate dependencies in the first place (no inference needed)
alternatively to target generation, you could require explicit targets be declared in BUILD files (or be generated by tailor): then dependency inference would need to come into play to find the dependencies between those targets