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

feat(gazelle_python_manifest): provide a target with the given name #787

Conversation

mattem
Copy link
Collaborator

@mattem mattem commented Aug 10, 2022

Provides a somewhat useful target as the "default" target for the macro, that is, the target that is the actual name of the macro.

Having this is incredibly useful when attempting to do static analysis of BUILD files to determine targets, but where those targets are macros and don't expand to a target with the given name it causes issues with any further bazel processing of that target (as it doesn't exist!).

While there are workarounds, it seems sane and good practice to simply provide a target with that name.

@mattem mattem requested a review from f0rmiga as a code owner August 10, 2022 21:15
Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

Agreed, and it's documented on https://bazel.build/rules/bzl-style#macros:

A macro should take a name argument and define a target with that name. That target becomes that macro's main target.

@alexeagle alexeagle merged commit 0609001 into main Aug 10, 2022
@mattem mattem deleted the feat/gazelle_python_manifest_has_a_default_target_that_makes_query_better branch January 31, 2023 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants