Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

##### Enhancements

- Expose a stable `@periphery//bazel:generated` package group so Bazel projects can grant visibility to Periphery's generated scan target and use `--bazel-check-visibility` safely.
- Added a `--bazel-query` option to override the default Bazel top-level target query.

##### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ Periphery's generated scan rule follows embedded bundle and plugin edges transit
> [!TIP]
> By default, Periphery passes `--check_visibility=false` to `bazel run` to simplify integration, since the generated scan target references your project's targets which may not otherwise be visible. However, disabling visibility checking can invalidate Bazel's analysis cache, resulting in slower subsequent builds.
>
> You can disable this behavior with the `--bazel-check-visibility` option. You must ensure the necessary targets are visible to the generated package by adding the `@@+generated+periphery_generated//:__pkg__` visibility label to your targets.
> You can disable this behavior with the `--bazel-check-visibility` option. You must ensure the necessary targets are visible to Periphery's generated package, for example by adding the `@@+generated+periphery//bazel:generated` visibility label to your targets.

### Other

Expand Down
4 changes: 4 additions & 0 deletions bazel/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package_group(
name = "generated",
includes = ["@periphery_generated//visibility:package_group"],
)
8 changes: 8 additions & 0 deletions bazel/generated.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
"""

def _generated_repo_impl(repository_ctx):
repository_ctx.file(
"visibility/BUILD.bazel",
"""package_group(
name = "package_group",
packages = ["//..."],
)
""",
)
repository_ctx.symlink(
"/var/tmp/periphery_bazel/BUILD.bazel",
"BUILD.bazel",
Expand Down
Loading