diff --git a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java index fbad4294eb679e..f124e6c8bc866a 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java +++ b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java @@ -36,6 +36,7 @@ import static com.google.devtools.build.lib.packages.Types.STRING_DICT; import static com.google.devtools.build.lib.packages.Types.STRING_LIST; import static com.google.devtools.build.lib.packages.Types.STRING_LIST_DICT; +import static com.google.devtools.build.lib.util.StringEncoding.internalToUnicode; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; @@ -131,7 +132,7 @@ private static Build.Attribute getAttributeProto( boolean includeAttributeSourceAspects, LabelPrinter labelPrinter) { Build.Attribute.Builder attrPb = Build.Attribute.newBuilder(); - attrPb.setName(name); + attrPb.setName(internalToUnicode(name)); attrPb.setExplicitlySpecified(explicitlySpecified); maybeSetNoDep(type, attrPb); @@ -149,7 +150,7 @@ private static Build.Attribute getAttributeProto( if (includeAttributeSourceAspects) { attrPb.setSourceAspectName( - sourceAspect != null ? sourceAspect.getAspectClass().getName() : ""); + sourceAspect != null ? internalToUnicode(sourceAspect.getAspectClass().getName()) : ""); } return attrPb.build(); @@ -174,7 +175,7 @@ private static void writeSelectorListToBuilder( for (Selector selector : selectorList.getSelectors()) { Build.Attribute.Selector.Builder selectorBuilder = Build.Attribute.Selector.newBuilder() - .setNoMatchError(selector.getNoMatchError()) + .setNoMatchError(internalToUnicode(selector.getNoMatchError())) .setHasDefaultValue(selector.hasDefault()); // Note that the order of entries returned by selector.getEntries is stable. The map's @@ -184,7 +185,7 @@ private static void writeSelectorListToBuilder( (condition, conditionValue) -> { SelectorEntry.Builder selectorEntryBuilder = SelectorEntry.newBuilder() - .setLabel(labelPrinter.toString(condition)) + .setLabel(internalToUnicode(labelPrinter.toString(condition))) .setIsDefaultValue(!selector.isValueSet(condition)); if (conditionValue != null) { @@ -211,16 +212,16 @@ private static void writeAttributeValueToBuilder( if (type == INTEGER) { builder.setIntValue(((StarlarkInt) value).toIntUnchecked()); } else if (type == STRING || type == STRING_NO_INTERN) { - builder.setStringValue(value.toString()); + builder.setStringValue(internalToUnicode(value.toString())); } else if (type == LABEL || type == NODEP_LABEL || type == OUTPUT || type == GENQUERY_SCOPE_TYPE || type == DORMANT_LABEL) { - builder.setStringValue(labelPrinter.toString((Label) value)); + builder.setStringValue(internalToUnicode(labelPrinter.toString((Label) value))); } else if (type == STRING_LIST || type == DISTRIBUTIONS) { for (Object entry : (Collection) value) { - builder.addStringListValue(entry.toString()); + builder.addStringListValue(internalToUnicode(entry.toString())); } } else if (type == LABEL_LIST || type == NODEP_LABEL_LIST @@ -228,7 +229,7 @@ private static void writeAttributeValueToBuilder( || type == GENQUERY_SCOPE_TYPE_LIST || type == DORMANT_LABEL_LIST) { for (Label entry : (Collection