use of com.google.devtools.build.lib.query2.proto.proto2api.Build.AllowedRuleClassInfo in project bazel by bazelbuild.
the class InfoItem method getAllowedRuleClasses.
private static AllowedRuleClassInfo getAllowedRuleClasses(Collection<RuleClass> ruleClasses, Attribute attr) {
AllowedRuleClassInfo.Builder info = AllowedRuleClassInfo.newBuilder();
info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.ANY);
if (attr.isStrictLabelCheckingEnabled() && attr.getAllowedRuleClassesPredicate() != Predicates.<RuleClass>alwaysTrue()) {
info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.SPECIFIED);
Predicate<RuleClass> filter = attr.getAllowedRuleClassesPredicate();
for (RuleClass otherClass : Iterables.filter(ruleClasses, filter)) {
if (otherClass.isDocumented()) {
info.addAllowedRuleClass(otherClass.getName());
}
}
}
return info.build();
}
Aggregations