Skip to content

Commit e9971c7

Browse files
committed
provide some bzl library guidance
1 parent 01bea90 commit e9971c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

AGENTS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ into the sentence, not verbatim.
2121

2222
### bzl_library targets for bzl source files
2323

24-
* `.bzl` files should have `bzl_library` defined for them.
24+
* A `bzl_library` target should be defined for every `.bzl` file outside
25+
of the `tests/` directory.
2526
* They should have a single `srcs` file and be named after the file with `_bzl`
2627
appended.
27-
* Their deps should be based on the `load()` statements in the source file.
28+
* Their deps should be based on the `load()` statements in the source file
29+
and refer to the `bzl_library` target containing the loaded file.
30+
* For files in rules_python: replace `.bzl` with `_bzl`.
31+
e.g. given `load("//foo:bar.bzl", ...)`, the target is `//foo:bar_bzl`.
32+
* For files outside rules_python: remove the `.bzl` suffix. e.g. given
33+
`load("@foo//foo:bar.bzl", ...)`, the target is `@foo//foo:bar`.
2834
* `bzl_library()` targets should be kept in alphabetical order by name.
2935

3036
Example:

0 commit comments

Comments
 (0)