Macros
Reducing boilerplate in BUILD files.
When to use a macro
Macros are useful to reduce boilerplate in BUILD files. For example, if you keep using the same value for a field, you can use a macro.
However, also consider that introducing new symbols to BUILD files adds some indirection to your codebase, such as making it harder to follow along with the Pants docs. As with any tool, macros should be used judiciously.
If you instead want to add support for a new language, or do something more complex than a macro allows, create a new target type.
If you are already using a target type, but need to store additional metadata for your plugin, add a new field to the target type.