use of com.android.tools.build.bundletool.model.ResourceInjector in project bundletool by google.
the class LocaleConfigXmlInjector method injectLocaleConfigXml.
private static ModuleSplit injectLocaleConfigXml(ModuleSplit split, XmlNode xmlNode) {
ResourceInjector resourceInjector = ResourceInjector.fromModuleSplit(split);
ResourceId resourceId = resourceInjector.addResource(XML_TYPE_NAME, createXmlEntry());
ModuleEntry localesConfigEntry = addLocalesConfigEntry(xmlNode);
return split.toBuilder().setResourceTable(resourceInjector.build()).setEntries(ImmutableList.<ModuleEntry>builder().addAll(split.getEntries()).add(localesConfigEntry).build()).setAndroidManifest(split.getAndroidManifest().toEditor().setLocaleConfig(resourceId.getFullResourceId()).save()).build();
}
use of com.android.tools.build.bundletool.model.ResourceInjector in project bundletool by google.
the class SplitsXmlInjector method injectSplitsXml.
private static ModuleSplit injectSplitsXml(ModuleSplit split, XmlNode xmlNode) {
ZipPath resourcePath = getUniqueResourcePath(split);
ResourceInjector resourceInjector = ResourceInjector.fromModuleSplit(split);
ResourceId resourceId = resourceInjector.addResource(XML_TYPE_NAME, createXmlEntry(resourcePath));
return split.toBuilder().setResourceTable(resourceInjector.build()).setEntries(ImmutableList.<ModuleEntry>builder().addAll(split.getEntries()).add(ModuleEntry.builder().setPath(resourcePath).setContent(ByteSource.wrap(xmlNode.toByteArray())).build()).build()).setAndroidManifest(split.getAndroidManifest().toEditor().addMetaDataResourceId(METADATA_KEY, resourceId.getFullResourceId()).save()).build();
}
Aggregations