Skip to content

incompatible_visibility_private_attributes_at_definition #19330

@fmeum

Description

@fmeum

With this flag enabled, the visibility of a target referenced in a private attribute of a rule is first checked relative to the package that contains the rule definition. If it is visible from the definition, it no longer needs to be visible from the rule usage.

This allows rule authors to limit the visibility of tools and config_settings used internally by a rule. Previously, these targets usually had to have public visibility so that the rule could be used everywhere.

The change can be temporarily disabled via --noincompatible_visibility_private_attributes_at_definition.

Migration:

  • Since visibility is still checked relative to the target as a fallback, this change should not result in any new visibility errors.
  • If you want to limit the packages that can use a given rule, use load visibility instead.

Metadata

Metadata

Assignees

Labels

breaking-change-7.0Incompatible flags to be flipped in Bazel 7.0incompatible-changeIncompatible/breaking changemigration-readyIncompatible flag is ready for migration with Bazel rolling releases or Bazel@last_greenteam-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: process

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions