-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add support for rule visibility for private tools/dependencies. #7377
Comments
Is this really Starlark? I think the bulk of the work is analysis. |
I also think we should raise this above P3. Without the mechanism, it is impossible to build a pair of (rule, helper tool) where the implementation of the helper is truly private. |
Starlark team has no ressources to work on it this year. Feel free to reassign. |
Same issue happens with protobuf rules. The protobuf C++ runtime has APIs and I would like to write visibility restrictions that say that only the implementation of |
Design: https://github.com/bazelbuild/proposals/blob/master/designs/2019-10-15-tool-visibility.md This can be tested with the flag |
This looks great. A couple comments/questions:
|
What I would like to see is a document which gathers some use cases so that we can test solutions against it. Some things which come to my mind are
Are there others?
Does that get the general sense of what you want? |
@aiuto that is close, but I am talking about rules like Right now in my aspect-based rules, I have to resort to obnoxious long names as a pseudo-visibility: https://github.com/protocolbuffers/upb/blob/22182e6e54e892f93f26d0522487997d30f604af/bazel/upb_proto_library.bzl#L235 |
That's the reason why the flag is not enabled by default. There's no planned rollout at this time. |
Can we let rules specify this behavior in the label itself, so it doesn't need to be a global flag flip? Right now I have:
Could I instead write:
|
Ping @laurentlb ? I don't see why this needs to be a global flag. If it can be an attribute on |
@brandjon |
No, this is a separate matter of target visibility. Still on my radar but not this release cycle. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This has been fixed in Bazel 7: #19330 |
Description of the problem / feature request:
Currently, if a rule has a private tool that it needs to invoke as part of its logic, this tool needs to have public visibility since visibility resolution is per target, not per rule.
Bazel should support a mechanism to allow any target of a specific rule to have access to the private tools/dependencies, but not having to expose these dependencies publicly.
Take for example: https://github.com/bazelbuild/rules_apple/blob/master/tools/codesigningtool/BUILD#L9
There's no available mechanism through which to make this target private to instances of
ios_application
, since this rule can be created in any package and maintaining a whitelist is a huge burden.Feature requests: what underlying problem are you trying to solve with this feature?
Lack of visibility enforcement and needing to expose all internals of rules into potential abuse, making it harder to control affected targets and therefore make improvements/changes.
The text was updated successfully, but these errors were encountered: