Repository navigation
Description
Visibility on config_setting isn't historically enforced. This is purely for legacy reasons. There's no philosophical reason to distinguish them.
This flag, in conjunction with --incompatible_enforce_config_setting_visibility (#12932), removes that distinction.
Values:
--incompatible_config_setting_private_default_visibility=off: if--incompatible_enforce_config_setting_visibility=off, every config_setting is visible to every target, regardless of visibility settings. Else, everyconfig_settingwithout an explicitvisibilitysetting is//visibility:public(ignoring package visibility defaults)--incompatible_config_setting_private_default_visibility=on: if--incompatible_enforce_config_setting_visibility=off, every config_setting is visible to every target, regardless of visibility settings. Else,config_settingfollows the same visibility rules as all other targets.
Incompatibility error:
ERROR: myapp/BUILD:4:1: in config_setting rule //myapp:my_config: target 'myapp:my_config' is not visible from target '//some:other_target. Check the visibility declaration of the former target if you think the dependency is legitimate
Migration:
Treat all config_settings as if they follow standard visibility logic at https://docs.bazel.build/versions/master/visibility.html: have them set visibility explicitly if they'll be used anywhere outside their own package. The ultimate goal of this migration is to fully enforce that expectation.
Activity
[-]Incompatible change: --incompatible_config_setting_public_default_visibility[/-][+]Incompatible change: --incompatible_config_setting_private_default_visibility[/+]Roll forward config_setting visibility enforcement behind a flag.
Roll forward config_setting visibility enforcement behind a flag.
Roll forward config_setting visibility enforcement behind a flag.
meteorcloudy commentedon Sep 14, 2022
I assume this flag is migration ready? Should we flip it before 6.0 cut?
gregestren commentedon Sep 14, 2022
What was the risk calculation for flipping? I can't guarantee repos won't break. If that's okay, I support pushing this forward.
More specifically, if we're not worried about initial breakages, I'd flip both this and #12932. If we want to be more careful I'd just flip #12932. If we don't want any change of any breakages I wouldn't flip.
I'm hoping the answer is "flip both and adjust whatever breakages we see."
The reason this isn't trivial is repos can already set visibility on
config_setting. So if a repo hasconfig_setting, visibility = '//visibility:private'), today it's actually public and may be depended on by targets in other packages. If we flip these flags then suddenly we give that declaration meaning and, while technically correct, existing dependencies may no longer be valid.So it's definitely a strict improvement but we have to get mislabeled repo code fixed up for it to finally stick.
[-]Incompatible change: --incompatible_config_setting_private_default_visibility[/-][+]incompatible_config_setting_private_default_visibility[/+]51 remaining items
PR #58832: Flip --incompatible_enforce_config_setting_visibility in .…
gregestren commentedon Feb 1, 2023
Thanks for recent updates, @keertk . I'm excited to see you making this 7.0 compatible. Is there an appropriate 7.0 Github label for this issue? Or does
migration-readyalready cover it?keertk commentedon Feb 1, 2023
Hey @gregestren, just created/added
breaking-change-7.0. Thanks!Roll forward bazelbuild@1fdc628: default --incompatible_config_settin…
Automated rollback of commit 9b420b5.
Add support for --incompatible_config_setting_private_default_visibility
Specify visibility for all config_setting targets
Fix visibility of //java/gazelle:embedded_server
Fix visibility of //java/gazelle:embedded_server
Fix visibility of //java/gazelle:embedded_server (#401)
Fix visibility of //java/gazelle:embedded_server (bazel-contrib#401)