blaze info build-language: include undocumented rules that don't start with "$"
Undocumented rules are called from BUILD/.bzl files, so the output
must include them.  We continue to omit "abstract base" rules that
start with "$", which cannot be named by .bzl programs.
@@ -624,7 +624,7 @@ public abstract class InfoItem {
info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.SPECIFIED);
Predicate<RuleClass> filter = attr.getAllowedRuleClassesPredicate();
for (RuleClass otherClass : Iterables.filter(ruleClasses, filter)) {
- if (otherClass.isDocumented()) {
+ if (!isAbstractRule(otherClass)) {
info.addAllowedRuleClass(otherClass.getName());
}
}
@@ -633,6 +633,10 @@ public abstract class InfoItem {
return info.build();
}
+ private static boolean isAbstractRule(RuleClass c) {
+ return c.getName().startsWith("$");
+ }
+
/**
* Returns a byte array containing a proto-buffer describing the build language.
*/
@@ -640,17 +644,13 @@ public abstract class InfoItem {
BuildLanguage.Builder resultPb = BuildLanguage.newBuilder();
Collection<RuleClass> ruleClasses = provider.getRuleClassMap().values();
for (RuleClass ruleClass : ruleClasses) {
- if (!ruleClass.isDocumented()) {
+ if (isAbstractRule(ruleClass)) {
continue;
}
RuleDefinition.Builder rulePb = RuleDefinition.newBuilder();
rulePb.setName(ruleClass.getName());
for (Attribute attr : ruleClass.getAttributes()) {
- if (!attr.isDocumented()) {
- continue;
- }
-
AttributeDefinition.Builder attrPb = AttributeDefinition.newBuilder();
attrPb.setName(attr.getName());
// The protocol compiler, in its infinite wisdom, generates the field as one of the
