Skip to content

Commit

Permalink
Constraint proto_library deps and exports on ProtoInfo provider.
Browse files Browse the repository at this point in the history
This makes the constraint more general, perhaps allows users to create there own version of proto_library.

Because proto_library advertises the ProtoInfo provider, all the old uses will continue to work in Bazel.

PiperOrigin-RevId: 404258851
  • Loading branch information
comius authored and copybara-github committed Oct 19, 2021
1 parent d5d095f commit 70ee973
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironmen
<code>proto_library</code> targets.
It may not depend on language-specific libraries.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.override(attr("deps", LABEL_LIST).allowedRuleClasses("proto_library").allowedFileTypes())
.override(
attr("deps", LABEL_LIST).mandatoryProviders(ProtoInfo.PROVIDER.id()).allowedFileTypes())
/* <!-- #BLAZE_RULE(proto_library).ATTRIBUTE(srcs) -->
The list of <code>.proto</code> and <code>.protodevel</code> files that are
processed to create the target. This is usually a non empty list. One usecase
Expand All @@ -77,7 +78,10 @@ public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironmen
List of proto_library targets that can be referenced via "import public" in the proto
source.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("exports", LABEL_LIST).allowedRuleClasses("proto_library").allowedFileTypes())
.add(
attr("exports", LABEL_LIST)
.mandatoryProviders(ProtoInfo.PROVIDER.id())
.allowedFileTypes())
/* <!-- #BLAZE_RULE(proto_library).ATTRIBUTE(strip_import_prefix) -->
The prefix to strip from the paths of the .proto files in this rule.
Expand Down

0 comments on commit 70ee973

Please sign in to comment.