use of com.google.devtools.build.lib.packages.AttributeValueSource in project bazel by bazelbuild.
the class SkylarkRuleClassFunctions method attrObjectToAttributesList.
protected static ImmutableList<Pair<String, Descriptor>> attrObjectToAttributesList(Object attrs, FuncallExpression ast) throws EvalException {
ImmutableList.Builder<Pair<String, Descriptor>> attributes = ImmutableList.builder();
if (attrs != Runtime.NONE) {
for (Map.Entry<String, Descriptor> attr : castMap(attrs, String.class, Descriptor.class, "attrs").entrySet()) {
Descriptor attrDescriptor = attr.getValue();
AttributeValueSource source = attrDescriptor.getValueSource();
String attrName = source.convertToNativeName(attr.getKey(), ast.getLocation());
attributes.add(Pair.of(attrName, attrDescriptor));
}
}
return attributes.build();
}
Aggregations