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

Optionally infer name in use_extension and use_repo_rule #22168

Closed
wants to merge 1 commit into from

Commits on Apr 29, 2024

  1. Optinally infer name in use_extension and use_repo_rule

    Following the documented best practices for [rules and extensions](https://docs.google.com/document/d/1L1JFgjpZ7SrBinb24DC_5nTIELeYDacikcme-YcA7xs/edit#heading=h.cy0m49ne5key), a symbol named `foo_deps` should be available from a `.bzl` file called `foo_deps.bzl`. This still results in pretty duplicative `MODULE.bazel` lines:
    
    ```
    foo_deps = use_extension("@rules_foo//foo/extensions:foo_deps.bzl", "foo_deps")
    ```
    
    Instead, Bazel now uses this convention to infer the name if not given:
    
    ```
    foo_deps = use_extension("@rules_foo//foo/extensions:foo_deps.bzl")
    ```
    
    This makes typos less likely and also nudges ruleset authors to adopt the new convention by providing nice syntax.
    
    RELNOTES: `use_extension` and `use_repo_rule` now infer the name from the basename of the `.bzl` file if not provided explicitly.
    fmeum committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    6136159 View commit details
    Browse the repository at this point in the history