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

rule() API is not documented at all #850

Open
Timmmm opened this issue Jan 20, 2025 · 3 comments
Open

rule() API is not documented at all #850

Timmmm opened this issue Jan 20, 2025 · 3 comments

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Jan 20, 2025

Adding custom rules is quite a fundamental part of a build system, but as far as I can tell the API for rule() is not documented at all. The best you get is a single example in this page:

pascal_binary = rule(
    impl = pascal_binary_impl,
    attrs = {
        "deps": attrs.list(attrs.dep()),
        "src": attrs.source(),
    }
)

I tracked the source to here which lists all the parameters:

  • impl
  • attrs
  • cfg
  • doc
  • is_configuration_rule
  • is_toolchain_rule
  • uses_plugins
  • eval
@IanChilds
Copy link
Contributor

I think the API is documented here: https://buck2.build/docs/api/build/#rule

@Timmmm
Copy link
Contributor Author

Timmmm commented Jan 20, 2025

Ah you're right. That has a really confusing structure - it's not listed at all in the tree on the left and it's not obvious that the heading (Starlark APIs, Build APIs, etc.) actually has a load of the documentation.

Also unfortunately the documentation you linked doesn't actually document anything (except the types). E.g. what does is_toolchain_rule do?

@cbarrete
Copy link
Contributor

I agree with Tim, this is really not very discoverable for such a fundamental API, and a function signature without more than a trivial example in its docstring hardly counts as documentation :/

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

No branches or pull requests

3 participants