cold-mechanic-10814
03/29/2023, 9:28 AMclass MyRef(SpecialCasedDependencies):) used by some custom targets types. I have also extended some existing target types using register_plugin_field.
In my rule, I want to request all of the targets that have this field. I could request AllTargets and then iterate and filter, but that seems like the wrong approach. I suspect that this is what Field Sets are for - but I may be wrong, and I'm not entirely sure how to use them.
I can define a new Field Set with the required fields, but then how do I request all the targets (or at least field set instances)? Is there any documentation on this? I've seen some examples of usage, such as extending existing goals like package, but that seems orthogonal to what I'm trying to do.
Can anyone point me in the right direction?curved-television-6568
03/29/2023, 12:42 PMAllTargets and then ask for all/any field sets for those targets, so to me iterating over all targets doesn’t seem worse than what is already being done in pants.curved-television-6568
03/29/2023, 12:43 PMcurved-television-6568
03/29/2023, 12:45 PMAllTargets are dynamic (i.e. follows what specs you provide on the command line, so it is only really all targets in your project if you run pants with the :: spec)cold-mechanic-10814
03/29/2023, 1:00 PMAllTargetshappy-kitchen-89482
03/29/2023, 5:08 PMcold-mechanic-10814
03/30/2023, 7:49 AMtgt.has_field() call?curved-television-6568
03/30/2023, 1:21 PMisinstance(tgt, SomeTarget) which is what Benjy referred to with
testing for the target type
happy-kitchen-89482
03/30/2023, 10:43 PMtgt.has_field() seems fine to me if the "field set" is just a single field