use of com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder in project bundletool by google.
the class IntentFilter method asXmlProtoElement.
@Memoized
public XmlProtoElement asXmlProtoElement() {
XmlProtoElementBuilder elementBuilder = XmlProtoElementBuilder.create(INTENT_FILTER_ELEMENT_NAME);
setActionElement(elementBuilder);
setCategoryElement(elementBuilder);
return elementBuilder.build();
}
use of com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder in project bundletool by google.
the class Receiver method asXmlProtoElement.
@Memoized
public XmlProtoElement asXmlProtoElement() {
XmlProtoElementBuilder elementBuilder = XmlProtoElementBuilder.create(RECEIVER_ELEMENT_NAME);
setNameAttribute(elementBuilder);
setExportedAttribute(elementBuilder);
setIntentFilterElement(elementBuilder);
return elementBuilder.build();
}
use of com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder in project bundletool by google.
the class SplitsProtoXmlBuilderTest method buildEmpty.
@Test
public void buildEmpty() {
SplitsProtoXmlBuilder splitsProtoXmlBuilder = new SplitsProtoXmlBuilder();
XmlNode rootNode = splitsProtoXmlBuilder.build();
// Answer:
// <splits>
// </splits>
XmlProtoElementBuilder actual = XmlProtoElementBuilder.create("splits");
assertThat(rootNode).isEqualTo(getProto(actual));
}
use of com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder in project bundletool by google.
the class LocaleConfigXmlInjectorTest method createLocalesXmlNode.
private static XmlNode createLocalesXmlNode(HashSet<String> locales) {
XmlProtoElementBuilder localesConfigXml = XmlProtoElementBuilder.create("locale-config");
locales.forEach(locale -> localesConfigXml.addChildElement(createAttributes(locale)));
return XmlProtoNode.createElementNode(localesConfigXml.build()).getProto();
}
use of com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder in project bundletool by google.
the class ManifestEditor method setMetadataValue.
private ManifestEditor setMetadataValue(String name, XmlProtoAttributeBuilder valueAttr) {
XmlProtoElementBuilder applicationEl = manifestElement.getOrCreateChildElement(APPLICATION_ELEMENT_NAME);
Optional<XmlProtoElementBuilder> existingMetadataEl = applicationEl.getChildrenElements(META_DATA_ELEMENT_NAME).filter(metadataEl -> metadataEl.getAndroidAttribute(NAME_RESOURCE_ID).map(nameAttr -> name.equals(nameAttr.getValueAsString())).orElse(false)).collect(toOptional());
if (existingMetadataEl.isPresent()) {
existingMetadataEl.get().removeAndroidAttribute(VALUE_RESOURCE_ID).addAttribute(valueAttr);
} else {
applicationEl.addChildElement(XmlProtoElementBuilder.create(META_DATA_ELEMENT_NAME).addAttribute(createAndroidAttribute("name", NAME_RESOURCE_ID).setValueAsString(name)).addAttribute(valueAttr));
}
return this;
}
Aggregations