Search in sources :

Example 1 with AllowedRuleClassInfo

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();
}
Also used : AllowedRuleClassInfo(com.google.devtools.build.lib.query2.proto.proto2api.Build.AllowedRuleClassInfo) RuleClass(com.google.devtools.build.lib.packages.RuleClass)

Aggregations

RuleClass (com.google.devtools.build.lib.packages.RuleClass)1 AllowedRuleClassInfo (com.google.devtools.build.lib.query2.proto.proto2api.Build.AllowedRuleClassInfo)1