Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: provide example how to convert target addresses to source files in rules API #20524

Conversation

AlexTereshenkov
Copy link
Member

@AlexTereshenkov AlexTereshenkov commented Feb 11, 2024

A plugin may need to output a list of resources (e.g. source code files) so that it can be fed to another program (outside of Pants). Pants operates on targets, and they can won't be understood by anything outside of Pants.

E.g. some/config/folder/example1.cfg:../config would need to be trimmed to map to a file. This is similar to what filedeps goal would do, but without including BUILD files which are often irrelevant.

This snippet shows how this is done.

@@ -235,7 +235,7 @@ class MyTarget(Target):
Then, to resolve the addresses, you can use `UnparsedAddressInputs`:

```python
from pants.engine.addresses import Address, Addresses, UnparsedAddressInputs
from pants.engine.addresses import Addresses, UnparsedAddressInputs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

@AlexTereshenkov AlexTereshenkov marked this pull request as ready for review February 11, 2024 16:06
@AlexTereshenkov AlexTereshenkov merged commit 1740a4e into pantsbuild:main Feb 12, 2024
24 checks passed
@AlexTereshenkov AlexTereshenkov deleted the docs/plugins/convert-address-to-sources branch February 12, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants