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

curved-manchester-66006

03/16/2023, 7:58 PM
So someone was reviewing a macro I wrote and asked something along the lines of "do all docker_image targets have `name`s?" Neither
pants help-advanced docker_image
nor
pants help-advanced target
mention a
name
field. But I'm pretty sure targets have names? From the code it looks like the "answer" is: ā€¢ (A) All `pants.engine.target.Target`s have a name, but it maybe an implicit one. ā€¢ (B) but! In the case of macros, when you are looking at kwargs said implicit name would not yet be available. So I think I've answered my own question. But should I have been able to answer (A) from
help
and not grepping the pants source code?
c

curved-television-6568

03/16/2023, 8:16 PM
You did šŸ˜‰ generally, target addresses are described here https://www.pantsbuild.org/v2.16/docs/targets#target-addresses and states about the same as your conclusion
in a macro, if you want to know what the implicit name would be, you can always use
build_file_dir().name
šŸš€ 1
3 Views