-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: buguntriaged
Description
Description of the bug:
Seems like the visibility of labels used in the default values of a rule is checked against a rule extensions's package instead of the parent rule. This leads to new visibility errors that can't be resolved, especially since we can't override private attributes in a rule extension.
Which category does this issue belong to?
Rules API
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Parent rule (in rules_apple):
apple_precompiled_resource_bundle = rule(
...
attrs = {
...
"_fallback_infoplist": attr.label(
allow_single_file = True,
default = "//apple/internal/resource_rules:Info.plist",
),
...
},
...
)
Rule extension:
load(
"@rules_apple//apple:resources.bzl",
_apple_precompiled_resource_bundle = "apple_precompiled_resource_bundle",
)
RedditResourceBundleInfo = provider(
"Resource bundle info",
fields = {
"bundle_name": "The name of the bundle.",
},
)
def _apple_precompiled_resource_bundle_impl(ctx):
providers = ctx.super(_apple_precompiled_resource_bundle).providers
return providers + [
RedditResourceBundleInfo(bundle_name = ctx.attr.bundle_name),
]
apple_precompiled_resource_bundle = rule(
implementation = _apple_precompiled_resource_bundle_impl,
parent = _apple_precompiled_resource_bundle,
)
Error:
ERROR: BUILD.bazel:14:27: in apple_precompiled_resource_bundle rule //Some:Target: Visibility error: target '@@rules_apple+//apple/internal/resource_rules:Info.plist' is not visible from target '//another:extension.bzl'
Recommendation: modify the visibility declaration if you think the dependency is legitimate. For more info see https://bazel.build/concepts/visibility. To set the visibility of that source file target, use the exports_files() function
Which operating system are you running Bazel on?
macOS
What is the output of bazel info release?
release 8.5.1
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: buguntriaged