use of com.android.aapt.Resources.Item in project bundletool by google.
the class ResourceAnalyzer method transitiveClosure.
private ImmutableSet<ResourceId> transitiveClosure(ImmutableSet<ResourceId> anchorResources) throws IOException {
Set<ResourceId> referencedResources = new HashSet<>();
Queue<ResourceId> resourcesToInspect = new ArrayDeque<>();
resourcesToInspect.addAll(anchorResources);
while (!resourcesToInspect.isEmpty()) {
ResourceId resourceId = resourcesToInspect.remove();
if (referencedResources.contains(resourceId) || !baseModuleResourcesById.containsKey(resourceId)) {
continue;
}
referencedResources.add(resourceId);
ResourceTableEntry resourceEntry = baseModuleResourcesById.get(resourceId);
for (ConfigValue configValue : resourceEntry.getEntry().getConfigValueList()) {
switch(configValue.getValue().getValueCase()) {
case ITEM:
Item item = configValue.getValue().getItem();
resourcesToInspect.addAll(findAllReferencedAppResources(item));
break;
case COMPOUND_VALUE:
CompoundValue compoundValue = configValue.getValue().getCompoundValue();
resourcesToInspect.addAll(findAllReferencedAppResources(compoundValue));
break;
case VALUE_NOT_SET:
}
}
}
return ImmutableSet.copyOf(referencedResources);
}
Aggregations